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

This commit is contained in:
Joel 2023-09-10 09:30:30 +08:00 committed by GitHub
parent 2d5ad0d208
commit 5412f4aba5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 5 deletions

View File

@ -52,13 +52,18 @@ const ConfigVar: FC<IConfigVarProps> = ({ promptVariables, readonly, onPromptVar
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) => {
if (item.key === key) {
const newItem: any = { ...item }
updateKeys.forEach((updateKey, i) => {
newItem[updateKey] = newValues[i]
})
if (isParagraph) {
delete newItem.max_length
delete newItem.options
}
console.log(newItem)
return newItem
}
@ -247,9 +252,8 @@ const ConfigVar: FC<IConfigVarProps> = ({ promptVariables, readonly, onPromptVar
onConfirm={({ type, value }) => {
if (type === 'string')
batchUpdatePromptVariable(currKey as string, ['type', 'max_length'], [type, value || DEFAULT_VALUE_MAX_LEN])
else
batchUpdatePromptVariable(currKey as string, ['type', 'options'], [type, value || []])
batchUpdatePromptVariable(currKey as string, ['type', 'options'], [type, value || []], type === 'paragraph')
hideEditModal()
}}

View File

@ -81,7 +81,7 @@ const getFormattedChatList = (messages: ChatMessage[]) => {
messages.forEach((item: ChatMessage) => {
newChatList.push({
id: `question-${item.id}`,
content: item.query,
content: item.inputs.query || item.query, // text generation: item.inputs.query; chat: item.query
isAnswer: false,
})
@ -413,7 +413,7 @@ const ConversationList: FC<IConversationList> = ({ logs, appDetail, onRefresh })
<tbody className="text-gray-500">
{logs.data.map((log) => {
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')
return <tr
key={log.id}