Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

♻️ refactor: improve release at #5212

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/libs/agent-runtime/openai/__snapshots__/index.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ exports[`LobeOpenAI > models > should get models 1`] = `
"input": 0.5,
"output": 1.5,
},
"releasedAt": "2023-03-01",
},
{
"id": "gpt-3.5-turbo-16k",
Expand All @@ -35,6 +36,7 @@ exports[`LobeOpenAI > models > should get models 1`] = `
"input": 10,
"output": 30,
},
"releasedAt": "2024-01-24",
},
{
"contextWindowTokens": 128000,
Expand All @@ -46,6 +48,7 @@ exports[`LobeOpenAI > models > should get models 1`] = `
"input": 10,
"output": 30,
},
"releasedAt": "2024-01-24",
},
{
"contextWindowTokens": 4096,
Expand All @@ -56,6 +59,7 @@ exports[`LobeOpenAI > models > should get models 1`] = `
"input": 1.5,
"output": 2,
},
"releasedAt": "2023-08-25",
},
{
"id": "gpt-3.5-turbo-0301",
Expand All @@ -73,6 +77,7 @@ exports[`LobeOpenAI > models > should get models 1`] = `
"input": 1,
"output": 2,
},
"releasedAt": "2023-11-03",
},
{
"contextWindowTokens": 128000,
Expand All @@ -84,13 +89,15 @@ exports[`LobeOpenAI > models > should get models 1`] = `
"input": 10,
"output": 30,
},
"releasedAt": "2023-11-03",
},
{
"contextWindowTokens": 128000,
"deploymentName": "gpt-4-vision",
"description": "GPT-4 视觉预览版,专为图像分析和处理任务设计。",
"displayName": "GPT 4 Turbo with Vision Preview",
"id": "gpt-4-vision-preview",
"releasedAt": "2023-11-02",
"vision": true,
},
{
Expand All @@ -103,6 +110,7 @@ exports[`LobeOpenAI > models > should get models 1`] = `
"input": 30,
"output": 60,
},
"releasedAt": "2023-06-28",
},
{
"contextWindowTokens": 16385,
Expand All @@ -114,6 +122,7 @@ exports[`LobeOpenAI > models > should get models 1`] = `
"input": 0.5,
"output": 1.5,
},
"releasedAt": "2024-01-24",
},
{
"contextWindowTokens": 8192,
Expand All @@ -125,6 +134,7 @@ exports[`LobeOpenAI > models > should get models 1`] = `
"input": 30,
"output": 60,
},
"releasedAt": "2023-06-13",
},
]
`;
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import dayjs from 'dayjs';
import OpenAI, { ClientOptions } from 'openai';
import { Stream } from 'openai/streaming';

Expand Down Expand Up @@ -267,7 +268,11 @@ export const LobeOpenAICompatibleFactory = <T extends Record<string, any> = any>

const knownModel = LOBE_DEFAULT_MODEL_LIST.find((model) => model.id === item.id);

if (knownModel) return knownModel;
if (knownModel)
return {
...knownModel,
releasedAt: knownModel.releasedAt ?? dayjs(item.created * 1000).format('YYYY-MM-DD'),
};

return { id: item.id };
})
Expand Down
Loading