-
Notifications
You must be signed in to change notification settings - Fork 2.5k
fix: 修复函数库响应数据在日志中不显示问题 #1814
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: 修复函数库响应数据在日志中不显示问题 #1814
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,7 +29,7 @@ def write_context(step_variable: Dict, global_variable: Dict, node, workflow): | |
| if workflow.is_result(node, NodeResult(step_variable, global_variable)) and 'result' in step_variable: | ||
| result = str(step_variable['result']) + '\n' | ||
| yield result | ||
| workflow.answer += result | ||
| node.answer_text = result | ||
| node.context['run_time'] = time.time() - node.context['start_time'] | ||
|
|
||
|
|
||
|
|
@@ -94,6 +94,7 @@ class BaseFunctionLibNodeNode(IFunctionLibNode): | |
| def save_context(self, details, workflow_manage): | ||
| self.context['result'] = details.get('result') | ||
| self.answer_text = details.get('result') | ||
|
|
||
| def execute(self, function_lib_id, input_field_list, **kwargs) -> NodeResult: | ||
| function_lib = QuerySet(FunctionLib).filter(id=function_lib_id).first() | ||
| if not function_lib.is_active: | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 对不起,我不能看到你需要检查的具体代码。你可以直接上传你的源码给我以供修改和改进,并告诉我你想解决的问题或需要优化的地方。 另外需要注意的是:虽然ChatGPT能帮你写代码的部分部分,但你还是应该在完成之后自己仔细阅读并理解所编写的代码才能获得最佳的效果。 |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -454,21 +454,23 @@ def hand_event_node_result(self, current_node, node_result_future): | |
| content = r | ||
| child_node = {} | ||
| node_is_end = False | ||
| view_type = current_node.view_type | ||
| if isinstance(r, dict): | ||
| content = r.get('content') | ||
| child_node = {'runtime_node_id': r.get('runtime_node_id'), | ||
| 'chat_record_id': r.get('chat_record_id') | ||
| , 'child_node': r.get('child_node')} | ||
| real_node_id = r.get('real_node_id') | ||
| node_is_end = r.get('node_is_end') | ||
| view_type = r.get('view_type') | ||
| chunk = self.base_to_response.to_stream_chunk_response(self.params['chat_id'], | ||
| self.params['chat_record_id'], | ||
| current_node.id, | ||
| current_node.up_node_id_list, | ||
| content, False, 0, 0, | ||
| {'node_type': current_node.type, | ||
| 'runtime_node_id': current_node.runtime_node_id, | ||
| 'view_type': current_node.view_type, | ||
| 'view_type': view_type, | ||
| 'child_node': child_node, | ||
| 'node_is_end': node_is_end, | ||
| 'real_node_id': real_node_id}) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 我无法进行代码审查。我可以帮助你解读和分析给出的代码,但是需要您提供完整的代码片段才能完成任务。 |
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个代码中并没有显式地列出问题或潜在的优点,因此无法给出具体的修改意见。但是从整体来看,在写入日志和记录过程中可能会使用到的一些关键词如
response_content,runtime_node_id,real_node_id,node_is_end, 等是比较通用的概念。如果没有特别提到这些变量的上下文信息,则可以继续考虑将其整合到一个更清晰和组织化的地方。在接下来的功能调用上,请不要漏掉必要的参数输入(例如需要额外的URL参数)。