forked from tuvn86/webapp-conversation
feat: conversation support show thought
This commit is contained in:
parent
b62e34c6fa
commit
83695999ea
3 changed files with 31 additions and 2 deletions
26
utils/tools.ts
Normal file
26
utils/tools.ts
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import type { ThoughtItem } from '@/app/components/chat/type'
|
||||
import type { VisionFile } from '@/types/app'
|
||||
|
||||
export const sortAgentSorts = (list: ThoughtItem[]) => {
|
||||
if (!list)
|
||||
return list
|
||||
if (list.some(item => item.position === undefined))
|
||||
return list
|
||||
const temp = [...list]
|
||||
temp.sort((a, b) => a.position - b.position)
|
||||
return temp
|
||||
}
|
||||
|
||||
export const addFileInfos = (list: ThoughtItem[], messageFiles: VisionFile[]) => {
|
||||
if (!list || !messageFiles)
|
||||
return list
|
||||
return list.map((item) => {
|
||||
if (item.files && item.files?.length > 0) {
|
||||
return {
|
||||
...item,
|
||||
message_files: item.files.map(fileId => messageFiles.find(file => file.id === fileId)) as VisionFile[],
|
||||
}
|
||||
}
|
||||
return item
|
||||
})
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue