Skip to content

Commit 2293727

Browse files
committed
feat: add gpt4 turbo and 4o
1 parent d322127 commit 2293727

2 files changed

Lines changed: 41 additions & 8 deletions

File tree

src/components/OpenAIApiConfigView.tsx

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { useTranslation } from "react-i18next";
33
import { useDebounce } from "react-use";
44
import { useSettingStore } from "@/store";
55
import { OpenAIApiConfig } from "@/types";
6-
import { allowSelfOpenAIKey } from "@/utils";
6+
import { allowSelfOpenAIKey, hasFeature } from "@/utils";
77
import Radio from "./kit/Radio";
88
import TextField from "./kit/TextField";
99
import Tooltip from "./kit/Tooltip";
@@ -17,14 +17,29 @@ const OpenAIApiConfigView = () => {
1717
const models = [
1818
{
1919
id: "gpt-3.5-turbo",
20-
title: `GPT-3.5 (${t("setting.openai-api-configuration.quota-per-ask", { count: 1 })})`,
20+
title: `GPT-3.5 Turbo`,
21+
cost: 1,
22+
disabled: false,
23+
tooltip: "",
24+
},
25+
{
26+
id: "gpt-4-turbo",
27+
title: `GPT-4 Turbo`,
28+
cost: 20,
2129
disabled: false,
2230
tooltip: "",
2331
},
24-
// Disable GPT-4 if user doesn't provide key (because SQL Chat own key hasn't been whitelisted yet).
2532
{
2633
id: "gpt-4",
27-
title: `GPT-4 (${t("setting.openai-api-configuration.quota-per-ask", { count: 10 })})`,
34+
title: `GPT-4`,
35+
cost: 60,
36+
disabled: false,
37+
tooltip: "",
38+
},
39+
{
40+
id: "gpt-4o",
41+
title: `GPT-4o`,
42+
cost: 10,
2843
disabled: false,
2944
tooltip: "",
3045
},
@@ -66,7 +81,7 @@ const OpenAIApiConfigView = () => {
6681
onChange={(value) => handleSetOpenAIApiConfig({ model: value })}
6782
/>
6883
<label htmlFor={model.id} className="ml-3 block text-sm font-medium leading-6 text-gray-900">
69-
{model.title}
84+
{model.title} {hasFeature("quota") ? `(${t("setting.openai-api-configuration.quota-per-ask", { count: model.cost })})` : ""}
7085
</label>
7186
</div>
7287
);

src/utils/model.ts

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const gpt35 = {
1+
const gpt35turbo = {
22
name: "gpt-3.5-turbo",
33
temperature: 0,
44
frequency_penalty: 0.0,
@@ -13,16 +13,34 @@ const gpt4 = {
1313
frequency_penalty: 0.0,
1414
presence_penalty: 0.0,
1515
max_token: 8000,
16+
cost_per_call: 60,
17+
};
18+
19+
const gpt4turbo = {
20+
name: "gpt-4-turbo",
21+
temperature: 0,
22+
frequency_penalty: 0.0,
23+
presence_penalty: 0.0,
24+
max_token: 4000,
25+
cost_per_call: 20,
26+
};
27+
28+
const gpt4ho = {
29+
name: "gpt-4o",
30+
temperature: 0,
31+
frequency_penalty: 0.0,
32+
presence_penalty: 0.0,
33+
max_token: 4000,
1634
cost_per_call: 10,
1735
};
1836

19-
export const models = [gpt35, gpt4];
37+
export const models = [gpt35turbo, gpt4, gpt4turbo, gpt4ho];
2038

2139
export const getModel = (name: string) => {
2240
for (const model of models) {
2341
if (model.name === name) {
2442
return model;
2543
}
2644
}
27-
return gpt35;
45+
return gpt35turbo;
2846
};

0 commit comments

Comments
 (0)