Skip to content

Commit

Permalink
✨ feat: 支持 openai o1
Browse files Browse the repository at this point in the history
  • Loading branch information
rdmclin2 committed Sep 22, 2024
1 parent c83f881 commit 7d16ade
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 135 deletions.
90 changes: 45 additions & 45 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,105 +64,105 @@
]
},
"dependencies": {
"@ant-design/icons": "^5.3.7",
"@aws-sdk/client-s3": "^3.600.0",
"@aws-sdk/s3-request-presigner": "^3.600.0",
"@gltf-transform/core": "^4.0.2",
"@icons-pack/react-simple-icons": "^9.6.0",
"@lobehub/i18n-cli": "^1.18.1",
"@lobehub/icons": "^1.24.0",
"@lobehub/tts": "^1.24.2",
"@lobehub/ui": "^1.146.8",
"@ant-design/icons": "^5.5.1",
"@aws-sdk/client-s3": "^3.654.0",
"@aws-sdk/s3-request-presigner": "^3.654.0",
"@gltf-transform/core": "^4.0.8",
"@icons-pack/react-simple-icons": "^9.7.0",
"@lobehub/i18n-cli": "^1.20.0",
"@lobehub/icons": "^1.34.0",
"@lobehub/tts": "^1.25.1",
"@lobehub/ui": "^1.151.0",
"@pixiv/three-vrm": "2.1.2",
"@pixiv/three-vrm-core": "2.1.2",
"@react-spring/web": "^9.7.3",
"@react-spring/web": "^9.7.4",
"@trpc/client": "next",
"@trpc/next": "next",
"@trpc/server": "next",
"@types/react-speech-recognition": "^3.9.5",
"@vercel/analytics": "^1.3.1",
"ahooks": "^3.8.0",
"ahooks": "^3.8.1",
"ai": "^2.2.37",
"antd": "~5.18.3",
"antd-style": "^3.6.2",
"axios": "^1.7.2",
"antd-style": "^3.6.3",
"axios": "^1.7.7",
"buffer": "^6.0.3",
"classnames": "^2.5.1",
"dayjs": "^1.11.11",
"dayjs": "^1.11.13",
"fast-deep-equal": "^3.1.3",
"i18next": "^23.11.5",
"i18next": "^23.15.1",
"i18next-browser-languagedetector": "^7.2.1",
"i18next-resources-to-backend": "^1.2.1",
"immer": "^10.1.1",
"js-tiktoken": "^1.0.12",
"js-tiktoken": "^1.0.14",
"localforage": "^1.10.0",
"lodash-es": "^4.17.21",
"lucide-react": "^0.395.0",
"mime": "^4.0.3",
"mime": "^4.0.4",
"mmd-parser": "^1.0.4",
"modern-screenshot": "^4.4.39",
"nanoid": "^5.0.7",
"next": "^14.2.4",
"next": "^14.2.13",
"next-pwa": "^5.6.0",
"numeral": "^2.0.6",
"openai": "^4.52.1",
"pino": "^9.2.0",
"openai": "^4.63.0",
"pino": "^9.4.0",
"polished": "^4.3.1",
"query-string": "^9.0.0",
"query-string": "^9.1.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-i18next": "14.0.2",
"react-intersection-observer": "^9.10.3",
"react-intersection-observer": "^9.13.1",
"react-layout-kit": "^1.9.0",
"react-lazy-load": "^4.0.1",
"react-virtuoso": "^4.7.11",
"react-virtuoso": "^4.10.4",
"remark": "^15.0.1",
"remark-gfm": "^3.0.1",
"remark-html": "^16.0.1",
"resolve-accept-language": "^3.1.4",
"resolve-accept-language": "^3.1.7",
"superjson": "^2.2.1",
"swr": "^2.2.5",
"three": "0.164.1",
"ua-parser-js": "^1.0.38",
"ua-parser-js": "^1.0.39",
"url-join": "^5.0.0",
"utility-types": "^3.11.0",
"uuid": "^10.0.0",
"ws": "^8.17.1",
"ws": "^8.18.0",
"zod": "^3.23.8",
"zustand": "^4.5.4"
"zustand": "^4.5.5"
},
"devDependencies": {
"@commitlint/cli": "^19.3.0",
"@ducanh2912/next-pwa": "^10.2.7",
"@lobehub/lint": "^1.23.4",
"@next/bundle-analyzer": "^14.2.4",
"@next/eslint-plugin-next": "^14.2.4",
"@commitlint/cli": "^19.5.0",
"@ducanh2912/next-pwa": "^10.2.9",
"@lobehub/lint": "^1.24.4",
"@next/bundle-analyzer": "^14.2.13",
"@next/eslint-plugin-next": "^14.2.13",
"@peculiar/webcrypto": "^1.5.0",
"@testing-library/jest-dom": "^6.4.6",
"@testing-library/react": "^16.0.0",
"@testing-library/jest-dom": "^6.5.0",
"@testing-library/react": "^16.0.1",
"@types/lodash-es": "^4.17.12",
"@types/node": "20.14.2",
"@types/numeral": "^2.0.5",
"@types/react": "^18.3.3",
"@types/react": "^18.3.8",
"@types/react-dom": "^18.3.0",
"@types/three": "^0.165.0",
"@types/ua-parser-js": "^0.7.39",
"@types/uuid": "^10.0.0",
"commitlint": "^19.3.0",
"commitlint": "^19.5.0",
"consola": "^3.2.3",
"dpdm": "^3.14.0",
"eslint": "^8.57.0",
"glob": "^10.4.2",
"husky": "^9.0.11",
"jsdom": "^24.1.0",
"eslint": "^8.57.1",
"glob": "^10.4.5",
"husky": "^9.1.6",
"jsdom": "^24.1.3",
"just-diff": "^6.0.2",
"lint-staged": "^15.2.5",
"prettier": "^3.2.5",
"lint-staged": "^15.2.10",
"prettier": "^3.3.3",
"semantic-release": "^21.1.2",
"stylelint": "^15.11.0",
"tsx": "^4.15.7",
"typescript": "^5.5.2",
"vite": "^5.3.1",
"tsx": "^4.19.1",
"typescript": "^5.6.2",
"vite": "^5.4.7",
"vitest": "~1.6.0",
"vitest-canvas-mock": "^0.3.3"
},
Expand Down
1 change: 1 addition & 0 deletions src/components/ModelIcon/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const ModelIcon = memo<ModelProviderIconProps>(({ model: originModel, size = 12
// currently supported models, maybe not in its own provider
if (model.includes('gpt-3')) return <OpenAI.Avatar size={size} type={'gpt3'} />;
if (model.includes('gpt-4')) return <OpenAI.Avatar size={size} type={'gpt4'} />;
if (model.includes('o1')) return <OpenAI.Avatar size={size} type={'o1'} />;
if (model.startsWith('glm') || model.includes('chatglm')) return <ChatGLM.Avatar size={size} />;
if (model.includes('deepseek')) return <DeepSeek.Avatar size={size} />;
if (model.includes('claude')) return <Claude.Avatar size={size} />;
Expand Down
113 changes: 23 additions & 90 deletions src/constants/openai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,23 @@ export const OPENAI_END_POINT = 'x-openai-endpoint';
* OpenAI 模型列表
*/
export const OPENAI_MODEL_LIST: ChatModelCard[] = [
{
description: 'Currently points to o1-mini-2024-09-12',
displayName: 'OpenAI o1-mini',
enabled: true,
id: 'o1-mini',
maxOutput: 65_536,
tokens: 128_000,
},
{
description: 'Currently points to o1-preview-2024-09-12',
displayName: 'OpenAI o1-preview',
enabled: true,
id: 'o1-preview',
maxOutput: 32_768,
tokens: 128_000,
},

{
description: 'Currently points to gpt-4o-mini-2024-07-18',
displayName: 'GPT-4o mini',
Expand All @@ -17,126 +34,42 @@ export const OPENAI_MODEL_LIST: ChatModelCard[] = [
tokens: 128_000,
vision: true,
},

{
description: 'Currently points to gpt-4o-2024-05-13',
displayName: 'GPT-4o',
enabled: true,
functionCall: true,
maxOutput: 4096,
id: 'gpt-4o',
tokens: 128_000,
vision: true,
},
{
description: 'GPT-4 Turbo with Vision',
displayName: 'GPT-4 Turbo',
enabled: true,
functionCall: true,
id: 'gpt-4-turbo',
tokens: 128_000,
vision: true,
},
{
description: 'GPT-4 Turbo 视觉版 (240409)',
displayName: 'GPT-4 Turbo Vision (240409)',
functionCall: true,
id: 'gpt-4-turbo-2024-04-09',
maxOutput: 4096,
tokens: 128_000,
vision: true,
},
{
description: 'Currently points to gpt-4-0125-preview',
displayName: 'GPT-4 Turbo Preview',
functionCall: true,
id: 'gpt-4-turbo-preview',
tokens: 128_000,
},
{
displayName: 'GPT-4 Turbo Preview (0125)',
functionCall: true,
id: 'gpt-4-0125-preview',
tokens: 128_000,
},
{
description: 'Currently points to gpt-4-1106-vision-preview', // Will be discontinued on December 6, 2024
displayName: 'GPT-4 Turbo Vision Preview',
id: 'gpt-4-vision-preview',
tokens: 128_000,
vision: true,
},
{
displayName: 'GPT-4 Turbo Vision Preview (1106)', // Will be discontinued on December 6, 2024
id: 'gpt-4-1106-vision-preview',
tokens: 128_000,
vision: true,
},
{
displayName: 'GPT-4 Turbo Preview (1106)',
functionCall: true,
id: 'gpt-4-1106-preview',
tokens: 128_000,
},

{
description: 'Currently points to gpt-4-0613',
displayName: 'GPT-4',
functionCall: true,
id: 'gpt-4',
maxOutput: 8192,
tokens: 8192,
},
{
displayName: 'GPT-4 (0613)',
functionCall: true,
id: 'gpt-4-0613',
tokens: 8192,
},
{
description: 'Currently points to gpt-4-32k-0613', // Will be discontinued on June 6, 2025
displayName: 'GPT-4 32K',
functionCall: true,
id: 'gpt-4-32k',
tokens: 32_768,
},
{
displayName: 'GPT-4 32K (0613)', // Will be discontinued on June 6, 2025
functionCall: true,
id: 'gpt-4-32k-0613',
tokens: 32_768,
},
{
description:
'GPT 3.5 Turbo,适用于各种文本生成和理解任务,Currently points to gpt-3.5-turbo-0125',
displayName: 'GPT-3.5 Turbo',
functionCall: true,
maxOutput: 4096,
id: 'gpt-3.5-turbo',
tokens: 16_385,
},
{
displayName: 'GPT-3.5 Turbo (0125)',
functionCall: true,
id: 'gpt-3.5-turbo-0125',
tokens: 16_385,
},
{
displayName: 'GPT-3.5 Turbo (1106)',
functionCall: true,
id: 'gpt-3.5-turbo-1106',
tokens: 16_385,
},
{
displayName: 'GPT-3.5 Turbo Instruct',
id: 'gpt-3.5-turbo-instruct',
tokens: 4096,
},
{
description: 'Currently points to gpt-3.5-turbo-16k-0613', // Will be discontinued on September 13, 2024
displayName: 'GPT-3.5 Turbo 16K',
id: 'gpt-3.5-turbo-16k',
legacy: true,
tokens: 16_385,
},
{
displayName: 'GPT-3.5 Turbo (0613)', // Will be discontinued on September 13, 2024
id: 'gpt-3.5-turbo-0613',
legacy: true,
tokens: 4096,
},
];

0 comments on commit 7d16ade

Please sign in to comment.