Skip to content

Commit

Permalink
chore: system msg format fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Keyrxng committed Jul 24, 2024
1 parent 1160999 commit 4771e02
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/utils/format-chat-history.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ export function createChatHistory(formattedChat: string) {
const systemMessage: ChatCompletionMessageParam = {
role: "system",
content: `You are a GitHub integrated chatbot tasked with assisting in research and discussion on GitHub issues and pull requests.
Using the provided context, address the question being asked providing a clear and concise answer with no follow-up statements.
The LAST comment in 'Issue Conversation' is the most recent one, focus on it as that is the question being asked.
Use GitHub flavoured markdown in your response making effective use of lists, code blocks and other supported GitHub md features.`.trim(),
Using the provided context, address the question being asked providing a clear and concise answer with no follow-up statements.
The LAST comment in 'Issue Conversation' is the most recent one, focus on it as that is the question being asked.
Use GitHub flavoured markdown in your response making effective use of lists, code blocks and other supported GitHub md features.`
};

const userMessage: ChatCompletionMessageParam = {
Expand Down
12 changes: 9 additions & 3 deletions tests/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ const TEST_QUESTION = "What is pi?";
const TEST_SLASH_COMMAND = "/gpt what is pi?";
const LOG_CALLER = "_Logs.<anonymous>";

const systemMsg = `You are a GitHub integrated chatbot tasked with assisting in research and discussion on GitHub issues and pull requests.
Using the provided context, address the question being asked providing a clear and concise answer with no follow-up statements.
The LAST comment in 'Issue Conversation' is the most recent one, focus on it as that is the question being asked.
Use GitHub flavoured markdown in your response making effective use of lists, code blocks and other supported GitHub md features.`

type Comment = {
id: number;
user: {
Expand Down Expand Up @@ -132,14 +137,15 @@ This is a demo spec for a demo task just perfect for testing.
=== End Current Issue #1 Conversation ===\n
`;



expect(infoSpy).toHaveBeenNthCalledWith(1, "Asking question: what is pi?");
expect(infoSpy).toHaveBeenNthCalledWith(2, "Sending chat to OpenAI", {
caller: LOG_CALLER,
chat: [
{
role: "system",
content:
"You are a GitHub integrated chatbot tasked with assisting in research and discussion on GitHub issues and pull requests.\n Using the provided context, address the question being asked providing a clear and concise answer with no follow-up statements.\n The LAST comment in 'Issue Conversation' is the most recent one, focus on it as that is the question being asked.\n Use GitHub flavoured markdown in your response making effective use of lists, code blocks and other supported GitHub md features.",
content: systemMsg,
},
{
role: "user",
Expand Down Expand Up @@ -211,7 +217,7 @@ Just another issue
chat: [
{
role: "system",
content: `You are a GitHub integrated chatbot tasked with assisting in research and discussion on GitHub issues and pull requests.\n Using the provided context, address the question being asked providing a clear and concise answer with no follow-up statements.\n The LAST comment in 'Issue Conversation' is the most recent one, focus on it as that is the question being asked.\n Use GitHub flavoured markdown in your response making effective use of lists, code blocks and other supported GitHub md features.`,
content: systemMsg,
},
{
role: "user",
Expand Down

0 comments on commit 4771e02

Please sign in to comment.