diff --git a/package.json b/package.json index 93dd9e0..bed02c8 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,6 @@ "@types/react-dom": "^18.0.11", "buffer": "^5.7.1", "parcel": "^2.8.3", - "path-browserify": "^1.0.1", "parcel-reporter-static-files-copy": "^1.5.0", "process": "^0.11.10" }, diff --git a/src/routes/ChatRoute.tsx b/src/routes/ChatRoute.tsx index 193168d..cee3512 100644 --- a/src/routes/ChatRoute.tsx +++ b/src/routes/ChatRoute.tsx @@ -20,10 +20,7 @@ import { MessageItem } from "../components/MessageItem"; import { db } from "../db"; import { useChatId } from "../hooks/useChatId"; import { config } from "../utils/config"; -import { - createChatCompletion, - createStreamChatCompletion, -} from "../utils/openai"; +import { createChatCompletion } from "../utils/openai"; export function ChatRoute() { const chatId = useChatId(); diff --git a/src/static/config.json b/src/static/config.json index 4671086..780752a 100644 --- a/src/static/config.json +++ b/src/static/config.json @@ -10,45 +10,25 @@ "value": "gpt-3.5-turbo", "label": "GPT-3.5-TURBO (Default ChatGPT)" }, - { - "value": "gpt-3.5-turbo-0613", - "label": "GPT-3.5-TURBO-0613" - }, { "value": "gpt-3.5-turbo-0301", - "label": "GPT-3.5-TURBO-0301 (Legacy)" - }, - { - "value": "gpt-3.5-turbo-16k", - "label": "GPT-3.5-TURBO-16K" - }, - { - "value": "gpt-3.5-turbo-16k-0613", - "label": "GPT-3.5-TURBO-16K-0613" + "label": "GPT-3.5-TURBO-0301" }, { "value": "gpt-4", "label": "GPT-4 (Limited Beta)" }, - { - "value": "gpt-4-0613", - "label": "GPT-4-0613 (Limited Beta)" - }, { "value": "gpt-4-0314", - "label": "GPT-4-0314 (Limited Beta, Legacy)" + "label": "GPT-4-0314 (Limited Beta)" }, { "value": "gpt-4-32k", "label": "GPT-4-32K (Limited Beta)" }, - { - "value": "gpt-4-32k-0613", - "label": "GPT-4-32K-0613 (Limited Beta)" - }, { "value": "gpt-4-32k-0314", - "label": "GPT-4-32K-0314 (Limited Beta, Legacy)" + "label": "GPT-4-32K-0314 (Limited Beta)" } ], "writingCharacters": [ diff --git a/src/utils/openai.ts b/src/utils/openai.ts index 3c776bf..c699da1 100644 --- a/src/utils/openai.ts +++ b/src/utils/openai.ts @@ -4,19 +4,11 @@ import { OpenAIExt } from "openai-ext"; import { db } from "../db"; import { config } from "./config"; -function getClient( - apiKey: string, - apiType: string, - apiAuth: string, - basePath: string -) { +function getClient(apiKey: string, apiType: string, apiAuth:string, basePath: string) { const configuration = new Configuration({ - ...((apiType === "openai" || - (apiType === "custom" && apiAuth === "bearer-token")) && { - apiKey: apiKey, - }), - ...(apiType === "custom" && { basePath: basePath }), - }); + ...((apiType === 'openai' || (apiType === 'custom' && apiAuth === 'bearer-token')) && { apiKey: apiKey }), + ...(apiType === 'custom' && { basePath: basePath }), + }); return new OpenAIApi(configuration); } @@ -88,15 +80,15 @@ export async function createChatCompletion( { model, stream: false, - messages, + messages }, { headers: { "Content-Type": "application/json", - ...(type === "custom" && auth === "api-key" && { "api-key": apiKey }), + ...((type === 'custom' && auth === 'api-key') && { "api-key": apiKey }), }, params: { - ...(type === "custom" && { "api-version": version }), + ...((type === 'custom') && {"api-version": version}), }, } );