Skip to content

Commit

Permalink
💄 style: improve detail design
Browse files Browse the repository at this point in the history
  • Loading branch information
arvinxx committed Apr 10, 2024
1 parent 4a305e9 commit adcce07
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 37 deletions.
1 change: 0 additions & 1 deletion src/app/settings/llm/TogetherAI/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ const TogetherAIProvider = memo(() => {
return (
<ProviderConfig
checkModel={'togethercomputer/alpaca-7b'}
modelList={{ showModelFetcher: true }}
provider={'togetherai'}
title={
<Together.Combine
Expand Down
36 changes: 0 additions & 36 deletions src/libs/agent-runtime/openai/__snapshots__/index.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@

exports[`LobeOpenAI > models > should get models 1`] = `
[
{
"id": "whisper-1",
},
{
"id": "davinci-002",
},
{
"description": "GPT 3.5 Turbo,适用于各种文本生成和理解任务",
"displayName": "GPT-3.5 Turbo",
Expand All @@ -16,29 +10,17 @@ exports[`LobeOpenAI > models > should get models 1`] = `
"id": "gpt-3.5-turbo",
"tokens": 16385,
},
{
"id": "dall-e-2",
},
{
"displayName": "GPT-3.5 Turbo 16K",
"id": "gpt-3.5-turbo-16k",
"tokens": 16385,
},
{
"id": "tts-1-hd-1106",
},
{
"id": "tts-1-hd",
},
{
"displayName": "GPT-3.5 Turbo 16K (0613)",
"id": "gpt-3.5-turbo-16k-0613",
"legacy": true,
"tokens": 4096,
},
{
"id": "text-embedding-3-large",
},
{
"displayName": "GPT-4 Turbo Vision Preview (1106)",
"id": "gpt-4-1106-vision-preview",
Expand Down Expand Up @@ -75,12 +57,6 @@ exports[`LobeOpenAI > models > should get models 1`] = `
"legacy": true,
"tokens": 4096,
},
{
"id": "tts-1",
},
{
"id": "dall-e-3",
},
{
"displayName": "GPT-3.5 Turbo (1106)",
"functionCall": true,
Expand All @@ -93,12 +69,6 @@ exports[`LobeOpenAI > models > should get models 1`] = `
"id": "gpt-4-1106-preview",
"tokens": 128000,
},
{
"id": "babbage-002",
},
{
"id": "tts-1-1106",
},
{
"description": "GPT-4 视觉预览版,支持视觉任务",
"displayName": "GPT-4 Turbo Vision Preview",
Expand All @@ -107,18 +77,12 @@ exports[`LobeOpenAI > models > should get models 1`] = `
"tokens": 128000,
"vision": true,
},
{
"id": "text-embedding-3-small",
},
{
"displayName": "GPT-4",
"functionCall": true,
"id": "gpt-4",
"tokens": 8192,
},
{
"id": "text-embedding-ada-002",
},
{
"displayName": "GPT-3.5 Turbo (0125)",
"functionCall": true,
Expand Down
19 changes: 19 additions & 0 deletions src/libs/agent-runtime/utils/openaiCompatibleFactory/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,19 @@ import { debugStream } from '../debugStream';
import { desensitizeUrl } from '../desensitizeUrl';
import { handleOpenAIError } from '../handleOpenAIError';

// the model contains the following keywords is not a chat model, so we should filter them out
const CHAT_MODELS_BLOCK_LIST = [
'embedding',
'davinci',
'cuire',
'moderation',
'ada',
'babbage',
'tts',
'whisper',
'dall-e',
];

interface OpenAICompatibleFactoryOptions {
baseURL?: string;
chatCompletion?: {
Expand Down Expand Up @@ -112,6 +125,11 @@ export const LobeOpenAICompatibleFactory = ({
const list = await this.client.models.list();

return list.data
.filter((model) => {
return CHAT_MODELS_BLOCK_LIST.every(
(keyword) => !model.id.toLowerCase().includes(keyword),
);
})
.map((item) => {
if (models?.transformModel) {
return models.transformModel(item);
Expand All @@ -123,6 +141,7 @@ export const LobeOpenAICompatibleFactory = ({

return { id: item.id };
})

.filter(Boolean) as ChatModelCard[];
}
};

0 comments on commit adcce07

Please sign in to comment.