|
|
|
@ -10,6 +10,8 @@ from fastapi.staticfiles import StaticFiles
|
|
|
|
|
from openai import OpenAI
|
|
|
|
|
from sse_starlette.sse import EventSourceResponse
|
|
|
|
|
from gensim.models import KeyedVectors
|
|
|
|
|
from starlette.responses import StreamingResponse
|
|
|
|
|
|
|
|
|
|
from Config import Config
|
|
|
|
|
from Config.Config import MS_MODEL_PATH, MS_MODEL_LIMIT, MS_HOST, MS_PORT, MS_MAX_CONNECTIONS, MS_NPROBE, DEEPSEEK_API_KEY, DEEPSEEK_URL, MS_COLLECTION_NAME
|
|
|
|
|
from Milvus.Utils.MilvusCollectionManager import MilvusCollectionManager
|
|
|
|
@ -190,10 +192,16 @@ async def save_to_word(request: Request):
|
|
|
|
|
doc.save(file_stream)
|
|
|
|
|
file_stream.seek(0)
|
|
|
|
|
|
|
|
|
|
# 获取文件内容并计算长度
|
|
|
|
|
file_content = file_stream.getvalue()
|
|
|
|
|
|
|
|
|
|
return StreamingResponse(
|
|
|
|
|
file_stream,
|
|
|
|
|
BytesIO(file_content),
|
|
|
|
|
media_type="application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
|
|
|
headers={"Content-Disposition": "attachment; filename=小学数学问答.docx"}
|
|
|
|
|
headers={
|
|
|
|
|
"Content-Disposition": "attachment; filename*=UTF-8''%E5%B0%8F%E5%AD%A6%E6%95%B0%E5%AD%A6%E9%97%AE%E7%AD%94.docx",
|
|
|
|
|
"Content-Length": str(len(file_content))
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@app.post("/api/rag")
|
|
|
|
|