Skip to content

fix: 修复工作流对话,无法显示回答内容 #1619

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

Merged
merged 1 commit into from
Nov 13, 2024

Conversation

shaohuzhang1
Copy link
Contributor

fix: 修复工作流对话,无法显示回答内容

Copy link

f2c-ci-robot bot commented Nov 13, 2024

Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@shaohuzhang1 shaohuzhang1 merged commit 6102c71 into main Nov 13, 2024
4 checks passed
Copy link

f2c-ci-robot bot commented Nov 13, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@shaohuzhang1 shaohuzhang1 deleted the pr@main@fix_workflow_chat branch November 13, 2024 09:06
@@ -370,7 +370,7 @@ function chatMessage(chat?: any, problem?: string, re_chat?: boolean, other_para
*/
function getSourceDetail(row: any) {
logApi.getRecordDetail(id || props.appId, row.chat_id, row.record_id, loading).then((res) => {
const exclude_keys = ['answer_text', 'id']
const exclude_keys = ['answer_text', 'id', 'answer_text_list']
Object.keys(res.data).forEach((key) => {
if (!exclude_keys.includes(key)) {
row[key] = res.data[key]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

此代码存在一些潜在问题:使用props.appId获取记录详情的数据会导致安全风险,因为这个变量在服务器端可能有危险操作。此外,在处理特定字段或数据时使用数组(如['answer_text', 'id'], '['...list...']')而不是单个对象(例如{'answer_text': ...}obj.id = value;)可以提高性能。

以下是改进后的版本:

function getRecordDetail(id: number, record_id: number, loading: boolean): Promise<API.RecordResult> {

}

const getSourceDetail = async (row: API.SmartChatRecordItem): Promise<Partial<API.SmartChatData>> => {
  await loadFromSource();
}

// 其他未修改的地方...

请注意,我无法验证实际的业务逻辑或应用中这些更改是否对整个系统有益。您应该根据实际情况调整和测试它们。

如果您需要更详细的讨论,请告诉我您的具体需求。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants