Skip to content

Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.

Merge upstream main and resolve conflicts

Mao Meng78e36d4ade6e
diff --cc frontend/src/components/Input-field.vue
index 5ebc8c22f,88d35bc34..04ee3b5be
--- a/frontend/src/components/Input-field.vue
+++ b/frontend/src/components/Input-field.vue
@@@ -15,10 -15,9 +15,10 @@@ import AgentSelector from './AgentSelec
import { getCaretCoordinates } from '@/utils/caret';
import { listModels, type ModelConfig } from '@/api/model';
import { listAgents, type CustomAgent, BUILTIN_QUICK_ANSWER_ID, BUILTIN_SMART_REASONING_ID } from '@/api/agent';
- import { getTenantWebSearchConfig } from '@/api/web-search';
+ import { listWebSearchProviders, type WebSearchProviderEntity } from '@/api/web-search-provider';
import { getConversationConfig, updateConversationConfig, type ConversationConfig } from '@/api/system';
import { useI18n } from 'vue-i18n';
+import AttachmentUpload, { type AttachmentFile } from './AttachmentUpload.vue';
const route = useRoute();
const router = useRouter();
diff --cc frontend/src/views/chat/index.vue
index 2663c24f8,34c2c63e5..e020eb138
--- a/frontend/src/views/chat/index.vue
+++ b/frontend/src/views/chat/index.vue
@@@ -441,40 -493,10 +493,41 @@@ const sendMsg = async (value, modelId
}
}
+ // Convert attachment files to base64 for backend processing
+ let attachmentUploads = [];
+ if (attachmentFiles && attachmentFiles.length > 0) {
+ try {
+ for (const attachment of attachmentFiles) {
+ const reader = new FileReader();
+ const base64Promise = new Promise((resolve, reject) => {
+ reader.onload = () => {
+ const result = reader.result;
+ // Extract base64 content (remove data:...;base64, prefix)
+ const base64 = result.split(',')[1];
+ resolve(base64);
+ };
+ reader.onerror = reject;
+ reader.readAsDataURL(attachment.file);
+ });
+ const base64Data = await base64Promise;
+ attachmentUploads.push({
+ data: base64Data,
+ file_name: attachment.name,
+ file_size: attachment.size
+ });
+ }
+ } catch (e) {
+ console.error('[Attachment] Failed to read attachments:', e);
+ loading.value = false;
+ isReplying.value = false;
+ return;
+ }
+ }
+
// 将@提及的知识库和文件信息存入用户消息
- messagesList.push({ content: value, role: 'user', mentioned_items: mentionedItems, images: userImages, attachments: attachmentFiles.map(a => ({ file_name: a.name, file_size: a.size, file_type: '.' + a.name.split('.').pop()?.toLowerCase() })), channel: 'web' });
- scrollToBottom();
- messagesList.push({ content: value, role: 'user', mentioned_items: mentionedItems, images: userImages, channel: 'web' });
++ messagesList.push({ content: value, role: 'user', mentioned_items: mentionedItems, images: userImages, attachments: attachmentFiles.map(a => ({ file_name: a.name, file_size: a.size, file_type: '.' + a.name.split('.').pop()?.toLowerCase() })), channel: 'web' });
+ userHasScrolledUp.value = false;
+ scrollToBottom(true);
// Get agent mode status from settings store
const agentEnabled = useSettingsStoreInstance.isAgentEnabled;
@@@ -1110,8 -1131,9 +1163,9 @@@ onMounted(async () =>
checkmenuTitle(session_id.value)
if (firstQuery.value) {
scrollLock.value = true;
- sendMsg(firstQuery.value, firstModelId.value || '', firstMentionedItems.value || [], firstImageFiles.value || [], firstAttachmentFiles.value || []);
+ historyLoading.value = false;
- sendMsg(firstQuery.value, firstModelId.value || '', firstMentionedItems.value || [], firstImageFiles.value || []);
- usemenuStore.changeFirstQuery('', [], '', []);
++ sendMsg(firstQuery.value, firstModelId.value || '', firstMentionedItems.value || [], firstImageFiles.value || [], firstAttachmentFiles.value || []);
+ usemenuStore.changeFirstQuery('', [], '', [], []);
} else {
scrollLock.value = false;
let data = {
diff --cc internal/types/chat_manage.go
index c87302aab,1e8a02658..da5ae2e72
--- a/internal/types/chat_manage.go
+++ b/internal/types/chat_manage.go
@@@ -45,16 -45,14 +45,17 @@@ type PipelineRequest struct
VLMModelID string `json:"-"`
ChatModelSupportsVision bool `json:"-"`
+ // File attachments support
+ Attachments MessageAttachments `json:"-"`
+
// Misc request-scoped config
- TenantID uint64 `json:"-"`
- WebSearchEnabled bool `json:"-"`
- WebSearchProviderID string `json:"-"` // Resolved from agent config or tenant default
- WebFetchEnabled bool `json:"-"` // Auto-fetch full page content for web search results after rerank
- WebFetchTopN int `json:"-"` // Max pages to fetch (default 3)
- Language string `json:"-"`
+ TenantID uint64 `json:"-"`
+ WebSearchEnabled bool `json:"-"`
+ WebSearchProviderID string `json:"-"` // Resolved from agent config or tenant default
+ WebSearchMaxResults int `json:"-"` // Resolved from agent config or tenant default
+ WebFetchEnabled bool `json:"-"` // Auto-fetch full page content for web search results after rerank
+ WebFetchTopN int `json:"-"` // Max pages to fetch (default 3)
+ Language string `json:"-"`
}
// QueryIntent represents the classified intent of a user query.
@@@ -188,12 -186,12 +189,13 @@@ func (c *ChatManage) Clone() *ChatManag
Images: append([]string(nil), c.Images...),
VLMModelID: c.VLMModelID,
ChatModelSupportsVision: c.ChatModelSupportsVision,
+ Attachments: append(MessageAttachments(nil), c.Attachments...),
TenantID: c.TenantID,
WebSearchEnabled: c.WebSearchEnabled,
- WebSearchProviderID: c.WebSearchProviderID,
- WebFetchEnabled: c.WebFetchEnabled,
- WebFetchTopN: c.WebFetchTopN,
+ WebSearchProviderID: c.WebSearchProviderID,
+ WebSearchMaxResults: c.WebSearchMaxResults,
+ WebFetchEnabled: c.WebFetchEnabled,
+ WebFetchTopN: c.WebFetchTopN,
Language: c.Language,
},
PipelineState: PipelineState{