Skip to content

Commit

Permalink
fix: 修复本地模型加载失败时,错误信息未输出
Browse files Browse the repository at this point in the history
  • Loading branch information
shaohuzhang1 committed Sep 20, 2024
1 parent a980604 commit b8d1512
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def embed_query(self, text: str) -> List[float]:
result = res.json()
if result.get('code', 500) == 200:
return result.get('data')
raise Exception(result.get('msg'))
raise Exception(result.get('message'))

def embed_documents(self, texts: List[str]) -> List[List[float]]:
bind = f'{CONFIG.get("LOCAL_MODEL_HOST")}:{CONFIG.get("LOCAL_MODEL_PORT")}'
Expand All @@ -44,7 +44,7 @@ def embed_documents(self, texts: List[str]) -> List[List[float]]:
result = res.json()
if result.get('code', 500) == 200:
return result.get('data')
raise Exception(result.get('msg'))
raise Exception(result.get('message'))


class LocalEmbedding(MaxKBBaseModel, HuggingFaceEmbeddings):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def compress_documents(self, documents: Sequence[Document], query: str, callback
if result.get('code', 500) == 200:
return [Document(page_content=document.get('page_content'), metadata=document.get('metadata')) for document
in result.get('data')]
raise Exception(result.get('msg'))
raise Exception(result.get('message'))


class LocalBaseReranker(MaxKBBaseModel, BaseDocumentCompressor):
Expand Down

0 comments on commit b8d1512

Please sign in to comment.