mirror of
https://github.com/sqlchat/sqlchat.git
synced 2025-09-25 17:15:19 +08:00
chore: update create assistant link
This commit is contained in:
@ -6,6 +6,7 @@ import { Conversation } from "@/types";
|
|||||||
import TextField from "./kit/TextField";
|
import TextField from "./kit/TextField";
|
||||||
import Modal from "./kit/Modal";
|
import Modal from "./kit/Modal";
|
||||||
import Select from "./kit/Select";
|
import Select from "./kit/Select";
|
||||||
|
import Icon from "./Icon";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
conversation: Conversation;
|
conversation: Conversation;
|
||||||
@ -52,9 +53,16 @@ const UpdateConversationModal = (props: Props) => {
|
|||||||
<Select className="w-full" value={assistantId} itemList={assistantItems} onValueChange={(value) => setAssistantId(value)} />
|
<Select className="w-full" value={assistantId} itemList={assistantItems} onValueChange={(value) => setAssistantId(value)} />
|
||||||
{currentAssistant && (
|
{currentAssistant && (
|
||||||
<div className="w-full flex flex-col justify-start items-start">
|
<div className="w-full flex flex-col justify-start items-start">
|
||||||
<p className="block text-sm text-gray-700 mt-1 ml-3">{currentAssistant.description}</p>
|
<p className="block text-sm text-gray-700 mt-2 mx-3">{currentAssistant.description}</p>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
<a
|
||||||
|
className="mt-1 mx-3 text-sm text-blue-600 underline hover:opacity-80"
|
||||||
|
href="https://github.com/sqlchat/sqlchat/tree/main/assistants"
|
||||||
|
target="_blank"
|
||||||
|
>
|
||||||
|
{t("assistant.create-your-bot")} <Icon.FiExternalLink className="inline-block -mt-0.5" />
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div className="w-full flex flex-row justify-end items-center mt-4 space-x-2">
|
<div className="w-full flex flex-row justify-end items-center mt-4 space-x-2">
|
||||||
<button className="btn btn-outline" onClick={close}>
|
<button className="btn btn-outline" onClick={close}>
|
||||||
|
@ -23,7 +23,8 @@
|
|||||||
"select-database": "Select your database"
|
"select-database": "Select your database"
|
||||||
},
|
},
|
||||||
"assistant": {
|
"assistant": {
|
||||||
"self": "Bot"
|
"self": "Bot",
|
||||||
|
"create-your-bot": "Can't find the bot you need? Create one"
|
||||||
},
|
},
|
||||||
"execution": {
|
"execution": {
|
||||||
"title": "Execute SQL",
|
"title": "Execute SQL",
|
||||||
|
@ -23,7 +23,8 @@
|
|||||||
"select-database": "选择数据库"
|
"select-database": "选择数据库"
|
||||||
},
|
},
|
||||||
"assistant": {
|
"assistant": {
|
||||||
"self": "机器人"
|
"self": "机器人",
|
||||||
|
"create-your-bot": "找不到需要的机器人?创建一个"
|
||||||
},
|
},
|
||||||
"execution": {
|
"execution": {
|
||||||
"title": "执行 SQL",
|
"title": "执行 SQL",
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
|
import { merge } from "lodash-es";
|
||||||
import { create } from "zustand";
|
import { create } from "zustand";
|
||||||
import { Connection, Database } from "@/types";
|
import { persist } from "zustand/middleware";
|
||||||
|
import { Connection, Database, Timestamp } from "@/types";
|
||||||
|
|
||||||
interface ExecuteQueryContext {
|
interface ExecuteQueryContext {
|
||||||
connection: Connection;
|
connection: Connection;
|
||||||
@ -7,25 +9,45 @@ interface ExecuteQueryContext {
|
|||||||
statement: string;
|
statement: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface QueryHistory {
|
||||||
|
context: ExecuteQueryContext;
|
||||||
|
createdAt: Timestamp;
|
||||||
|
}
|
||||||
|
|
||||||
interface QueryState {
|
interface QueryState {
|
||||||
context?: ExecuteQueryContext;
|
|
||||||
showDrawer: boolean;
|
showDrawer: boolean;
|
||||||
|
queryHistory: QueryHistory[];
|
||||||
|
context?: ExecuteQueryContext;
|
||||||
toggleDrawer: (show?: boolean) => void;
|
toggleDrawer: (show?: boolean) => void;
|
||||||
setContext: (context: ExecuteQueryContext | undefined) => void;
|
setContext: (context: ExecuteQueryContext | undefined) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useQueryStore = create<QueryState>()((set) => ({
|
export const useQueryStore = create<QueryState>()(
|
||||||
showDrawer: false,
|
persist(
|
||||||
toggleDrawer: (show) => {
|
(set) => ({
|
||||||
set((state) => ({
|
showDrawer: false,
|
||||||
...state,
|
queryHistory: [],
|
||||||
showDrawer: show ?? !state.showDrawer,
|
toggleDrawer: (show) => {
|
||||||
}));
|
set((state) => ({
|
||||||
},
|
...state,
|
||||||
setContext: (context) => {
|
showDrawer: show ?? !state.showDrawer,
|
||||||
set((state) => ({
|
}));
|
||||||
...state,
|
},
|
||||||
context,
|
setContext: (context) => {
|
||||||
}));
|
set((state) => ({
|
||||||
},
|
...state,
|
||||||
}));
|
context,
|
||||||
|
}));
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
{
|
||||||
|
name: "query-storage",
|
||||||
|
merge: (persistedState, currentState) => {
|
||||||
|
return {
|
||||||
|
...merge(currentState, persistedState),
|
||||||
|
context: undefined,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
Reference in New Issue
Block a user