diff --git a/ui/src/components/chat-plus/api/chat.ts b/ui/src/components/chat-plus/api/chat.ts deleted file mode 100644 index 97e461681cf..00000000000 --- a/ui/src/components/chat-plus/api/chat.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { get, postStream, del, put, post } from '@/request/chat/index' - -const prefix = (window.MaxKB?.prefix || '/chat') + '/api' - -export const open = () => - get('/open', {}) - -export const chat = (chatId: string, data: any) => - postStream(`${prefix}/chat_message/${chatId}`, data) - -export const history = (page: number, size: number) => - get(`/historical_conversation/${page}/${size}`) - -export const records = (chatId: string, page: number, size: number) => - get(`/historical_conversation_record/${chatId}/${page}/${size}`) - -export const recordDetail = (chatId: string, recordId: string) => - get(`/historical_conversation/${chatId}/record/${recordId}`) - -export const vote = (chatId: string, recordId: string, voteStatus: string, reason?: string) => - put(`/vote/chat/${chatId}/chat_record/${recordId}`, { - vote_status: voteStatus, - ...(reason !== undefined && { vote_reason: reason }), - }) - -export const deleteChat = (chatId: string) => - del(`/historical_conversation/${chatId}`) - -export const clearChat = () => - del('/historical_conversation/clear') - -export const modifyChat = (chatId: string, data: any) => - put(`/historical_conversation/${chatId}`, data) - -export const uploadFile = (file: File, sourceId: string, sourceType: string) => { - const fd = new FormData() - fd.append('file', file) - fd.append('source_id', sourceId) - fd.append('source_type', sourceType) - return post('/oss/file', fd) -} diff --git a/ui/src/components/chat-plus/api/debug.ts b/ui/src/components/chat-plus/api/debug.ts deleted file mode 100644 index 4cdf5ec570b..00000000000 --- a/ui/src/components/chat-plus/api/debug.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { get, postStream, del, put, post } from '@/request/index' -import useStore from '@/stores' - -const prefix = (window.MaxKB?.prefix || '/admin') + '/api' - -export const open = (applicationId: string) => { - const { user } = useStore() - return get(`/workspace/${user.getWorkspaceId()}/application/${applicationId}/open`, {}) -} - -export const chat = (chatId: string, data: any) => - postStream(`${prefix}/chat_message/${chatId}`, data) - -export const history = (page: number, size: number) => - get(`/historical_conversation/${page}/${size}`) - -export const records = (chatId: string, page: number, size: number) => - get(`/historical_conversation_record/${chatId}/${page}/${size}`) - -export const recordDetail = (chatId: string, recordId: string) => - get(`/historical_conversation/${chatId}/record/${recordId}`) - -export const vote = (chatId: string, recordId: string, voteStatus: string, reason?: string) => - put(`/vote/chat/${chatId}/chat_record/${recordId}`, { - vote_status: voteStatus, - ...(reason !== undefined && { vote_reason: reason }), - }) - -export const deleteChat = (chatId: string) => - del(`/historical_conversation/${chatId}`) - -export const clearChat = () => - del('/historical_conversation/clear') - -export const modifyChat = (chatId: string, data: any) => - put(`/historical_conversation/${chatId}`, data) - -export const uploadFile = (file: File, sourceId: string, sourceType: string) => { - const fd = new FormData() - fd.append('file', file) - fd.append('source_id', sourceId) - fd.append('source_type', sourceType) - return post('/oss/file', fd) -} diff --git a/ui/src/components/chat-plus/api/index.ts b/ui/src/components/chat-plus/api/index.ts deleted file mode 100644 index a86043a06fd..00000000000 --- a/ui/src/components/chat-plus/api/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -import * as chat from './chat' -import * as debug from './debug' - -export type ChatType = 'CHAT' | 'DEBUG' - -const apis = { CHAT: chat, DEBUG: debug } as const - -export const useApi = (type: ChatType) => apis[type] diff --git a/ui/src/components/chat-plus/bus.ts b/ui/src/components/chat-plus/bus.ts deleted file mode 100644 index 6d726947149..00000000000 --- a/ui/src/components/chat-plus/bus.ts +++ /dev/null @@ -1,37 +0,0 @@ -type Handler = (...args: any[]) => void - -class ChatBus { - private events = new Map>() - - on(event: string, handler: Handler) { - if (!this.events.has(event)) { - this.events.set(event, new Set()) - } - this.events.get(event)!.add(handler) - return () => this.off(event, handler) - } - - off(event: string, handler: Handler) { - this.events.get(event)?.delete(handler) - } - - emit(event: string, ...args: any[]) { - this.events.get(event)?.forEach((handler) => handler(...args)) - } - - clear() { - this.events.clear() - } -} - -export const chatBus = new ChatBus() - -export const ChatEvents = { - OPEN_CONVERSATION: 'open:conversation', - NEW_CONVERSATION: 'new:conversation', - DELETE_CONVERSATION: 'delete:conversation', - RENAME_CONVERSATION: 'rename:conversation', - SEND_MESSAGE: 'send:message', - STOP_GENERATING: 'stop:generating', - REFRESH_LIST: 'refresh:list', -} as const diff --git a/ui/src/components/chat-plus/component/answer-content/index.vue b/ui/src/components/chat-plus/component/answer-content/index.vue deleted file mode 100644 index 53870d4f08d..00000000000 --- a/ui/src/components/chat-plus/component/answer-content/index.vue +++ /dev/null @@ -1,143 +0,0 @@ - - - diff --git a/ui/src/components/chat-plus/component/answer-content/items/failure.vue b/ui/src/components/chat-plus/component/answer-content/items/failure.vue deleted file mode 100644 index d06fd85168b..00000000000 --- a/ui/src/components/chat-plus/component/answer-content/items/failure.vue +++ /dev/null @@ -1,10 +0,0 @@ - - - diff --git a/ui/src/components/chat-plus/component/answer-content/items/form.vue b/ui/src/components/chat-plus/component/answer-content/items/form.vue deleted file mode 100644 index 008c54a558d..00000000000 --- a/ui/src/components/chat-plus/component/answer-content/items/form.vue +++ /dev/null @@ -1,62 +0,0 @@ - - - - diff --git a/ui/src/components/chat-plus/component/answer-content/items/index.vue b/ui/src/components/chat-plus/component/answer-content/items/index.vue deleted file mode 100644 index a61d04a6fcf..00000000000 --- a/ui/src/components/chat-plus/component/answer-content/items/index.vue +++ /dev/null @@ -1,22 +0,0 @@ - - - diff --git a/ui/src/components/chat-plus/component/answer-content/items/reasoning.vue b/ui/src/components/chat-plus/component/answer-content/items/reasoning.vue deleted file mode 100644 index 288b21a30bf..00000000000 --- a/ui/src/components/chat-plus/component/answer-content/items/reasoning.vue +++ /dev/null @@ -1,180 +0,0 @@ - - - - - diff --git a/ui/src/components/chat-plus/component/answer-content/items/text.vue b/ui/src/components/chat-plus/component/answer-content/items/text.vue deleted file mode 100644 index 862503e4169..00000000000 --- a/ui/src/components/chat-plus/component/answer-content/items/text.vue +++ /dev/null @@ -1,20 +0,0 @@ - - - - - diff --git a/ui/src/components/chat-plus/component/answer-content/items/tool.vue b/ui/src/components/chat-plus/component/answer-content/items/tool.vue deleted file mode 100644 index cab8ebb5c30..00000000000 --- a/ui/src/components/chat-plus/component/answer-content/items/tool.vue +++ /dev/null @@ -1,26 +0,0 @@ - - - diff --git a/ui/src/components/chat-plus/component/chat-panel/index.vue b/ui/src/components/chat-plus/component/chat-panel/index.vue deleted file mode 100644 index dafb89c5e86..00000000000 --- a/ui/src/components/chat-plus/component/chat-panel/index.vue +++ /dev/null @@ -1,167 +0,0 @@ -