mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 13:03:50 +00:00

* split tokens into input and output (#3477) * split tokens into input and output * query extension & tool call & question guide * fix * perf: input and output tokens * perf: tool call if else * perf: remove code * fix: extract usage count * fix: qa usage count --------- Co-authored-by: heheer <heheer@sealos.io>
52 lines
1.3 KiB
TypeScript
52 lines
1.3 KiB
TypeScript
export const getLLMModel = (model?: string) => {
|
|
return (
|
|
global.llmModels.find((item) => item.model === model || item.name === model) ??
|
|
global.llmModels[0]
|
|
);
|
|
};
|
|
|
|
export const getDatasetModel = (model?: string) => {
|
|
return (
|
|
global.llmModels
|
|
?.filter((item) => item.datasetProcess)
|
|
?.find((item) => item.model === model || item.name === model) ?? global.llmModels[0]
|
|
);
|
|
};
|
|
|
|
export const getVectorModel = (model?: string) => {
|
|
return (
|
|
global.vectorModels.find((item) => item.model === model || item.name === model) ||
|
|
global.vectorModels[0]
|
|
);
|
|
};
|
|
|
|
export function getAudioSpeechModel(model?: string) {
|
|
return (
|
|
global.audioSpeechModels.find((item) => item.model === model || item.name === model) ||
|
|
global.audioSpeechModels[0]
|
|
);
|
|
}
|
|
|
|
export function getWhisperModel(model?: string) {
|
|
return global.whisperModel;
|
|
}
|
|
|
|
export function getReRankModel(model?: string) {
|
|
return global.reRankModels.find((item) => item.model === model);
|
|
}
|
|
|
|
export enum ModelTypeEnum {
|
|
llm = 'llm',
|
|
vector = 'vector',
|
|
audioSpeech = 'audioSpeech',
|
|
whisper = 'whisper',
|
|
rerank = 'rerank'
|
|
}
|
|
export const getModelMap = {
|
|
[ModelTypeEnum.llm]: getLLMModel,
|
|
[ModelTypeEnum.vector]: getVectorModel,
|
|
[ModelTypeEnum.audioSpeech]: getAudioSpeechModel,
|
|
[ModelTypeEnum.whisper]: getWhisperModel,
|
|
[ModelTypeEnum.rerank]: getReRankModel
|
|
};
|