chore: update prompts for code block language

This commit is contained in:
steven
2023-03-28 10:03:27 +08:00
parent 21184e01c3
commit c32a971bf2
3 changed files with 7 additions and 4 deletions

View File

@ -37,7 +37,7 @@ export const CodeBlock = (props: Props) => {
</button> </button>
</div> </div>
</div> </div>
<SyntaxHighlighter language={language} style={oneDark} customStyle={{ margin: 0 }}> <SyntaxHighlighter language={language.toLowerCase()} style={oneDark} customStyle={{ margin: 0 }}>
{value} {value}
</SyntaxHighlighter> </SyntaxHighlighter>
</div> </div>

View File

@ -193,7 +193,7 @@ const ConnectionSidebar = () => {
) : ( ) : (
<Icon.IoChatbubbleOutline className="w-5 h-auto mr-1.5 opacity-80 shrink-0" /> <Icon.IoChatbubbleOutline className="w-5 h-auto mr-1.5 opacity-80 shrink-0" />
)} )}
<span className="truncate">{chat.title || "SQL Chat"}</span> <span className="truncate grow">{chat.title || "SQL Chat"}</span>
<span <span
className="ml-0.5 shrink-0 opacity-60 hidden group-hover:block hover:opacity-80" className="ml-0.5 shrink-0 opacity-60 hidden group-hover:block hover:opacity-80"
onClick={(e) => { onClick={(e) => {

View File

@ -18,9 +18,12 @@ export const getAssistantById = (id: Id) => {
// getPromptOfAssistant define the special prompt for each assistant. // getPromptOfAssistant define the special prompt for each assistant.
export const getPromptGeneratorOfAssistant = (assistant: User) => { 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") { if (assistant.id === "sql-assistant") {
return (schema: string) => 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}`;
}; };