perf: model provider show; perf: get init data buffer (#3459)

* pr code

* perf: model table show

* perf: model provider show

* perf: get init data buffer

* perf: get init data buffer

* perf: icon
This commit is contained in:
Archer
2024-12-24 15:12:07 +08:00
committed by GitHub
parent f646ef8595
commit 108e1b92ef
59 changed files with 558 additions and 329 deletions

View File

@@ -57,13 +57,15 @@ export type ReRankModelItemType = {
};
export type AudioSpeechModelType = {
provider: ModelProviderIdType;
model: string;
name: string;
charsPointsPrice: number;
voices: { label: string; value: string; bufferId: string }[];
};
export type WhisperModelType = {
export type STTModelType = {
provider: ModelProviderIdType;
model: string;
name: string;
charsPointsPrice: number; // 60s = n points

View File

@@ -1,4 +1,5 @@
import type { LLMModelItemType, VectorModelItemType } from './model.d';
import { i18nT } from '../../../web/i18n/utils';
import type { LLMModelItemType, STTModelType, VectorModelItemType } from './model.d';
import { getModelProvider, ModelProviderIdType } from './provider';
export const defaultQAModels: LLMModelItemType[] = [
@@ -35,6 +36,13 @@ export const defaultVectorModels: VectorModelItemType[] = [
}
];
export const defaultWhisperModel: STTModelType = {
provider: 'OpenAI',
model: 'whisper-1',
name: 'whisper-1',
charsPointsPrice: 0
};
export const getModelFromList = (
modelList: { provider: ModelProviderIdType; name: string; model: string }[],
model: string
@@ -46,3 +54,16 @@ export const getModelFromList = (
avatar: provider.avatar
};
};
export enum ModelTypeEnum {
chat = 'chat',
embedding = 'embedding',
tts = 'tts',
stt = 'stt'
}
export const modelTypeList = [
{ label: i18nT('common:model.type.chat'), value: ModelTypeEnum.chat },
{ label: i18nT('common:model.type.embedding'), value: ModelTypeEnum.embedding },
{ label: i18nT('common:model.type.tts'), value: ModelTypeEnum.tts },
{ label: i18nT('common:model.type.stt'), value: ModelTypeEnum.stt }
];

View File

@@ -5,6 +5,7 @@ export type ModelProviderIdType =
| 'Claude'
| 'Gemini'
| 'MistralAI'
| 'Groq'
| 'Qwen'
| 'Doubao'
| 'ChatGLM'
@@ -44,7 +45,12 @@ export const ModelProviderList: ModelProviderType[] = [
{
id: 'MistralAI',
name: 'MistralAI',
avatar: 'model/huggingface'
avatar: 'model/mistral'
},
{
id: 'Groq',
name: 'Groq',
avatar: 'model/groq'
},
{
id: 'Qwen',
@@ -113,7 +119,7 @@ export const ModelProviderList: ModelProviderType[] = [
}
];
export const ModelProviderMap = Object.fromEntries(
ModelProviderList.map((item) => [item.id, item])
ModelProviderList.map((item, index) => [item.id, { ...item, order: index }])
);
export const getModelProvider = (provider: ModelProviderIdType) => {