From c32a971bf23f125acbbf4047c3568a17946a73c2 Mon Sep 17 00:00:00 2001 From: steven Date: Tue, 28 Mar 2023 10:03:27 +0800 Subject: [PATCH] chore: update prompts for code block language --- components/CodeBlock.tsx | 2 +- components/ConnectionSidebar.tsx | 2 +- store/assistant.ts | 7 +++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/components/CodeBlock.tsx b/components/CodeBlock.tsx index 39a86d0..64642dd 100644 --- a/components/CodeBlock.tsx +++ b/components/CodeBlock.tsx @@ -37,7 +37,7 @@ export const CodeBlock = (props: Props) => { - + {value} diff --git a/components/ConnectionSidebar.tsx b/components/ConnectionSidebar.tsx index fb466d1..898ca86 100644 --- a/components/ConnectionSidebar.tsx +++ b/components/ConnectionSidebar.tsx @@ -193,7 +193,7 @@ const ConnectionSidebar = () => { ) : ( )} - {chat.title || "SQL Chat"} + {chat.title || "SQL Chat"} { diff --git a/store/assistant.ts b/store/assistant.ts index cd3043c..babfa1c 100644 --- a/store/assistant.ts +++ b/store/assistant.ts @@ -18,9 +18,12 @@ export const getAssistantById = (id: Id) => { // getPromptOfAssistant define the special prompt for each assistant. export const getPromptGeneratorOfAssistant = (assistant: User) => { + const basicPrompt = `Please follow the instructions to answer the questions. +1. Set the language to the markdown code block for each code block. For example, \`SELECT * FROM table\` is SQL. +`; if (assistant.id === "sql-assistant") { return (schema: string) => - `This is my database schema"${schema}". You will see the tables and columns in the database. And please answer the following questions about the database.`; + `This is my database schema"${schema}". You will see the tables and columns in the database. And please answer the following questions about the database.\n${basicPrompt}`; } - return () => ""; + return () => `\n${basicPrompt}`; };