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
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ui/src/components/ai-chat/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

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

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

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

Expand Down
Loading