mirror of
https://github.com/sqlchat/sqlchat.git
synced 2025-09-25 09:03:43 +08:00
feat: add gpt4 turbo and 4o
This commit is contained in:
@ -3,7 +3,7 @@ import { useTranslation } from "react-i18next";
|
|||||||
import { useDebounce } from "react-use";
|
import { useDebounce } from "react-use";
|
||||||
import { useSettingStore } from "@/store";
|
import { useSettingStore } from "@/store";
|
||||||
import { OpenAIApiConfig } from "@/types";
|
import { OpenAIApiConfig } from "@/types";
|
||||||
import { allowSelfOpenAIKey } from "@/utils";
|
import { allowSelfOpenAIKey, hasFeature } from "@/utils";
|
||||||
import Radio from "./kit/Radio";
|
import Radio from "./kit/Radio";
|
||||||
import TextField from "./kit/TextField";
|
import TextField from "./kit/TextField";
|
||||||
import Tooltip from "./kit/Tooltip";
|
import Tooltip from "./kit/Tooltip";
|
||||||
@ -17,14 +17,29 @@ const OpenAIApiConfigView = () => {
|
|||||||
const models = [
|
const models = [
|
||||||
{
|
{
|
||||||
id: "gpt-3.5-turbo",
|
id: "gpt-3.5-turbo",
|
||||||
title: `GPT-3.5 (${t("setting.openai-api-configuration.quota-per-ask", { count: 1 })})`,
|
title: `GPT-3.5 Turbo`,
|
||||||
|
cost: 1,
|
||||||
|
disabled: false,
|
||||||
|
tooltip: "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "gpt-4-turbo",
|
||||||
|
title: `GPT-4 Turbo`,
|
||||||
|
cost: 20,
|
||||||
disabled: false,
|
disabled: false,
|
||||||
tooltip: "",
|
tooltip: "",
|
||||||
},
|
},
|
||||||
// Disable GPT-4 if user doesn't provide key (because SQL Chat own key hasn't been whitelisted yet).
|
|
||||||
{
|
{
|
||||||
id: "gpt-4",
|
id: "gpt-4",
|
||||||
title: `GPT-4 (${t("setting.openai-api-configuration.quota-per-ask", { count: 10 })})`,
|
title: `GPT-4`,
|
||||||
|
cost: 60,
|
||||||
|
disabled: false,
|
||||||
|
tooltip: "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "gpt-4o",
|
||||||
|
title: `GPT-4o`,
|
||||||
|
cost: 10,
|
||||||
disabled: false,
|
disabled: false,
|
||||||
tooltip: "",
|
tooltip: "",
|
||||||
},
|
},
|
||||||
@ -66,7 +81,7 @@ const OpenAIApiConfigView = () => {
|
|||||||
onChange={(value) => handleSetOpenAIApiConfig({ model: value })}
|
onChange={(value) => handleSetOpenAIApiConfig({ model: value })}
|
||||||
/>
|
/>
|
||||||
<label htmlFor={model.id} className="ml-3 block text-sm font-medium leading-6 text-gray-900">
|
<label htmlFor={model.id} className="ml-3 block text-sm font-medium leading-6 text-gray-900">
|
||||||
{model.title}
|
{model.title} {hasFeature("quota") ? `(${t("setting.openai-api-configuration.quota-per-ask", { count: model.cost })})` : ""}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
const gpt35 = {
|
const gpt35turbo = {
|
||||||
name: "gpt-3.5-turbo",
|
name: "gpt-3.5-turbo",
|
||||||
temperature: 0,
|
temperature: 0,
|
||||||
frequency_penalty: 0.0,
|
frequency_penalty: 0.0,
|
||||||
@ -13,10 +13,28 @@ const gpt4 = {
|
|||||||
frequency_penalty: 0.0,
|
frequency_penalty: 0.0,
|
||||||
presence_penalty: 0.0,
|
presence_penalty: 0.0,
|
||||||
max_token: 8000,
|
max_token: 8000,
|
||||||
|
cost_per_call: 60,
|
||||||
|
};
|
||||||
|
|
||||||
|
const gpt4turbo = {
|
||||||
|
name: "gpt-4-turbo",
|
||||||
|
temperature: 0,
|
||||||
|
frequency_penalty: 0.0,
|
||||||
|
presence_penalty: 0.0,
|
||||||
|
max_token: 4000,
|
||||||
|
cost_per_call: 20,
|
||||||
|
};
|
||||||
|
|
||||||
|
const gpt4ho = {
|
||||||
|
name: "gpt-4o",
|
||||||
|
temperature: 0,
|
||||||
|
frequency_penalty: 0.0,
|
||||||
|
presence_penalty: 0.0,
|
||||||
|
max_token: 4000,
|
||||||
cost_per_call: 10,
|
cost_per_call: 10,
|
||||||
};
|
};
|
||||||
|
|
||||||
export const models = [gpt35, gpt4];
|
export const models = [gpt35turbo, gpt4, gpt4turbo, gpt4ho];
|
||||||
|
|
||||||
export const getModel = (name: string) => {
|
export const getModel = (name: string) => {
|
||||||
for (const model of models) {
|
for (const model of models) {
|
||||||
@ -24,5 +42,5 @@ export const getModel = (name: string) => {
|
|||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return gpt35;
|
return gpt35turbo;
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user