mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-09-17 15:10:14 +00:00
Merge branch 'llm_framework' into dev_ty_06_end
# Conflicts: # pilot/server/static/_next/static/chunks/702.d4f5815f0f061322.js # pilot/server/static/_next/static/chunks/app/agents/page-4286c92088ccc4e9.js # pilot/server/static/_next/static/chunks/app/datastores/documents/chunklist/page-65ded782e5468079.js # pilot/server/static/_next/static/chunks/app/datastores/documents/page-0b797043cfee212f.js # pilot/server/static/_next/static/chunks/app/datastores/page-171d660b8104db30.js
This commit is contained in:
@@ -17,7 +17,6 @@ from fastapi.responses import JSONResponse, HTMLResponse
|
||||
from fastapi.responses import StreamingResponse, FileResponse
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from fastapi.exceptions import RequestValidationError
|
||||
from sse_starlette.sse import EventSourceResponse
|
||||
from typing import List
|
||||
|
||||
from pilot.openapi.api_v1.api_view_model import (
|
||||
|
@@ -56,10 +56,10 @@ def space_list(request: KnowledgeSpaceRequest):
|
||||
def document_add(space_name: str, request: KnowledgeDocumentRequest):
|
||||
print(f"/document/add params: {space_name}, {request}")
|
||||
try:
|
||||
knowledge_space_service.create_knowledge_document(
|
||||
return Result.succ(knowledge_space_service.create_knowledge_document(
|
||||
space=space_name, request=request
|
||||
)
|
||||
return Result.succ([])
|
||||
))
|
||||
# return Result.succ([])
|
||||
except Exception as e:
|
||||
return Result.faild(code="E000X", msg=f"document add error {e}")
|
||||
|
||||
@@ -106,10 +106,10 @@ async def document_upload(
|
||||
KNOWLEDGE_UPLOAD_ROOT_PATH, space_name, doc_file.filename
|
||||
),
|
||||
)
|
||||
knowledge_space_service.create_knowledge_document(
|
||||
return Result.succ(knowledge_space_service.create_knowledge_document(
|
||||
space=space_name, request=request
|
||||
)
|
||||
return Result.succ([])
|
||||
))
|
||||
# return Result.succ([])
|
||||
return Result.faild(code="E000X", msg=f"doc_file is None")
|
||||
except Exception as e:
|
||||
return Result.faild(code="E000X", msg=f"document add error {e}")
|
||||
|
@@ -56,8 +56,9 @@ class KnowledgeDocumentDao:
|
||||
)
|
||||
session.add(knowledge_document)
|
||||
session.commit()
|
||||
|
||||
doc_id = knowledge_document.id
|
||||
session.close()
|
||||
return doc_id
|
||||
|
||||
def get_knowledge_documents(self, query, page=1, page_size=20):
|
||||
session = self.Session()
|
||||
|
@@ -78,8 +78,7 @@ class KnowledgeService:
|
||||
content=request.content,
|
||||
result="",
|
||||
)
|
||||
knowledge_document_dao.create_knowledge_document(document)
|
||||
return True
|
||||
return knowledge_document_dao.create_knowledge_document(document)
|
||||
|
||||
"""get knowledge space"""
|
||||
|
||||
|
Reference in New Issue
Block a user