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:
wizardchen
2026-03-11 17:17:32 +08:00
parent 8de1cfb6b5
commit 991bd29a14
42 changed files with 1554 additions and 226 deletions
+14 -2
View File
@@ -230,6 +230,15 @@
</p>
</div>
<!-- Chat/VLLM: supports vision toggle -->
<div v-if="modelType === 'chat' || modelType === 'vllm'" class="form-item">
<label class="form-label">{{ $t('model.editor.supportsVisionLabel') }}</label>
<div style="display: flex; align-items: center; gap: 8px;">
<t-switch v-model="formData.supportsVision" />
<span class="form-desc">{{ $t('model.editor.supportsVisionDesc') }}</span>
</div>
</div>
</t-form>
</div>
@@ -266,6 +275,7 @@ interface ModelFormData {
dimension?: number
interfaceType?: 'ollama' | 'openai'
isDefault: boolean
supportsVision?: boolean
}
interface Props {
@@ -455,7 +465,8 @@ const formData = ref<ModelFormData>({
apiKey: '',
dimension: undefined,
interfaceType: 'ollama',
isDefault: false
isDefault: false,
supportsVision: false
})
const rules = computed(() => ({
@@ -597,7 +608,8 @@ const resetForm = () => {
apiKey: '',
dimension: undefined, // 默认不填,让用户手动输入或通过检测按钮获取
interfaceType: undefined,
isDefault: false
isDefault: false,
supportsVision: false
}
modelChecked.value = false
modelAvailable.value = false