feat: implement image upload and multimodal support
- Added functionality for image uploads in chat, allowing users to attach images for multimodal Q&A. - Enhanced the input field to handle image selection via drag-and-drop and paste, with validation for file types and sizes. - Updated the backend to process images alongside text queries, including support for image analysis. - Introduced new UI components for image previews and management, improving user interaction with uploaded content. - Added localization strings for image upload features and error messages, enhancing accessibility for users in multiple languages. These changes significantly improve the chat experience by enabling users to incorporate images into their queries, facilitating richer interactions and responses.
This commit is contained in:
@@ -35,6 +35,11 @@ export interface CustomAgentConfig {
|
||||
// false: 根据 kb_selection_mode 自动检索知识库
|
||||
retrieve_kb_only_when_mentioned?: boolean;
|
||||
|
||||
// ===== 图片上传/多模态设置 =====
|
||||
image_upload_enabled?: boolean; // 是否启用图片上传(默认: false)
|
||||
vlm_model_id?: string; // VLM模型ID(图片分析用)
|
||||
image_storage_provider?: string; // 图片存储提供商
|
||||
|
||||
// ===== 文件类型限制 =====
|
||||
// 支持的文件类型(如 ["csv", "xlsx", "xls"])
|
||||
// 为空表示支持所有文件类型
|
||||
|
||||
@@ -29,7 +29,7 @@ export function useStream() {
|
||||
let renderTimer: number | null = null
|
||||
|
||||
// 启动流式请求
|
||||
const startStream = async (params: { session_id: any; query: any; knowledge_base_ids?: string[]; knowledge_ids?: string[]; agent_enabled?: boolean; agent_id?: string; web_search_enabled?: boolean; enable_memory?: boolean; summary_model_id?: string; mcp_service_ids?: string[]; mentioned_items?: Array<{id: string; name: string; type: string; kb_type?: string}>; method: string; url: string }) => {
|
||||
const startStream = async (params: { session_id: any; query: any; knowledge_base_ids?: string[]; knowledge_ids?: string[]; agent_enabled?: boolean; agent_id?: string; web_search_enabled?: boolean; enable_memory?: boolean; summary_model_id?: string; mcp_service_ids?: string[]; mentioned_items?: Array<{id: string; name: string; type: string; kb_type?: string}>; images?: Array<{data: string}>; method: string; url: string }) => {
|
||||
// 重置状态
|
||||
output.value = '';
|
||||
error.value = null;
|
||||
@@ -114,6 +114,10 @@ export function useStream() {
|
||||
if (params.mentioned_items !== undefined && params.mentioned_items.length > 0) {
|
||||
postBody.mentioned_items = params.mentioned_items;
|
||||
}
|
||||
// Include images if provided (base64 data URIs for multimodal chat)
|
||||
if (params.images !== undefined && params.images.length > 0) {
|
||||
postBody.images = params.images;
|
||||
}
|
||||
|
||||
await fetchEventSource(url, {
|
||||
method: params.method,
|
||||
|
||||
@@ -22,6 +22,7 @@ export interface ModelConfig {
|
||||
interface_type?: 'ollama' | 'openai'; // VLLM专用
|
||||
parameter_size?: string; // Ollama模型参数大小 (e.g., "7B", "13B", "70B")
|
||||
extra_config?: Record<string, string>; // Provider-specific configuration
|
||||
supports_vision?: boolean; // Whether the model accepts image/multimodal input
|
||||
};
|
||||
is_default?: boolean;
|
||||
is_builtin?: boolean;
|
||||
|
||||
Reference in New Issue
Block a user