Merge branch 'feat/0.2.2' of github.com:dataelement/bisheng into feat/0.2.2

This commit is contained in:
dolphin
2024-01-12 21:34:05 +08:00
7 changed files with 9 additions and 8 deletions
+2 -2
View File
@@ -1,5 +1,5 @@
import json
from typing import List, Optional, Union
from typing import List, Optional
from uuid import UUID
from bisheng.api.utils import build_flow, build_input_keys_response
@@ -115,10 +115,10 @@ def get_chatlist_list(*, session: Session = Depends(get_session), Authorize: Aut
@router.websocket('/chat/{flow_id}')
async def chat(
*,
flow_id: str,
websocket: WebSocket,
chat_id: Optional[str] = None,
session_id: Union[None, str] = None, # noqa: F821
Authorize: AuthJWT = Depends(),
):
"""Websocket endpoint for chat."""
-1
View File
@@ -22,7 +22,6 @@ expire = 600 # reids 60s 过期
async def union_websocket(flow_id: str,
websocket: WebSocket,
chat_id: Optional[str] = None,
type: Optional[str] = None,
knowledge_id: Optional[int] = None):
"""Websocket endpoint forF chat."""
if chat_id:
+2 -2
View File
@@ -111,8 +111,8 @@ async def judge_source(result, source_document, chat_id, extra: Dict):
if source:
for doc in source_document:
# 确保每个chunk 都可溯源
if 'bbox' not in doc.metadata or not doc.metadata['bbox'] or not doc.metadata['bbox'][
'chunk_bboxes']:
if 'bbox' not in doc.metadata or not doc.metadata['bbox'] or not json.loads(
doc.metadata['bbox'])['chunk_bboxes']:
source = 0
break
return source, result
+1 -1
View File
@@ -31,7 +31,7 @@ def init_default_data():
session.commit()
user = session.exec(select(User).limit(1)).all()
if not user:
if not user and settings.admin:
md5 = hashlib.md5()
md5.update(settings.admin.get('password').encode('utf-8'))
user = User(
+1 -1
View File
@@ -55,7 +55,7 @@ def configure(log_level: Optional[str] = None, log_file: Optional[Path] = None):
log_file = Path(log_file)
log_file.parent.mkdir(parents=True, exist_ok=True)
log_format_file = '[%Y-%m-%d %H:%M:%S.%f] [{level.name} process-{process.id}-{thread.id} {name}:{line}] - trace={extra[trace_id]} {message}' # noqa
log_format_file = '[{time:YYYY-MM-DD at HH:mm:ss.SSS}] [{level.name} process-{process.id}-{thread.id} {name}:{line}] - trace={extra[trace_id]} {message}' # noqa
logger.add(
sink=str(log_file),
level=log_level.upper(),
+2 -1
View File
@@ -10,4 +10,5 @@ pydantic==1.10.13
pymupdf==1.23.8
pypdfium2==4.25.0
shapely==2.0.2
filetype==1.2.0
filetype==1.2.0
+1
View File
@@ -1 +1,2 @@
v0.2.2