MCPcopy Index your code
hub / github.com/sqlchat/sqlchat / OpenAIApiConfigView

Function OpenAIApiConfigView

src/components/OpenAIApiConfigView.tsx:11–153  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

9import Tooltip from "./kit/Tooltip";
10
11const OpenAIApiConfigView = () => {
12 const { t } = useTranslation();
13 const settingStore = useSettingStore();
14 const [openAIApiConfig, setOpenAIApiConfig] = useState(settingStore.setting.openAIApiConfig);
15 const [maskKey, setMaskKey] = useState(true);
16
17 const models = [
18 {
19 id: "gpt-3.5-turbo",
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,
29 disabled: false,
30 tooltip: "",
31 },
32 {
33 id: "gpt-4",
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,
43 disabled: false,
44 tooltip: "",
45 },
46 {
47 id: "deepseek-chat",
48 title: `Deepseek Chat`,
49 cost: 1,
50 disabled: false,
51 tooltip: "",
52 },
53 ];
54
55 const maskedKey = (str: string) => {
56 if (str.length < 7) {
57 return str;
58 }
59 const firstThree = str.slice(0, 3);
60 const lastFour = str.slice(-4);
61 const middle = ".".repeat(str.length - 7);
62 return `${firstThree}${middle}${lastFour}`;
63 };
64
65 useDebounce(
66 () => {
67 settingStore.setOpenAIApiConfig(openAIApiConfig);
68 },

Callers

nothing calls this directly

Calls 4

allowSelfOpenAIKeyFunction · 0.90
modelRadioFunction · 0.85
maskedKeyFunction · 0.85
handleSetOpenAIApiConfigFunction · 0.85

Tested by

no test coverage detected