chore: declare bots id

This commit is contained in:
steven
2023-04-18 10:16:11 +08:00
parent 0bf7a155b1
commit 480ec2d463
3 changed files with 7 additions and 3 deletions

View File

@@ -21,7 +21,7 @@ const QueryDrawer = () => {
const [isLoading, setIsLoading] = useState(false);
const context = queryStore.context;
const executionMessage = executionResult ? getMessageFromExecutionResult(executionResult) : "";
const showExecutionWarningBanner = !checkStatementIsSelect(statement);
const showExecutionWarningBanner = statement.trim() && !checkStatementIsSelect(statement);
useEffect(() => {
if (!queryStore.showDrawer) {

View File

@@ -2,6 +2,9 @@ import { first } from "lodash-es";
import { Assistant, Id } from "@/types";
import * as customAssistantList from "../../assistants";
export const GeneralBotId = "general-bot";
export const SQLChatBotId = "sql-chat-bot";
export const assistantList: Assistant[] = Object.keys(customAssistantList).map((name) => {
return {
...((customAssistantList as any)[name].default as Assistant),

View File

@@ -3,11 +3,12 @@ import { create } from "zustand";
import { persist } from "zustand/middleware";
import { Conversation, Id } from "@/types";
import { generateUUID } from "@/utils";
import { GeneralBotId, SQLChatBotId } from ".";
const getDefaultConversation = (): Conversation => {
return {
id: generateUUID(),
assistantId: "general-bot",
assistantId: GeneralBotId,
title: dayjs().format("LTS"),
createdAt: Date.now(),
};
@@ -36,7 +37,7 @@ export const useConversationStore = create<ConversationState>()(
databaseName,
};
if (connectionId) {
conversation.assistantId = "sql-chat-bot";
conversation.assistantId = SQLChatBotId;
}
set((state) => ({
conversationList: [...state.conversationList, conversation],