Skip to content

Commit

Permalink
update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
yasuaki640 committed Nov 24, 2024
1 parent e9a7949 commit b841d6b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 11 deletions.
17 changes: 9 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
},
"dependencies": {
"drizzle-orm": "^0.30.10",
"hono": "^4.6.10",
"openai": "^4.72.0",
"hono": "^4.6.11",
"openai": "^4.73.0",
"rehype-sanitize": "^6.0.0",
"rehype-stringify": "^10.0.0",
"remark-parse": "^11.0.0",
Expand Down
3 changes: 3 additions & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ app.post("/chats/:roomId", async (c) => {
const completion = await fetchCompletion(
c.var.openai,
`次の質問に対して、短くわかりやすい題名をつけてください。「${newMessage}」`,
undefined,
{ model: "gpt-4o-mini" },
);
const roomTitle = completion.choices[0].message.content;
await updateRoom(db, roomId, { roomId, roomTitle });
Expand All @@ -105,6 +107,7 @@ app.post("/chats/:roomId", async (c) => {
c.var.openai,
newMessage,
messageHistory,
{ model: "gpt-4o" }, // MEMO: o1を使いたいが、日本語で返してくれないため、引き続き4oを使う
);
const resMessage = completion.choices.map<typeof Messages.$inferInsert>(
(c) => ({
Expand Down
4 changes: 3 additions & 1 deletion src/utils/openai-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ export const fetchCompletion = async (
openai: OpenAI,
newMessage: string,
messageHistory?: ChatCompletionMessageParam[],
bodyOverride?: Partial<OpenAI.Chat.Completions.ChatCompletionCreateParamsNonStreaming>,
) =>
openai.chat.completions.create({
messages: [
...(messageHistory ?? []),
{ role: "user", content: newMessage },
],
model: "gpt-4o",
model: "o1-preview",
...bodyOverride,
});

0 comments on commit b841d6b

Please sign in to comment.