feat(knowledgeBase): enhance dataset creation with progress tracking and model defaults

- Add Progress component import to display file upload progress in real-time
- Implement progress bar rendering for files with 0-1 progress values (processing state)
- Refactor progress column logic to handle three states: completed (1), processing (0-1), and pending (0)
- Add automatic default model selection for each type when creating new knowledge base
- Improve file removal handling with better error messages and conditional server deletion
- Add console logging for upload cancellation and file deletion operations
- Remove loading state from primary button to prevent UI conflicts
- Comment out Spin wrapper on step 2 to allow better progress visibility
- Update Chinese translation for total_running_apps label for clarity
- Enhance error handling with i18n support for deletion failures
This commit is contained in:
yujiangping
2026-01-22 16:39:27 +08:00
parent 2b017139ef
commit acecdcc041
3 changed files with 62 additions and 16 deletions

View File

@@ -164,6 +164,26 @@ const CreateModal = forwardRef<CreateModalRef, CreateModalRefProps>(({
});
setModelOptionsByType(next);
// 如果不是编辑模式,为每个类型的下拉框设置默认值为第一条数据
if (!datasets?.id) {
const defaultValues: Record<string, string> = {};
types.forEach((tp) => {
const fieldKey = typeToFieldKey(tp);
const options = tp.toLowerCase() === 'llm'
? [...(next['llm'] || []), ...(next['chat'] || [])]
: next[tp] || [];
// 如果有选项且当前字段没有值,设置第一个选项为默认值
if (options.length > 0 && !form.getFieldValue(fieldKey)) {
defaultValues[fieldKey] = options[0].value;
}
});
if (Object.keys(defaultValues).length > 0) {
form.setFieldsValue(defaultValues as Partial<KnowledgeBaseFormData>);
}
}
};
const setBaseFields = (record: KnowledgeBaseListItem | null, type?: string) => {