From 6daa459e57a13b7952e0f1bc914b302b8b24b260 Mon Sep 17 00:00:00 2001 From: Steven Date: Mon, 20 Mar 2023 13:42:47 +0800 Subject: [PATCH] chore: rename to `sqlchat` --- README.md | 4 ++-- components/ChatView/Header.tsx | 20 ++++++++++---------- components/Empty.tsx | 9 +++++++++ package.json | 4 +++- pages/chat.tsx | 2 +- pages/index.tsx | 6 +++--- pnpm-lock.yaml | 18 ++++++++++++++++++ store/assistant.ts | 13 +++++++------ store/chat.ts | 2 +- 9 files changed, 54 insertions(+), 24 deletions(-) create mode 100644 components/Empty.tsx diff --git a/README.md b/README.md index f19f8ac..4507d06 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ -# ChatDBA +# SQL Chat -[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fbytebase%2Fchatdba&env=OPENAI_API_KEY) +[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fbytebase%2Fsqlchat&env=OPENAI_API_KEY) diff --git a/components/ChatView/Header.tsx b/components/ChatView/Header.tsx index 70599f8..a1d1606 100644 --- a/components/ChatView/Header.tsx +++ b/components/ChatView/Header.tsx @@ -16,13 +16,13 @@ const Header = () => { }; return ( -
+
- - + + - + @@ -31,7 +31,7 @@ const Header = () => { @@ -42,17 +42,17 @@ const Header = () => {
- {assistant.name} - + {assistant.name} +

{assistant.description}

- - + + - +
{ + return
; +}; + +export default Empty; diff --git a/package.json b/package.json index 0932740..42a5587 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "chatdba", + "name": "sqlchat", "private": false, "scripts": { "dev": "next dev", @@ -12,6 +12,7 @@ "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", "openai": "^3.0.0", @@ -25,6 +26,7 @@ }, "devDependencies": { "@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", diff --git a/pages/chat.tsx b/pages/chat.tsx index 96f2f21..8e7f8a9 100644 --- a/pages/chat.tsx +++ b/pages/chat.tsx @@ -7,7 +7,7 @@ const ChatPage: NextPage = () => { return (
- ChatDBA + SQL Chat diff --git a/pages/index.tsx b/pages/index.tsx index bfba7c9..4e04899 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -8,17 +8,17 @@ const HomePage: NextPage = () => { return ( <> - ChatDBA + SQL Chat
-

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 {