初始化提交

This commit is contained in:
2024-08-13 09:37:23 +08:00
parent 4923337038
commit e112fa4e44
50 changed files with 1649 additions and 259 deletions
+4 -4
View File
@@ -20,9 +20,9 @@ class CallbackEvent(BaseModel):
if self.payload:
nodes = self.payload.get("nodes")
if nodes:
msg = f"Retrieved {len(nodes)} sources to use as context for the query"
msg = f"根据查询检索到 {len(nodes)} 源文件"
else:
msg = f"Retrieving context for query: '{self.payload.get('query_str')}'"
msg = f"查询检索中: '{self.payload.get('query_str')}'"
return {
"type": "events",
"data": {"title": msg},
@@ -37,7 +37,7 @@ class CallbackEvent(BaseModel):
return {
"type": "events",
"data": {
"title": f"Calling tool: {tool.name} with inputs: {func_call_args}",
"title": f"调用工具 {tool.name} ,参数: {func_call_args}",
},
}
@@ -87,7 +87,7 @@ class CallbackEvent(BaseModel):
case _:
return None
except Exception as e:
logger.error(f"Error in converting event to response: {e}")
logger.error(f"转换回应时间时发生错误,原因: {e}")
return None
+2 -2
View File
@@ -173,12 +173,12 @@ class SourceNodes(BaseModel):
def from_source_node(cls, source_node: NodeWithScore):
metadata = source_node.node.metadata
url = cls.get_url_from_metadata(metadata)
text = 'filename' in metadata and metadata['filename'] or source_node.node.node_id
return cls(
id=source_node.node.node_id,
metadata=metadata,
score=source_node.score,
text=source_node.node.text, # type: ignore
text=text, # type: ignore
url=url,
)