feat(chat): 为聊天功能添加上传本地文件和远程URL附件的支持

This commit is contained in:
hugo committed 2026-06-02 10:15:35 +08:00
1 parent 2a036764e3
commit a1e0fa9404
7 files changed
+1024 -17

No files matched your search

+11 -2
View File
@@ -179,7 +179,15 @@ export function useChat() {
* query: 用户输入文本
* agentId: 目标 Agent ID
*/
const sendMessage = async (query: string, agentId: number, kbType: string = '企业知识库') => {
const sendMessage = async (
query: string,
agentId: number,
kbType: string = '企业知识库',
files?: Array<
| { type: 'image' | 'document' | 'audio' | 'video' | 'custom'; transfer_method: 'local_file'; upload_file_id: string }
| { type: 'image' | 'document' | 'audio' | 'video' | 'custom'; transfer_method: 'remote_url'; url: string }
>,
) => {
const runViewId = viewId.value;
const runMessages = messages.value;
const run: ChatRun = {
@@ -227,7 +235,8 @@ export function useChat() {
query,
agent_id: agentId,
conversation_id: conversationId.value,
kb_type: kbType
kb_type: kbType,
files: files && files.length > 0 ? files : undefined,
})
});