-
ChatDBA
+
SQL Chat
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 54bf3c2..1d6e9f2 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -3,6 +3,7 @@ lockfileVersion: 5.4
specifiers:
'@headlessui/react': ^1.7.13
'@tailwindcss/typography': ^0.5.9
+ '@types/lodash-es': ^4.17.7
'@types/marked': ^4.0.8
'@types/node': ^18.11.18
'@types/react': ^18.0.26
@@ -14,6 +15,7 @@ specifiers:
eslint: 8.20.0
eslint-config-next: 12.2.3
highlight.js: ^11.7.0
+ lodash-es: ^4.17.21
marked: ^4.2.12
next: ^13.2.4
openai: ^3.0.0
@@ -34,6 +36,7 @@ dependencies:
axios: 1.3.4
csstype: 3.1.1
highlight.js: 11.7.0
+ lodash-es: 4.17.21
marked: 4.2.12
next: 13.2.4_biqbaboplfbrettd7655fr4n2y
openai: 3.2.1
@@ -47,6 +50,7 @@ dependencies:
devDependencies:
'@tailwindcss/typography': 0.5.9_tailwindcss@3.2.7
+ '@types/lodash-es': 4.17.7
'@types/marked': 4.0.8
'@types/node': 18.15.3
'@types/react': 18.0.28
@@ -284,6 +288,16 @@ packages:
resolution: {integrity: sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==}
dev: true
+ /@types/lodash-es/4.17.7:
+ resolution: {integrity: sha512-z0ptr6UI10VlU6l5MYhGwS4mC8DZyYer2mCoyysZtSF7p26zOX8UpbrV0YpNYLGS8K4PUFIyEr62IMFFjveSiQ==}
+ dependencies:
+ '@types/lodash': 4.14.191
+ dev: true
+
+ /@types/lodash/4.14.191:
+ resolution: {integrity: sha512-BdZ5BCCvho3EIXw6wUCXHe7rS53AIDPLE+JzwgT+OsJk53oBfbSmZZ7CX4VaRoN78N+TJpFi9QPlfIVNmJYWxQ==}
+ dev: true
+
/@types/marked/4.0.8:
resolution: {integrity: sha512-HVNzMT5QlWCOdeuBsgXP8EZzKUf0+AXzN+sLmjvaB3ZlLqO+e4u0uXrdw9ub69wBKFs+c6/pA4r9sy6cCDvImw==}
dev: true
@@ -1675,6 +1689,10 @@ packages:
engines: {node: '>=10'}
dev: true
+ /lodash-es/4.17.21:
+ resolution: {integrity: sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==}
+ dev: false
+
/lodash.castarray/4.4.0:
resolution: {integrity: sha512-aVx8ztPv7/2ULbArGJ2Y42bG1mEQ5mGjpdvrbJcJFU3TbYybe+QlLS4pst9zV52ymy2in1KpFPiZnAOATxD4+Q==}
dev: true
diff --git a/store/assistant.ts b/store/assistant.ts
index 15bd2b5..9191ece 100644
--- a/store/assistant.ts
+++ b/store/assistant.ts
@@ -1,11 +1,12 @@
+import { first } from "lodash-es";
import { Id, User, UserRole } from "../types";
// Assistant is a special user.
export const assistantList: User[] = [
{
- id: "assistant-dba",
- name: "ChatDBA",
- description: "🤖️ I am a chatbot that can help you with database administration.",
+ id: "sql-assistant",
+ name: "SQL Chat",
+ description: "🤖️ I'm an expert in SQL. I can answer your questions about databases and SQL.",
avatar: "",
role: UserRole.Assistant,
},
@@ -13,13 +14,13 @@ export const assistantList: User[] = [
export const getAssistantById = (id: Id) => {
const user = assistantList.find((user) => user.id === id);
- return user || undefined;
+ return user || (first(assistantList) as User);
};
// getPromptOfAssistant define the special prompt for each assistant.
export const getPromptOfAssistant = (assistant: User) => {
- if (assistant.id === "assistant-dba") {
- return `Remember that you are a DBA who is well versed in various databases. And you know everything about databases. You will answer some questions about databases.`;
+ if (assistant.id === "sql-assistant") {
+ return `Remember that you are an expert in SQL. And you know everything about databases. You will answer some questions about databases and SQL.`;
}
return "";
};
diff --git a/store/chat.ts b/store/chat.ts
index 75565b3..0875bd3 100644
--- a/store/chat.ts
+++ b/store/chat.ts
@@ -5,7 +5,7 @@ import { generateUUID } from "../utils";
export const defaultChat: Chat = {
id: generateUUID(),
- assistantId: "assistant-dba",
+ assistantId: "sql-assistant",
};
interface ChatState {