Skip to content

Commit

Permalink
fix messages
Browse files Browse the repository at this point in the history
  • Loading branch information
HikaruEgashira committed Oct 7, 2024
1 parent 53dc738 commit f3a78fd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/chatHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ export const chatHandler: ({

const previousMessages: CoreMessage[] = context.history.map((h) =>
h instanceof vscode.ChatRequestTurn
? { role: "user", content: h.prompt.trim().substring(0, 100) + "..." }
: { role: "system", content: `${h.response.at(-1)?.value}`.trim().substring(0, 100) + "..." },
? { role: "user", content: h.prompt.substring(0, 100) + "..." }
: { role: "assistant", content: `${h.response.at(-1)?.value}`.substring(0, 100) + "..." },
);

const openai = createOpenAI({
Expand All @@ -40,7 +40,7 @@ export const chatHandler: ({
temperature: 0,
experimental_continueSteps: true,
messages: [
{ role: "system", content: systemPrompt ?? "" },
{ role: "assistant", content: systemPrompt ?? "" },
...previousMessages,
{ role: "user", content: request.prompt },
],
Expand Down

0 comments on commit f3a78fd

Please sign in to comment.