diff --git a/frontend/src/views/initialization/InitializationContent.vue b/frontend/src/views/initialization/InitializationContent.vue
index 9bd10e4e..e467543a 100644
--- a/frontend/src/views/initialization/InitializationContent.vue
+++ b/frontend/src/views/initialization/InitializationContent.vue
@@ -64,10 +64,16 @@
+ @keyup.enter="onModelNameChange('llm')"
+ :clearable="!modelStatus.llm.downloading" />
+
+
+ {{ modelStatus.llm.progress.toFixed(1) }}%
+
+
-
@@ -102,15 +102,6 @@
-
-
-
-
- 下载中
-
-
-
{{ modelStatus.llm.message }}
-
@@ -187,10 +178,16 @@
@blur="onModelNameChange('embedding')"
@input="onModelNameInput('embedding')"
@keyup.enter="onModelNameChange('embedding')"
- :disabled="hasFiles" />
+ :disabled="hasFiles"
+ :clearable="!modelStatus.embedding.downloading" />
+
+
+ {{ modelStatus.embedding.progress.toFixed(1) }}%
+
+
-
@@ -248,15 +239,6 @@
-
-
-
-
- 下载中 {{ modelStatus.embedding.progress.toFixed(1) }}%
-
-
-
{{ modelStatus.embedding.message }}
-
@@ -417,10 +399,16 @@
+ @keyup.enter="onModelNameChange('vlm')"
+ :clearable="!modelStatus.vlm.downloading" />
+
+
+ {{ modelStatus.vlm.progress.toFixed(1) }}%
+
+
-
@@ -454,16 +436,6 @@
-
-
-
-
-
- 下载中 {{ modelStatus.vlm.progress.toFixed(1) }}%
-
-
-
{{ modelStatus.vlm.message }}
-
@@ -1115,6 +1087,11 @@ const checkAllOllamaModels = async () => {
modelsToCheck.push(formData.embedding.modelName);
}
+ // 添加VLM模型检查
+ if (formData.multimodal.enabled && isVlmOllama.value && formData.multimodal.vlm.modelName) {
+ modelsToCheck.push(formData.multimodal.vlm.modelName);
+ }
+
if (modelsToCheck.length === 0) return;
try {
@@ -1130,6 +1107,12 @@ const checkAllOllamaModels = async () => {
modelStatus.embedding.checked = true;
modelStatus.embedding.available = result.models[formData.embedding.modelName] || false;
}
+
+ // 更新VLM模型状态
+ if (formData.multimodal.enabled && isVlmOllama.value && formData.multimodal.vlm.modelName) {
+ modelStatus.vlm.checked = true;
+ modelStatus.vlm.available = result.models[formData.multimodal.vlm.modelName] || false;
+ }
} catch (error) {
console.error('检查模型状态失败:', error);
}
@@ -1139,9 +1122,12 @@ const checkAllOllamaModels = async () => {
const downloadModel = async (type: 'llm' | 'embedding' | 'vlm', modelName: string) => {
// 防止重复点击
if (modelStatus[type].downloading) {
+ console.log(`模型 ${modelName} 正在下载中,忽略重复点击`);
return;
}
+ console.log(`开始下载模型: ${type} - ${modelName}`);
+
try {
// 立即更新状态,防止重复点击
modelStatus[type].downloading = true;
@@ -1337,10 +1323,10 @@ const onModelSourceChange = async (type: 'llm' | 'embedding') => {
const onModelNameChange = async (type: 'llm' | 'embedding' | 'vlm') => {
if (type === 'vlm') {
- // 总是重置VLM模型状态
+ // 总是重置VLM模型状态(但不清除下载状态)
modelStatus.vlm.checked = false;
modelStatus.vlm.available = false;
- modelStatus.vlm.downloading = false;
+ // 不清除 downloading 状态,避免中断正在进行的下载
if (formData.multimodal.enabled && isVlmOllama.value && formData.multimodal.vlm.modelName) {
if (ollamaStatus.available) {
@@ -1353,10 +1339,10 @@ const onModelNameChange = async (type: 'llm' | 'embedding' | 'vlm') => {
}
}
} else {
- // 总是重置模型状态
+ // 总是重置模型状态(但不清除下载状态)
modelStatus[type].checked = false;
modelStatus[type].available = false;
- modelStatus[type].downloading = false;
+ // 不清除 downloading 状态,避免中断正在进行的下载
if (formData[type].source === 'local' && formData[type].modelName) {
if (ollamaStatus.available) {
@@ -1377,15 +1363,17 @@ const onModelNameInput = (type: 'llm' | 'embedding' | 'vlm') => {
clearTimeout(inputDebounceTimers[type]);
}
- // 重置模型状态
+ // 重置模型状态(但不清除下载状态)
if (type === 'vlm') {
modelStatus.vlm.checked = false;
modelStatus.vlm.available = false;
modelStatus.vlm.message = '';
+ // 不清除 downloading 状态,避免中断正在进行的下载
} else {
modelStatus[type].checked = false;
modelStatus[type].available = false;
modelStatus[type].message = '';
+ // 不清除 downloading 状态,避免中断正在进行的下载
}
// 设置防抖延迟
@@ -1520,6 +1508,14 @@ const checkAllConfiguredModels = async () => {
await checkEmbeddingModelStatus();
}
}
+
+ // 检查VLM模型
+ if (formData.multimodal.enabled && formData.multimodal.vlm.modelName) {
+ if (isVlmOllama.value && ollamaStatus.available) {
+ await checkAllOllamaModels();
+ }
+ // VLM远程API校验可以在这里添加
+ }
};
const onDimensionInput = (event: any) => {
@@ -1673,6 +1669,17 @@ const onMultimodalChange = async () => {
if (formData.multimodal.vlm.interfaceType === 'ollama' && !formData.multimodal.vlm.baseUrl) {
formData.multimodal.vlm.baseUrl = 'http://localhost:11434/v1';
}
+
+ // 如果选择了Ollama接口,检查Ollama状态
+ if (formData.multimodal.vlm.interfaceType === 'ollama' && !ollamaStatus.checked) {
+ await checkOllama();
+ }
+ } else {
+ // 如果禁用多模态,重置VLM模型状态
+ modelStatus.vlm.checked = false;
+ modelStatus.vlm.available = false;
+ modelStatus.vlm.downloading = false;
+ modelStatus.vlm.message = '';
}
};
@@ -1769,8 +1776,26 @@ const checkRerankModelStatus = async () => {
};
// 添加一些基本的多模态函数(简化版)
-const onVlmInterfaceTypeChange = () => {
+const onVlmInterfaceTypeChange = async () => {
console.log('VLM interface type changed:', formData.multimodal.vlm.interfaceType);
+
+ // 重置VLM模型状态
+ modelStatus.vlm.checked = false;
+ modelStatus.vlm.available = false;
+ modelStatus.vlm.downloading = false;
+ modelStatus.vlm.message = '';
+
+ // 如果切换到Ollama接口,检查Ollama状态
+ if (formData.multimodal.vlm.interfaceType === 'ollama') {
+ if (!ollamaStatus.checked) {
+ await checkOllama();
+ }
+
+ // 如果已经有模型名称,立即检查模型状态
+ if (formData.multimodal.vlm.modelName && ollamaStatus.available) {
+ await checkAllOllamaModels();
+ }
+ }
};
const onVlmBaseUrlChange = async () => {
@@ -2160,31 +2185,43 @@ onMounted(async () => {
.model-status-icon {
flex-shrink: 0;
- width: 24px;
+ min-width: 24px;
display: flex;
align-items: center;
justify-content: center;
}
.model-status-icon .status-icon {
- font-size: 18px;
+ font-size: 16px;
cursor: help;
+ padding: 4px;
+ border-radius: 50%;
+ transition: all 0.2s ease;
}
.model-status-icon .status-icon.installed {
- color: #00a870;
+ color: #16a34a;
+ background: #f0fdf4;
+ border: 1px solid #bbf7d0;
}
.model-status-icon .status-icon.not-installed {
- color: #e34d59;
+ color: #dc2626;
+ background: #fef2f2;
+ border: 1px solid #fecaca;
}
.model-status-icon .status-icon.unknown {
- color: #d54941;
+ color: #d97706;
+ background: #fffbeb;
+ border: 1px solid #fed7aa;
}
.model-status-icon .status-icon.downloading {
- color: #0052d9;
+ color: #16a34a;
+ background: #f0fdf4;
+ border: 1px solid #bbf7d0;
+ animation: pulse 2s infinite;
}
.download-action {
@@ -2192,23 +2229,25 @@ onMounted(async () => {
}
.download-action .download-btn {
- height: 28px;
- width: 28px;
- min-width: 28px;
+ height: 24px;
+ width: 24px;
+ min-width: 24px;
padding: 0;
- border-radius: 50%;
+ border-radius: 4px;
display: flex;
align-items: center;
justify-content: center;
- background: linear-gradient(135deg, #07c05f, #00a651);
- border: none;
+ background: #16a34a;
+ border: 1px solid #15803d;
color: white;
transition: all 0.2s ease;
- box-shadow: 0 2px 8px rgba(7, 192, 95, 0.2);
+ box-shadow: 0 1px 3px rgba(22, 163, 74, 0.2);
&:hover:not(:disabled) {
- background: linear-gradient(135deg, #00a651, #008f47);
- box-shadow: 0 4px 12px rgba(7, 192, 95, 0.3);
+ background: #15803d;
+ border-color: #166534;
+ box-shadow: 0 2px 6px rgba(22, 163, 74, 0.3);
+ transform: translateY(-1px);
}
&:disabled {
@@ -2223,56 +2262,21 @@ onMounted(async () => {
}
}
- .download-progress {
- margin-top: 12px;
- padding: 12px 16px;
- background: linear-gradient(135deg, #f0fdf4, #f8fafc);
- border-radius: 8px;
- border: 1px solid #dcfce7;
- box-shadow: 0 1px 4px rgba(7, 192, 95, 0.08);
+ .model-download-status {
+ display: inline-flex;
+ align-items: center;
+ gap: 6px;
- .progress-info {
- display: flex;
- align-items: center;
- gap: 8px;
- margin-bottom: 8px;
-
- .loading-icon {
- color: #07c05f;
- font-size: 14px;
- animation: spin 1s linear infinite;
- }
-
- .progress-text {
- font-size: 14px;
- color: #166534;
- font-weight: 600;
- }
+ .download-progress-circle {
+ flex-shrink: 0;
}
- .progress-bar {
- margin-bottom: 8px;
-
- :deep(.t-progress__bar) {
- background: linear-gradient(90deg, #07c05f, #00a651);
- border-radius: 4px;
- height: 6px;
- box-shadow: 0 1px 2px rgba(7, 192, 95, 0.2);
- }
-
- :deep(.t-progress__track) {
- background-color: #e5e7eb;
- border-radius: 4px;
- height: 6px;
- }
- }
-
- .progress-message {
- font-size: 12px;
- color: #6b7280;
- text-align: center;
- line-height: 1.2;
- font-style: italic;
+ .download-percentage {
+ font-size: 11px;
+ font-weight: 600;
+ color: #15803d;
+ font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
+ white-space: nowrap;
}
}
@@ -2774,6 +2778,17 @@ onMounted(async () => {
}
}
+ @keyframes pulse {
+ 0%, 100% {
+ opacity: 1;
+ transform: scale(1);
+ }
+ 50% {
+ opacity: 0.8;
+ transform: scale(1.05);
+ }
+ }
+
// 表单样式优化
:deep(.t-form-item__label) {
font-weight: 500;