feat: clean mask feature and jump version to 3.10.1

This commit is contained in:
Zhang Minghan 2024-03-05 16:33:19 +08:00
parent ebe5afd52c
commit fe9004866f
4 changed files with 22 additions and 6 deletions

View File

@ -8,7 +8,7 @@
}, },
"package": { "package": {
"productName": "chatnio", "productName": "chatnio",
"version": "3.10.0" "version": "3.10.1"
}, },
"tauri": { "tauri": {
"allowlist": { "allowlist": {

View File

@ -5,6 +5,7 @@ import {
closeMarket, closeMarket,
selectCurrent, selectCurrent,
selectHistory, selectHistory,
selectMaskItem,
useConversationActions, useConversationActions,
} from "@/store/chat.ts"; } from "@/store/chat.ts";
import React, { useRef, useState } from "react"; import React, { useRef, useState } from "react";
@ -21,6 +22,7 @@ import {
Eraser, Eraser,
LogIn, LogIn,
MoreHorizontal, MoreHorizontal,
Paintbrush,
Plus, Plus,
RotateCw, RotateCw,
} from "lucide-react"; } from "lucide-react";
@ -70,6 +72,9 @@ function SidebarAction({ setOperateConversation }: SidebarActionProps) {
const refreshRef = useRef(null); const refreshRef = useRef(null);
const [removeAll, setRemoveAll] = useState<boolean>(false); const [removeAll, setRemoveAll] = useState<boolean>(false);
const current = useSelector(selectCurrent);
const mask = useSelector(selectMaskItem);
async function handleDeleteAll(e: React.MouseEvent<HTMLButtonElement>) { async function handleDeleteAll(e: React.MouseEvent<HTMLButtonElement>) {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
@ -100,7 +105,11 @@ function SidebarAction({ setOperateConversation }: SidebarActionProps) {
dispatch(closeMarket()); dispatch(closeMarket());
}} }}
> >
<Plus className={`h-4 w-4`} /> {current === -1 && mask ? (
<Paintbrush className={`h-4 w-4`} />
) : (
<Plus className={`h-4 w-4`} />
)}
</Button> </Button>
<div className={`grow`} /> <div className={`grow`} />
<AlertDialog open={removeAll} onOpenChange={setRemoveAll}> <AlertDialog open={removeAll} onOpenChange={setRemoveAll}>
@ -120,9 +129,13 @@ function SidebarAction({ setOperateConversation }: SidebarActionProps) {
</AlertDialogHeader> </AlertDialogHeader>
<AlertDialogFooter> <AlertDialogFooter>
<AlertDialogCancel>{t("conversation.cancel")}</AlertDialogCancel> <AlertDialogCancel>{t("conversation.cancel")}</AlertDialogCancel>
<AlertDialogAction onClick={handleDeleteAll}> <Button
variant={`destructive`}
loading={true}
onClick={handleDeleteAll}
>
{t("conversation.delete")} {t("conversation.delete")}
</AlertDialogAction> </Button>
</AlertDialogFooter> </AlertDialogFooter>
</AlertDialogContent> </AlertDialogContent>
</AlertDialog> </AlertDialog>

View File

@ -7,7 +7,7 @@ import {
import { syncSiteInfo } from "@/admin/api/info.ts"; import { syncSiteInfo } from "@/admin/api/info.ts";
import { setAxiosConfig } from "@/conf/api.ts"; import { setAxiosConfig } from "@/conf/api.ts";
export const version = "3.10.0"; // version of the current build export const version = "3.10.1"; // version of the current build
export const dev: boolean = getDev(); // is in development mode (for debugging, in localhost origin) export const dev: boolean = getDev(); // is in development mode (for debugging, in localhost origin)
export const deploy: boolean = true; // is production environment (for api endpoint) export const deploy: boolean = true; // is production environment (for api endpoint)
export const tokenField = getTokenField(deploy); // token field name for storing token export const tokenField = getTokenField(deploy); // token field name for storing token

View File

@ -27,6 +27,9 @@ func batchReplace(sql string, batch []batch) string {
} }
func PreflightSql(sql string) string { func PreflightSql(sql string) string {
// this is a simple way to adapt the sql to the sqlite engine
// it's not a common way to use sqlite in production, just as polyfill
if SqliteEngine { if SqliteEngine {
if strings.Contains(sql, "DUPLICATE KEY") { if strings.Contains(sql, "DUPLICATE KEY") {
sql = batchReplace(sql, []batch{ sql = batchReplace(sql, []batch{