diff --git a/package.json b/package.json
index 05797e0..b788381 100755
--- a/package.json
+++ b/package.json
@@ -51,7 +51,7 @@
"eslint-plugin-prettier": "4.2.1",
"eslint-plugin-react": "7.31.8",
"fs-extra": "10.1.0",
- "openai": "4.52.3",
+ "openai": "4.55.4",
"jest": "29.0.3",
"jest-environment-jsdom": "29.0.3",
"npm-run-all": "^4.1.5",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 4c2ce86..80d7515 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -107,8 +107,8 @@ devDependencies:
specifier: ^4.1.5
version: 4.1.5
openai:
- specifier: 4.52.3
- version: 4.52.3
+ specifier: 4.55.4
+ version: 4.55.4
prettier:
specifier: 2.7.1
version: 2.7.1
@@ -5705,9 +5705,14 @@ packages:
mimic-fn: 2.1.0
dev: true
- /openai@4.52.3:
- resolution: {integrity: sha512-IyQLYKGYoEEkUCEm2frPzwHDJ3Ym663KtivnY6pWCzuoi6/HgSIMMxpcuTRS81GH6tiULPYGmTxIvzXdmPIWOw==}
+ /openai@4.55.4:
+ resolution: {integrity: sha512-TEC75Y6U/OKIJp9fHao3zkTYfKLYGqXdD2TI+xN2Zd5W8KNKvv6E4/OBTOW7jg7fySfrBrhy5fYzBbyBcdHEtQ==}
hasBin: true
+ peerDependencies:
+ zod: ^3.23.8
+ peerDependenciesMeta:
+ zod:
+ optional: true
dependencies:
'@types/node': 18.19.39
'@types/node-fetch': 2.6.11
@@ -5716,7 +5721,6 @@ packages:
form-data-encoder: 1.7.2
formdata-node: 4.4.1
node-fetch: 2.7.0
- web-streams-polyfill: 3.3.3
transitivePeerDependencies:
- encoding
dev: true
@@ -6977,11 +6981,6 @@ packages:
graceful-fs: 4.2.11
dev: true
- /web-streams-polyfill@3.3.3:
- resolution: {integrity: sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==}
- engines: {node: '>= 8'}
- dev: true
-
/web-streams-polyfill@4.0.0-beta.3:
resolution: {integrity: sha512-QW95TCTaHmsYfHDybGMwO5IJIM93I/6vTRk+daHTWFPhwh+C8Cg7j7XyKrwrj8Ib6vYXe0ocYNrmzY4xAAN6ug==}
engines: {node: '>= 14'}
diff --git a/src/global.d.ts b/src/global.d.ts
index 9c5ae53..9c92d04 100644
--- a/src/global.d.ts
+++ b/src/global.d.ts
@@ -41,8 +41,10 @@ declare module "*.json" {
}
declare global {
+ type Model = "gpt-4-turbo" | "gpt-4o" | "gpt-3.5-turbo" | "gpt-4o-mini";
+
type ChatGPTSlot = {
- type: "gpt-4-turbo" | "gpt-4o" | "gpt-3.5-turbo";
+ type: Model;
system?: string;
/** config */
maxTokens?: number; // max 4000
@@ -108,7 +110,7 @@ declare global {
type: "RequestQuickChatGPTStream";
input?: {
messages: Chat[];
- model: "gpt-4-turbo" | "gpt-4o" | "gpt-3.5-turbo";
+ model: Model;
};
data?: { result: string; chunk?: string; isDone?: boolean };
};
diff --git a/src/pages/background/lib/infra/chatGPT.ts b/src/pages/background/lib/infra/chatGPT.ts
index 13f18cb..cdfcd04 100644
--- a/src/pages/background/lib/infra/chatGPT.ts
+++ b/src/pages/background/lib/infra/chatGPT.ts
@@ -1,6 +1,5 @@
import { OpenAI } from "openai";
import { ChatCompletionMessageParam } from "openai/resources";
-import { ChatModel } from "openai/src/resources/chat/chat";
export async function chatGPT({
input,
diff --git a/src/pages/popup/components/SlotDetail.tsx b/src/pages/popup/components/SlotDetail.tsx
index 5da2f25..06d795c 100644
--- a/src/pages/popup/components/SlotDetail.tsx
+++ b/src/pages/popup/components/SlotDetail.tsx
@@ -108,6 +108,9 @@ export default function SlotDetail({
+
diff --git a/src/pages/popup/pages/QuickChattingPage.tsx b/src/pages/popup/pages/QuickChattingPage.tsx
index 49b04c5..4faee5d 100644
--- a/src/pages/popup/pages/QuickChattingPage.tsx
+++ b/src/pages/popup/pages/QuickChattingPage.tsx
@@ -51,7 +51,7 @@ export default function QuickChattingPage({
inputText: "",
chats: [],
tempResponse: "",
- model: (localStorage.getItem("model") as any) ?? "gpt-3.5-turbo",
+ model: (localStorage.getItem("model") as Model) ?? "gpt-3.5-turbo",
},
services: {
getChatHistoryFromBackground: () => {
@@ -114,7 +114,7 @@ export default function QuickChattingPage({
send("RECEIVE_CANCEL");
};
- const onSelectModel = (model: "gpt-4-turbo" | "gpt-4o" | "gpt-3.5-turbo") => {
+ const onSelectModel = (model: Model) => {
send("SELECT_GPT_MODEL", { data: model });
localStorage.setItem("model", model);
};
diff --git a/src/shared/services/getGPTResponseAsStream.ts b/src/shared/services/getGPTResponseAsStream.ts
index 316ae87..65bb680 100644
--- a/src/shared/services/getGPTResponseAsStream.ts
+++ b/src/shared/services/getGPTResponseAsStream.ts
@@ -7,7 +7,7 @@ export async function getQuickGPTResponseAsStream({
onFinish,
}: {
messages: Chat[];
- model: "gpt-4-turbo" | "gpt-4o" | "gpt-3.5-turbo";
+ model: Model;
onDelta: (chunk: string) => unknown;
onFinish: (result: string) => unknown;
}) {
diff --git a/src/shared/xState/streamChatStateMachine.ts b/src/shared/xState/streamChatStateMachine.ts
index 4930729..9ec3eef 100644
--- a/src/shared/xState/streamChatStateMachine.ts
+++ b/src/shared/xState/streamChatStateMachine.ts
@@ -6,7 +6,7 @@ type Events =
}
| {
type: "SELECT_GPT_MODEL";
- data: "gpt-4-turbo" | "gpt-4o" | "gpt-3.5-turbo";
+ data: Model;
}
| { type: "CHANGE_TEXT"; data: string }
| { type: "RECEIVE_ING"; data: string }
@@ -16,7 +16,7 @@ interface Context {
inputText: string;
chats: Chat[];
tempResponse: string;
- model: "gpt-4-turbo" | "gpt-4o" | "gpt-3.5-turbo";
+ model: Model;
error?: Error;
cancelReceive?: () => unknown;
}