Spaces:
Running
Running
fix: SyntaxError 수정 - 행정 AX 코드 올바른 위치 삽입
Browse files
app.py
CHANGED
|
@@ -790,6 +790,20 @@ async def chat(request: Request):
|
|
| 790 |
for r in search_results if r.get("link")]
|
| 791 |
if srcs:
|
| 792 |
yield f"data: {json.dumps({'sources': srcs}, ensure_ascii=False)}\n\n".encode()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 793 |
|
| 794 |
|
| 795 |
# ============================================================
|
|
@@ -1109,17 +1123,3 @@ async def demo_file(filename: str):
|
|
| 1109 |
raise HTTPException(404, "demo file not found")
|
| 1110 |
mt = _mimetypes.guess_type(fp)[0] or "application/octet-stream"
|
| 1111 |
return FileResponse(fp, media_type=mt, filename=filename)
|
| 1112 |
-
yield b"data: [DONE]\n\n"
|
| 1113 |
-
return
|
| 1114 |
-
except httpx.ConnectError as e:
|
| 1115 |
-
yield f"data: {json.dumps({'error': f'LLM 서버 연결 실패: {str(e)[:200]}. JGOS_LLM_BASE_URL 확인.'})}\n\n".encode()
|
| 1116 |
-
except Exception as e:
|
| 1117 |
-
yield f"data: {json.dumps({'error': f'{type(e).__name__}: {str(e)[:200]}'})}\n\n".encode()
|
| 1118 |
-
|
| 1119 |
-
return StreamingResponse(stream(), media_type="text/event-stream", headers={
|
| 1120 |
-
"Cache-Control": "no-cache", "X-Accel-Buffering": "no",
|
| 1121 |
-
})
|
| 1122 |
-
|
| 1123 |
-
if __name__ == "__main__":
|
| 1124 |
-
import uvicorn
|
| 1125 |
-
uvicorn.run(app, host="0.0.0.0", port=int(os.getenv("PORT", "7860")))
|
|
|
|
| 790 |
for r in search_results if r.get("link")]
|
| 791 |
if srcs:
|
| 792 |
yield f"data: {json.dumps({'sources': srcs}, ensure_ascii=False)}\n\n".encode()
|
| 793 |
+
yield b"data: [DONE]\n\n"
|
| 794 |
+
return
|
| 795 |
+
except httpx.ConnectError as e:
|
| 796 |
+
yield f"data: {json.dumps({'error': f'LLM 서버 연결 실패: {str(e)[:200]}. JGOS_LLM_BASE_URL 확인.'})}\n\n".encode()
|
| 797 |
+
except Exception as e:
|
| 798 |
+
yield f"data: {json.dumps({'error': f'{type(e).__name__}: {str(e)[:200]}'})}\n\n".encode()
|
| 799 |
+
|
| 800 |
+
return StreamingResponse(stream(), media_type="text/event-stream", headers={
|
| 801 |
+
"Cache-Control": "no-cache", "X-Accel-Buffering": "no",
|
| 802 |
+
})
|
| 803 |
+
|
| 804 |
+
if __name__ == "__main__":
|
| 805 |
+
import uvicorn
|
| 806 |
+
uvicorn.run(app, host="0.0.0.0", port=int(os.getenv("PORT", "7860")))
|
| 807 |
|
| 808 |
|
| 809 |
# ============================================================
|
|
|
|
| 1123 |
raise HTTPException(404, "demo file not found")
|
| 1124 |
mt = _mimetypes.guess_type(fp)[0] or "application/octet-stream"
|
| 1125 |
return FileResponse(fp, media_type=mt, filename=filename)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|