mirror of
https://github.com/langgenius/webapp-conversation.git
synced 2025-12-08 17:32:27 +08:00
- Replace .eslintrc.json with eslint.config.mjs - Simplify configuration using @antfu/eslint-config - Add necessary ESLint plugin dependencies - Disable overly strict style rules - Set package.json type to module for ESM support - Fix ESLint disable comment format 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
24 lines
742 B
TypeScript
24 lines
742 B
TypeScript
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
|
|
})
|
|
}
|