浏览代码

fix: in log page not show user query (#1140)

tags/0.3.21
Joel 2 年前
父节点
当前提交
5412f4aba5
没有帐户链接到提交者的电子邮件
共有 2 个文件被更改,包括 9 次插入5 次删除
  1. 7
    3
      web/app/components/app/configuration/config-var/index.tsx
  2. 2
    2
      web/app/components/app/log/list.tsx

+ 7
- 3
web/app/components/app/configuration/config-var/index.tsx 查看文件

onPromptVariablesChange?.(newPromptVariables) onPromptVariablesChange?.(newPromptVariables)
} }


const batchUpdatePromptVariable = (key: string, updateKeys: string[], newValues: any[]) => {
const batchUpdatePromptVariable = (key: string, updateKeys: string[], newValues: any[], isParagraph?: boolean) => {
const newPromptVariables = promptVariables.map((item) => { const newPromptVariables = promptVariables.map((item) => {
if (item.key === key) { if (item.key === key) {
const newItem: any = { ...item } const newItem: any = { ...item }
updateKeys.forEach((updateKey, i) => { updateKeys.forEach((updateKey, i) => {
newItem[updateKey] = newValues[i] newItem[updateKey] = newValues[i]
}) })
if (isParagraph) {
delete newItem.max_length
delete newItem.options
}
console.log(newItem)
return newItem return newItem
} }


onConfirm={({ type, value }) => { onConfirm={({ type, value }) => {
if (type === 'string') if (type === 'string')
batchUpdatePromptVariable(currKey as string, ['type', 'max_length'], [type, value || DEFAULT_VALUE_MAX_LEN]) batchUpdatePromptVariable(currKey as string, ['type', 'max_length'], [type, value || DEFAULT_VALUE_MAX_LEN])

else else
batchUpdatePromptVariable(currKey as string, ['type', 'options'], [type, value || []])
batchUpdatePromptVariable(currKey as string, ['type', 'options'], [type, value || []], type === 'paragraph')


hideEditModal() hideEditModal()
}} }}

+ 2
- 2
web/app/components/app/log/list.tsx 查看文件

messages.forEach((item: ChatMessage) => { messages.forEach((item: ChatMessage) => {
newChatList.push({ newChatList.push({
id: `question-${item.id}`, id: `question-${item.id}`,
content: item.query,
content: item.inputs.query || item.query, // text generation: item.inputs.query; chat: item.query
isAnswer: false, isAnswer: false,
}) })


<tbody className="text-gray-500"> <tbody className="text-gray-500">
{logs.data.map((log) => { {logs.data.map((log) => {
const endUser = log.from_end_user_session_id const endUser = log.from_end_user_session_id
const leftValue = get(log, isChatMode ? 'summary' : 'message.query')
const leftValue = get(log, isChatMode ? 'summary' : 'message.inputs.query')
const rightValue = get(log, isChatMode ? 'message_count' : 'message.answer') const rightValue = get(log, isChatMode ? 'message_count' : 'message.answer')
return <tr return <tr
key={log.id} key={log.id}

正在加载...
取消
保存