mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 05:12:39 +00:00
feat: model config required check;feat: dataset text model default setting (#3866)
* feat: model config required check * feat: dataset text model default setting * perf: collection list count * fix: ts * remove index count
This commit is contained in:
@@ -52,6 +52,12 @@ export const loadSystemModels = async (init = false) => {
|
||||
if (model.isDefault) {
|
||||
global.systemDefaultModel.llm = model;
|
||||
}
|
||||
if (model.isDefaultDatasetTextModel) {
|
||||
global.systemDefaultModel.datasetTextLLM = model;
|
||||
}
|
||||
if (model.isDefaultDatasetImageModel) {
|
||||
global.systemDefaultModel.datasetImageLLM = model;
|
||||
}
|
||||
} else if (model.type === ModelTypeEnum.embedding) {
|
||||
global.embeddingModelMap.set(model.model, model);
|
||||
global.embeddingModelMap.set(model.name, model);
|
||||
@@ -134,6 +140,16 @@ export const loadSystemModels = async (init = false) => {
|
||||
if (!global.systemDefaultModel.llm) {
|
||||
global.systemDefaultModel.llm = Array.from(global.llmModelMap.values())[0];
|
||||
}
|
||||
if (!global.systemDefaultModel.datasetTextLLM) {
|
||||
global.systemDefaultModel.datasetTextLLM = Array.from(global.llmModelMap.values()).find(
|
||||
(item) => item.datasetProcess
|
||||
);
|
||||
}
|
||||
if (!global.systemDefaultModel.datasetImageLLM) {
|
||||
global.systemDefaultModel.datasetImageLLM = Array.from(global.llmModelMap.values()).find(
|
||||
(item) => item.vision
|
||||
);
|
||||
}
|
||||
if (!global.systemDefaultModel.embedding) {
|
||||
global.systemDefaultModel.embedding = Array.from(global.embeddingModelMap.values())[0];
|
||||
}
|
||||
|
3
packages/service/core/ai/type.d.ts
vendored
3
packages/service/core/ai/type.d.ts
vendored
@@ -22,6 +22,9 @@ export type SystemModelItemType =
|
||||
|
||||
export type SystemDefaultModelType = {
|
||||
[ModelTypeEnum.llm]?: LLMModelItemType;
|
||||
datasetTextLLM?: LLMModelItemType;
|
||||
datasetImageLLM?: LLMModelItemType;
|
||||
|
||||
[ModelTypeEnum.embedding]?: EmbeddingModelItemType;
|
||||
[ModelTypeEnum.tts]?: TTSModelType;
|
||||
[ModelTypeEnum.stt]?: STTModelType;
|
||||
|
Reference in New Issue
Block a user