From 40ebfd27eb46709ce9b9e92c9f55f53e9cf4edc7 Mon Sep 17 00:00:00 2001 From: terasum Date: Thu, 19 Sep 2024 15:15:21 +0800 Subject: [PATCH] feat(package-lock.json): delete useless dependencies --- README.md | 8 +- package.json | 18 +- pnpm-lock.yaml | 352 +----------------- src/TabSettings.tsx | 254 ------------- src/api/prompt.ts | 2 - src/components/custom/prompt/Prompt.tsx | 2 +- .../prompt/components/PromptContent.tsx | 2 +- .../custom/prompt/components/PromptMeta.tsx | 1 - .../prompt/components/PromptToolbar.tsx | 22 +- .../custom/settings/settings-nav.tsx | 37 +- src/components/custom/settings/settings.tsx | 4 +- src/components/ui/box-icon.tsx | 23 -- src/components/ui/index.tsx | 1 - src/hooks/use-conversation.tsx | 16 +- src/hooks/use-settings-nav.tsx | 37 -- src/store/index.ts | 4 +- src/store/settings-nav/index.ts | 49 +++ vite.config.ts | 4 +- 18 files changed, 112 insertions(+), 724 deletions(-) delete mode 100644 src/TabSettings.tsx delete mode 100644 src/components/ui/box-icon.tsx delete mode 100644 src/hooks/use-settings-nav.tsx create mode 100644 src/store/settings-nav/index.ts diff --git a/README.md b/README.md index bbec745..cebcd97 100644 --- a/README.md +++ b/README.md @@ -26,12 +26,16 @@ +## 如何使用 Openchat +1. 在设置页面选择OpenChat, 输入API-Key即可 + + ## 如何使用Ollama 1. 安装ollama,参考[ollama](https://ollama.com/)的安装文档。 2. 运行ollama, 可以使用轻量模型 `tinyllama`, 运行命令 `ollama run tinyllama` -ollama tinyollama +ollama tinyollama 3. 配置 openchat, 在设置页面选择 ollama, 模型选择 tinyllama 即可 -ollama tinyollama +ollama tinyollama 4. 如果没有你需要的模型,欢迎提交pr。 diff --git a/package.json b/package.json index 74d4532..48f87e5 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,6 @@ "prepare": "husky" }, "dependencies": { - "@hookform/resolvers": "^3.9.0", "@radix-ui/react-alert-dialog": "^1.1.1", "@radix-ui/react-avatar": "^1.1.0", "@radix-ui/react-checkbox": "^1.1.1", @@ -39,11 +38,8 @@ "@radix-ui/react-toggle": "^1.1.0", "@radix-ui/react-tooltip": "^1.1.2", "@reduxjs/toolkit": "^2.2.7", - "@tanstack/query-core": "^5.55.1", - "@tanstack/react-query": "^5.56.1", "@tauri-apps/api": "^1.2.0", "@traptitech/markdown-it-katex": "^3.6.0", - "boxicons": "^2.1.4", "class-variance-authority": "^0.7.0", "clipboard": "^2.0.11", "clsx": "^2.1.1", @@ -51,12 +47,6 @@ "date-fns": "^3.6.0", "gpt-tokenizer": "^2.2.1", "highlight.js": "^11.10.0", - "husky": "^9.1.6", - "immer": "^10.1.1", - "jotai": "^2.9.3", - "jotai-immer": "^0.4.1", - "jotai-tanstack-query": "^0.8.7", - "lodash": "^4.17.21", "lucide-react": "^0.436.0", "markdown-it": "^14.1.0", "markdown-it-highlightjs": "^4.1.0", @@ -67,7 +57,6 @@ "react-hook-form": "^7.53.0", "react-redux": "^9.1.2", "react-resizable-panels": "^2.1.2", - "react-svg": "^16.1.34", "redux": "^5.0.1", "redux-thunk": "^3.1.0", "tailwind-merge": "^2.5.2", @@ -77,10 +66,7 @@ "tauri-plugin-sql-api": "https://github.com/tauri-apps/tauri-plugin-sql", "tauri-plugin-store-api": "https://github.com/tauri-apps/tauri-plugin-store", "tauri-plugin-system-info-api": "^2.0.2", - "tauri-plugin-window-state-api": "https://github.com/tauri-apps/tauri-plugin-window-state", - "vaul": "^0.9.1", - "vite-plugin-svgr": "^4.2.0", - "zod": "^3.23.8" + "tauri-plugin-window-state-api": "https://github.com/tauri-apps/tauri-plugin-window-state" }, "devDependencies": { "@commitlint/config-conventional": "^19.5.0", @@ -94,6 +80,7 @@ "@vitejs/plugin-react": "^4.2.1", "autoprefixer": "^10.4.20", "commitlint": "^19.5.0", + "husky": "^9.1.6", "jsdom": "^25.0.0", "postcss": "^8.4.41", "sass-embedded": "^1.77.8", @@ -101,6 +88,7 @@ "toml": "^3.0.0", "typescript": "^5.2.2", "vite": "^5.3.1", + "vite-plugin-svgr": "^4.2.0", "vite-plugin-top-level-await": "^1.3.0", "vitest": "^2.0.5" } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5bb26b2..76e4dbc 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,9 +8,6 @@ importers: .: dependencies: - '@hookform/resolvers': - specifier: ^3.9.0 - version: 3.9.0(react-hook-form@7.53.0(react@18.3.1)) '@radix-ui/react-alert-dialog': specifier: ^1.1.1 version: 1.1.1(@types/react-dom@18.3.0)(@types/react@18.3.4)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) @@ -77,21 +74,12 @@ importers: '@reduxjs/toolkit': specifier: ^2.2.7 version: 2.2.7(react-redux@9.1.2(@types/react@18.3.4)(react@18.3.1)(redux@5.0.1))(react@18.3.1) - '@tanstack/query-core': - specifier: ^5.55.1 - version: 5.56.1 - '@tanstack/react-query': - specifier: ^5.56.1 - version: 5.56.1(react@18.3.1) '@tauri-apps/api': specifier: ^1.2.0 version: 1.6.0 '@traptitech/markdown-it-katex': specifier: ^3.6.0 version: 3.6.0 - boxicons: - specifier: ^2.1.4 - version: 2.1.4 class-variance-authority: specifier: ^0.7.0 version: 0.7.0 @@ -113,24 +101,6 @@ importers: highlight.js: specifier: ^11.10.0 version: 11.10.0 - husky: - specifier: ^9.1.6 - version: 9.1.6 - immer: - specifier: ^10.1.1 - version: 10.1.1 - jotai: - specifier: ^2.9.3 - version: 2.9.3(@types/react@18.3.4)(react@18.3.1) - jotai-immer: - specifier: ^0.4.1 - version: 0.4.1(immer@10.1.1)(jotai@2.9.3(@types/react@18.3.4)(react@18.3.1)) - jotai-tanstack-query: - specifier: ^0.8.7 - version: 0.8.7(@tanstack/query-core@5.56.1)(jotai@2.9.3(@types/react@18.3.4)(react@18.3.1)) - lodash: - specifier: ^4.17.21 - version: 4.17.21 lucide-react: specifier: ^0.436.0 version: 0.436.0(react@18.3.1) @@ -161,9 +131,6 @@ importers: react-resizable-panels: specifier: ^2.1.2 version: 2.1.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - react-svg: - specifier: ^16.1.34 - version: 16.1.34(react-dom@18.3.1(react@18.3.1))(react@18.3.1) redux: specifier: ^5.0.1 version: 5.0.1 @@ -194,15 +161,6 @@ importers: tauri-plugin-window-state-api: specifier: https://github.com/tauri-apps/tauri-plugin-window-state version: https://codeload.github.com/tauri-apps/tauri-plugin-window-state/tar.gz/aa0b2a9cbf96f87a172e999670be79c4bb5d67dd - vaul: - specifier: ^0.9.1 - version: 0.9.1(@types/react-dom@18.3.0)(@types/react@18.3.4)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - vite-plugin-svgr: - specifier: ^4.2.0 - version: 4.2.0(rollup@4.21.1)(vite@5.4.2(@types/node@18.19.47)(sass-embedded@1.77.8)) - zod: - specifier: ^3.23.8 - version: 3.23.8 devDependencies: '@commitlint/config-conventional': specifier: ^19.5.0 @@ -237,6 +195,9 @@ importers: commitlint: specifier: ^19.5.0 version: 19.5.0(@types/node@18.19.47)(typescript@5.5.4) + husky: + specifier: ^9.1.6 + version: 9.1.6 jsdom: specifier: ^25.0.0 version: 25.0.0 @@ -258,6 +219,9 @@ importers: vite: specifier: ^5.3.1 version: 5.4.2(@types/node@18.19.47)(sass-embedded@1.77.8) + vite-plugin-svgr: + specifier: ^4.2.0 + version: 4.2.0(rollup@4.21.1)(vite@5.4.2(@types/node@18.19.47)(sass-embedded@1.77.8)) vite-plugin-top-level-await: specifier: ^1.3.0 version: 1.4.4(rollup@4.21.1)(vite@5.4.2(@types/node@18.19.47)(sass-embedded@1.77.8)) @@ -591,11 +555,6 @@ packages: '@floating-ui/utils@0.2.7': resolution: {integrity: sha512-X8R8Oj771YRl/w+c1HqAC1szL8zWQRwFvgDwT129k9ACdBoud/+/rX9V0qiMl6LWUdP9voC2nDVZYPMQQsb6eA==} - '@hookform/resolvers@3.9.0': - resolution: {integrity: sha512-bU0Gr4EepJ/EQsH/IwEzYLsT/PEj5C0ynLQ4m+GSHS+xKH4TfSelhluTgOaoc4kA5s7eCsQbM4wvZLzELmWzUg==} - peerDependencies: - react-hook-form: ^7.0.0 - '@hutson/parse-repository-url@3.0.2': resolution: {integrity: sha512-H9XAx3hc0BQHY6l+IFSWHDySypcXsvsuLhgYLUGywmJ5pswRVQJUHpOsobnLYp2ZUaUlKiKDrgWWhosOwAEM8Q==, tarball: https://r2.cnpmjs.org/@hutson/parse-repository-url/-/parse-repository-url-3.0.2.tgz} engines: {node: '>=6.9.0'} @@ -1659,17 +1618,6 @@ packages: resolution: {integrity: sha512-+PmQX0PiAYPMeVYe237LJAYvOMYW1j2rH5YROyS3b4CTVJum34HfRvKvAzozHAQG0TnHNdUfY9nCeUyRAs//cw==} engines: {node: '>=14.16'} - '@tanem/svg-injector@10.1.68': - resolution: {integrity: sha512-UkJajeR44u73ujtr5GVSbIlELDWD/mzjqWe54YMK61ljKxFcJoPd9RBSaO7xj02ISCWUqJW99GjrS+sVF0UnrA==} - - '@tanstack/query-core@5.56.1': - resolution: {integrity: sha512-hH9LvpGCr3yKbHUgi2b+vOwx2pj4dMFnGY7Cjvrm5mOqynWPr015h/GCLiSi5M5JaXXnB8VnLOSLh5KzjBh5fA==} - - '@tanstack/react-query@5.56.1': - resolution: {integrity: sha512-jlRCrE1qXEVtJ0i/bubQpqoEuQQSfRo9O26tWciKmNMwg2oXp96+D7A/0sU52sjSTrcKIQE4o7dSlbOOTYKTIg==} - peerDependencies: - react: ^18 || ^19 - '@tauri-apps/api@1.6.0': resolution: {integrity: sha512-rqI++FWClU5I2UBp4HXFvl+sBWkdigBkxnpJDQUWttNyG7IZP4FwQGhTNL5EOw0vI8i6eSAJ5frLqO7n7jbJdg==} engines: {node: '>= 14.6.0', npm: '>= 6.6.0', yarn: '>= 1.19.1'} @@ -1823,9 +1771,6 @@ packages: '@vitest/utils@2.0.5': resolution: {integrity: sha512-d8HKbqIcya+GR67mkZbrzhS5kKhtp8dQLcmRZLGTscGVg7yImT82cIrhtn2L8+VujWcy6KZweApgNmPsTAO/UQ==} - '@webcomponents/webcomponentsjs@2.8.0': - resolution: {integrity: sha512-loGD63sacRzOzSJgQnB9ZAhaQGkN7wl2Zuw7tsphI5Isa0irijrRo6EnJii/GgjGefIFO8AIO7UivzRhFaEk9w==} - JSONStream@1.3.5: resolution: {integrity: sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ==, tarball: https://r2.cnpmjs.org/JSONStream/-/JSONStream-1.3.5.tgz} hasBin: true @@ -1968,9 +1913,6 @@ packages: resolution: {integrity: sha512-2hCgjEmP8YLWQ130n2FerGv7rYpfBmnmp9Uy2Le1vge6X3gZIfSmEzP5QTDElFxcvVcXlEn8Aq6MU/PZygIOog==} engines: {node: '>=14.16'} - boxicons@2.1.4: - resolution: {integrity: sha512-BvJNfYfnE4g9WQ7GL91fftxMOTwAleWlPFwvQJPYb/Ju7aLjlQ/Eu55AH9JLNk/OR82z+ZSq4TbKzbV/e5Rr0A==} - bplist-parser@0.2.0: resolution: {integrity: sha512-z0M+byMThzQmD9NILRniCUXYsYpjwnlO8N5uCFaCqIOpqRsJCrQL9NK3JsD67CN5a08nF5oIL2bD6loTdHOuKw==} engines: {node: '>= 5.10.0'} @@ -2182,10 +2124,6 @@ packages: resolution: {integrity: sha512-cD31W1v3GqUlQvbBCGcXmd2Nj9SvLDOP1oQ0YFuLETufzSPaKp11rYBsSOm7rCsW3OnIRAFM3OxRhceaXNYHkA==} engines: {node: '>=12'} - content-type@1.0.5: - resolution: {integrity: sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==} - engines: {node: '>= 0.6'} - conventional-changelog-angular@5.0.13: resolution: {integrity: sha512-i/gipMxs7s8L/QeuavPF2hLnJgH6pEZAttySB6aiQLWcX3puWDL3ACVmvBhJGxnAy52Qc15ua26BufY6KpmrVA==, tarball: https://r2.cnpmjs.org/conventional-changelog-angular/-/conventional-changelog-angular-5.0.13.tgz} engines: {node: '>=10'} @@ -2427,24 +2365,9 @@ packages: deprecation@2.3.1: resolution: {integrity: sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==} - detect-hover@1.0.3: - resolution: {integrity: sha512-HtLoY+tClgYucJNiovNICGWFp9nOGVmHY44s7L62iPqORXM9vujeWFaVcqtA7XRvp/2Y+4RBUfHbDKFGN+xxZQ==, tarball: https://r2.cnpmjs.org/detect-hover/-/detect-hover-1.0.3.tgz} - - detect-it@3.0.7: - resolution: {integrity: sha512-RxpgcdbatUX6epJE09K16iJqF7x6iEcEdoL18FR2zpBO4JhnL7aMOAUoUEyexdtbWOSfTmoDWmeD6mwRBQyRXg==, tarball: https://r2.cnpmjs.org/detect-it/-/detect-it-3.0.7.tgz} - detect-node-es@1.1.0: resolution: {integrity: sha512-ypdmJU/TbBby2Dxibuv7ZLW3Bs1QEmM7nHjEANfohJLvE0XVujisn1qPJcZxg+qDucsr+bP6fLD1rPS3AhJ7EQ==} - detect-passive-events@1.0.5: - resolution: {integrity: sha512-foW7Q35wwOCxVzW0xLf5XeB5Fhe7oyRgvkBYdiP9IWgLMzjqUqTvsJv9ymuEWGjY6AoDXD3OC294+Z9iuOw0QA==, tarball: https://r2.cnpmjs.org/detect-passive-events/-/detect-passive-events-1.0.5.tgz} - - detect-pointer@1.0.3: - resolution: {integrity: sha512-d0o/Puo3fiGSCXy6H039h9Kwz+mmYCGKZ/qtPFnpN3WfsumjC1C9b5KKvRu+aYnfdI8peqN/iAe7dPd85qIt2g==, tarball: https://r2.cnpmjs.org/detect-pointer/-/detect-pointer-1.0.3.tgz} - - detect-touch-events@2.0.2: - resolution: {integrity: sha512-g8GWBkJLiIDRJfRXEdrd1wMXpNyGId2DkbfuwFahSb4OCvn717hyRJtAcEDISfp3zkwEhZ4Y4woHPA6DeyB3Fw==, tarball: https://r2.cnpmjs.org/detect-touch-events/-/detect-touch-events-2.0.2.tgz} - didyoumean@1.2.2: resolution: {integrity: sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==, tarball: https://r2.cnpmjs.org/didyoumean/-/didyoumean-1.2.2.tgz} @@ -2834,12 +2757,6 @@ packages: resolution: {integrity: sha512-SYVnVFswQER+zu1laSya563s+F8VDGt7o35d4utbamowvUNLLMovFqwCLSocpZTz3MgaSRA1IbqRWZv97dtErQ==} engines: {node: '>=12.0.0'} - history@4.10.1: - resolution: {integrity: sha512-36nwAD620w12kuzPAsyINPWJqlNbij+hpK1k9XRloDtym8mxzGYl2c17LnV6IAGB2Dmg4tEa7G7DlawS0+qjew==, tarball: https://r2.cnpmjs.org/history/-/history-4.10.1.tgz} - - hoist-non-react-statics@2.5.5: - resolution: {integrity: sha512-rqcy4pJo55FTTLWt+bU8ukscqHeE/e9KWvsOW2b/a3afxQZhwkQdT1rPPCJ0rYXdj4vNcasY8zHTH+jF/qStxw==, tarball: https://r2.cnpmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-2.5.5.tgz} - hosted-git-info@2.8.9: resolution: {integrity: sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==, tarball: https://r2.cnpmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz} @@ -3148,9 +3065,6 @@ packages: resolution: {integrity: sha512-/kppl+R+LO5VmhYSEWARUFjodS25D68gvj8W7z0I7OWhUla5xWu8KL6CtB2V0R6yqhnRgbcaREMr4EEM6htLPQ==} engines: {node: '>=12'} - isarray@0.0.1: - resolution: {integrity: sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ==, tarball: https://r2.cnpmjs.org/isarray/-/isarray-0.0.1.tgz} - isarray@1.0.0: resolution: {integrity: sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==, tarball: https://r2.cnpmjs.org/isarray/-/isarray-1.0.0.tgz} @@ -3177,30 +3091,6 @@ packages: resolution: {integrity: sha512-2yTgeWTWzMWkHu6Jp9NKgePDaYHbntiwvYuuJLbbN9vl7DC9DvXKOB2BC3ZZ92D3cvV/aflH0osDfwpHepQ53w==} hasBin: true - jotai-immer@0.4.1: - resolution: {integrity: sha512-nQTt1HBKie/5OJDck1qLpV1PeBA6bjJLAczEYAx70PD8R4Mbu7gtexfBUCzJh6W6ecsOfwHksAYAesVth6SN9A==} - peerDependencies: - immer: '>=9.0.0' - jotai: '>=2.0.0' - - jotai-tanstack-query@0.8.7: - resolution: {integrity: sha512-ZDY1+FSpJFVvySklFp+WscJAkhRmWq9O2XVPybd4iSav5krOh4poYnJFWIlGZ1vr6mHRoJoGcl5+vlS8mFRvPQ==} - peerDependencies: - '@tanstack/query-core': '*' - jotai: '>=2.0.0' - - jotai@2.9.3: - resolution: {integrity: sha512-IqMWKoXuEzWSShjd9UhalNsRGbdju5G2FrqNLQJT+Ih6p41VNYe2sav5hnwQx4HJr25jq9wRqvGSWGviGG6Gjw==} - engines: {node: '>=12.20.0'} - peerDependencies: - '@types/react': '>=17.0.0' - react: '>=17.0.0' - peerDependenciesMeta: - '@types/react': - optional: true - react: - optional: true - js-tokens@4.0.0: resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==, tarball: https://r2.cnpmjs.org/js-tokens/-/js-tokens-4.0.0.tgz} @@ -3723,9 +3613,6 @@ packages: resolution: {integrity: sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==} engines: {node: '>=16 || 14 >=14.18'} - path-to-regexp@1.8.0: - resolution: {integrity: sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA==, tarball: https://r2.cnpmjs.org/path-to-regexp/-/path-to-regexp-1.8.0.tgz} - path-type@3.0.0: resolution: {integrity: sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==, tarball: https://r2.cnpmjs.org/path-type/-/path-type-3.0.0.tgz} engines: {node: '>=4'} @@ -3816,9 +3703,6 @@ packages: resolution: {integrity: sha512-22wJUOD3zswWFqgwjNHa1965LvqTX87WPu/lreY2KSd7SVcERfuZ4GfUaOnJNnvtoIv2yXT/W00YIGMetXtFXg==} engines: {node: '>= 0.4'} - prop-types@15.8.1: - resolution: {integrity: sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==} - proto-list@1.2.4: resolution: {integrity: sha512-vtK/94akxsTMhe0/cbfpR+syPuszcuwhqVjJq26CuNDgFGj682oRBXOP5MJpv2r7JtE8MsiepGIqvvOTBwn2vA==} @@ -3879,11 +3763,6 @@ packages: date-fns: ^2.28.0 || ^3.0.0 react: ^16.8.0 || ^17.0.0 || ^18.0.0 - react-dom@16.14.0: - resolution: {integrity: sha512-1gCeQXDLoIqMgqD3IO2Ah9bnf0w9kzhwN5q4FGnHZ67hBm9yePzB5JJAIQCc8x3pFnNlwFq4RidZggNAAkzWWw==, tarball: https://r2.cnpmjs.org/react-dom/-/react-dom-16.14.0.tgz} - peerDependencies: - react: ^16.14.0 - react-dom@18.3.1: resolution: {integrity: sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==} peerDependencies: @@ -3895,14 +3774,6 @@ packages: peerDependencies: react: ^16.8.0 || ^17 || ^18 || ^19 - react-interactive@0.8.3: - resolution: {integrity: sha512-mmRvA9aKP7zu9kVfP1AX1egX8tFlnE3DDXq92z0JTZezfOpmeQBzr77O1+mTV54OOmn+M2t6c5kFD5VnuFoM7A==, tarball: https://r2.cnpmjs.org/react-interactive/-/react-interactive-0.8.3.tgz} - peerDependencies: - react: '>=15' - - react-is@16.13.1: - resolution: {integrity: sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==, tarball: https://r2.cnpmjs.org/react-is/-/react-is-16.13.1.tgz} - react-redux@9.1.2: resolution: {integrity: sha512-0OA4dhM1W48l3uzmv6B7TXPCGmokUU4p1M44DGN2/D9a1FjVPukVjER1PcPX97jIg6aUeLq1XJo1IpfbgULn0w==} peerDependencies: @@ -3955,16 +3826,6 @@ packages: react: ^16.14.0 || ^17.0.0 || ^18.0.0 react-dom: ^16.14.0 || ^17.0.0 || ^18.0.0 - react-router-dom@4.3.1: - resolution: {integrity: sha512-c/MlywfxDdCp7EnB7YfPMOfMD3tOtIjrQlj/CKfNMBxdmpJP8xcz5P/UAFn3JbnQCNUxsHyVVqllF9LhgVyFCA==, tarball: https://r2.cnpmjs.org/react-router-dom/-/react-router-dom-4.3.1.tgz} - peerDependencies: - react: '>=15' - - react-router@4.3.1: - resolution: {integrity: sha512-yrvL8AogDh2X42Dt9iknk4wF4V8bWREPirFfS9gLU1huk6qK41sg7Z/1S81jjTrGHxa3B8R3J6xIkDAA6CVarg==, tarball: https://r2.cnpmjs.org/react-router/-/react-router-4.3.1.tgz} - peerDependencies: - react: '>=15' - react-style-singleton@2.2.1: resolution: {integrity: sha512-ZWj0fHEMyWkHzKYUr2Bs/4zU6XLmq9HsgBURm7g5pAVfyn49DgUiNgY2d4lXRlYSiCif9YBGpQleewkcqddc7g==} engines: {node: '>=10'} @@ -3975,16 +3836,6 @@ packages: '@types/react': optional: true - react-svg@16.1.34: - resolution: {integrity: sha512-L4ak1qNFLgzVbHm0xQEpHoIOqb3um/B0ybahd3U2TKoGZxb0JaPVI5lsAhvSng2P1kcsYEok2Z7RpcKx7arJGw==} - peerDependencies: - react: ^16.0.0 || ^17.0.0 || ^18.0.0 - react-dom: ^16.0.0 || ^17.0.0 || ^18.0.0 - - react@16.14.0: - resolution: {integrity: sha512-0X2CImDkJGApiAlcf0ODKIneSwBPhqJawOa5wCtKbu7ZECrmS26NvtSILynQ66cgkT/RJ4LidJOc3bUESwmU8g==, tarball: https://r2.cnpmjs.org/react/-/react-16.14.0.tgz} - engines: {node: '>=0.10.0'} - react@18.3.1: resolution: {integrity: sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==} engines: {node: '>=0.10.0'} @@ -4080,9 +3931,6 @@ packages: resolution: {integrity: sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==} engines: {node: '>=8'} - resolve-pathname@3.0.0: - resolution: {integrity: sha512-C7rARubxI8bXFNB/hqcp/4iUeIXJhJZvFPFPiSPRnhU5UPxzMFIl+2E6yY6c4k9giDJAhtV+enfA+G89N6Csng==, tarball: https://r2.cnpmjs.org/resolve-pathname/-/resolve-pathname-3.0.0.tgz} - resolve@1.22.8: resolution: {integrity: sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==} hasBin: true @@ -4275,9 +4123,6 @@ packages: resolution: {integrity: sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==, tarball: https://r2.cnpmjs.org/saxes/-/saxes-6.0.0.tgz} engines: {node: '>=v12.22.7'} - scheduler@0.19.1: - resolution: {integrity: sha512-n/zwRWRYSUj0/3g/otKDRPMh6qv2SYMWNq85IEa8iZyAv8od9zDYpGSnpBEjNgcMNq6Scbu5KfIPxNF72R/2EA==, tarball: https://r2.cnpmjs.org/scheduler/-/scheduler-0.19.1.tgz} - scheduler@0.23.2: resolution: {integrity: sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==} @@ -4555,12 +4400,6 @@ packages: tiny-emitter@2.1.0: resolution: {integrity: sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q==, tarball: https://r2.cnpmjs.org/tiny-emitter/-/tiny-emitter-2.1.0.tgz} - tiny-invariant@1.3.3: - resolution: {integrity: sha512-+FbBPE1o9QAYvviau/qC5SE3caw21q3xkvWKBtja5vgqOWIHHJ3ioaq1VPfn/Szqctz2bU/oYeKd9/z5BL+PVg==} - - tiny-warning@1.0.3: - resolution: {integrity: sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA==, tarball: https://r2.cnpmjs.org/tiny-warning/-/tiny-warning-1.0.3.tgz} - tinybench@2.9.0: resolution: {integrity: sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==} @@ -4766,18 +4605,9 @@ packages: validate-npm-package-license@3.0.4: resolution: {integrity: sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==, tarball: https://r2.cnpmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz} - value-equal@1.0.1: - resolution: {integrity: sha512-NOJ6JZCAWr0zlxZt+xqCHNTEKOsrks2HQd4MqhP1qy4z1SkbEP467eNx6TgDKXMvUOb+OENfJCZwM+16n7fRfw==, tarball: https://r2.cnpmjs.org/value-equal/-/value-equal-1.0.1.tgz} - varint@6.0.0: resolution: {integrity: sha512-cXEIW6cfr15lFv563k4GuVuW/fiwjknytD37jIOLSdSWuOI6WnO/oKwmP2FQTU2l01LP8/M5TSAJpzUaGe3uWg==, tarball: https://r2.cnpmjs.org/varint/-/varint-6.0.0.tgz} - vaul@0.9.1: - resolution: {integrity: sha512-fAhd7i4RNMinx+WEm6pF3nOl78DFkAazcN04ElLPFF9BMCNGbY/kou8UMhIcicm0rJCNePJP0Yyza60gGOD0Jw==} - peerDependencies: - react: ^16.8 || ^17.0 || ^18.0 - react-dom: ^16.8 || ^17.0 || ^18.0 - vite-node@2.0.5: resolution: {integrity: sha512-LdsW4pxj0Ot69FAoXZ1yTnA9bjGohr2yNBU7QKRxpz8ITSkhuDl6h3zS/tvgz4qrNjeRnvrWeXQ8ZF7Um4W00Q==} engines: {node: ^18.0.0 || >=20.0.0} @@ -4859,9 +4689,6 @@ packages: resolution: {integrity: sha512-o8qghlI8NZHU1lLPrpi2+Uq7abh4GGPpYANlalzWxyWteJOCsr/P+oPBA49TOLu5FTZO4d3F9MnWJfiMo4BkmA==} engines: {node: '>=18'} - warning@4.0.3: - resolution: {integrity: sha512-rpJyN222KWIvHJ/F53XSZv0Zl/accqHR8et1kpaMTD/fLCRxtV8iX8czMzY7sVZupTI3zcUTg8eycS2kNF9l6w==, tarball: https://r2.cnpmjs.org/warning/-/warning-4.0.3.tgz} - wcwidth@1.0.1: resolution: {integrity: sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==} @@ -5006,9 +4833,6 @@ packages: resolution: {integrity: sha512-b4JR1PFR10y1mKjhHY9LaGo6tmrgjit7hxVIeAmyMw3jegXR4dhYqLaQF5zMXZxY7tLpMyJeLjr1C4rLmkVe8g==} engines: {node: '>=12.20'} - zod@3.23.8: - resolution: {integrity: sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==} - snapshots: '@alloc/quick-lru@5.2.0': {} @@ -5344,10 +5168,6 @@ snapshots: '@floating-ui/utils@0.2.7': {} - '@hookform/resolvers@3.9.0(react-hook-form@7.53.0(react@18.3.1))': - dependencies: - react-hook-form: 7.53.0(react@18.3.1) - '@hutson/parse-repository-url@3.0.2': {} '@iarna/toml@2.2.5': {} @@ -6391,19 +6211,6 @@ snapshots: dependencies: defer-to-connect: 2.0.1 - '@tanem/svg-injector@10.1.68': - dependencies: - '@babel/runtime': 7.25.6 - content-type: 1.0.5 - tslib: 2.7.0 - - '@tanstack/query-core@5.56.1': {} - - '@tanstack/react-query@5.56.1(react@18.3.1)': - dependencies: - '@tanstack/query-core': 5.56.1 - react: 18.3.1 - '@tauri-apps/api@1.6.0': {} '@tauri-apps/api@2.0.0-rc.4': {} @@ -6560,8 +6367,6 @@ snapshots: loupe: 3.1.1 tinyrainbow: 1.2.0 - '@webcomponents/webcomponentsjs@2.8.0': {} - JSONStream@1.3.5: dependencies: jsonparse: 1.3.1 @@ -6715,15 +6520,6 @@ snapshots: widest-line: 4.0.1 wrap-ansi: 8.1.0 - boxicons@2.1.4: - dependencies: - '@webcomponents/webcomponentsjs': 2.8.0 - prop-types: 15.8.1 - react: 16.14.0 - react-dom: 16.14.0(react@16.14.0) - react-interactive: 0.8.3(react@16.14.0) - react-router-dom: 4.3.1(react@16.14.0) - bplist-parser@0.2.0: dependencies: big-integer: 1.6.52 @@ -6954,8 +6750,6 @@ snapshots: write-file-atomic: 3.0.3 xdg-basedir: 5.1.0 - content-type@1.0.5: {} - conventional-changelog-angular@5.0.13: dependencies: compare-func: 2.0.0 @@ -7229,23 +7023,8 @@ snapshots: deprecation@2.3.1: {} - detect-hover@1.0.3: {} - - detect-it@3.0.7: - dependencies: - detect-hover: 1.0.3 - detect-passive-events: 1.0.5 - detect-pointer: 1.0.3 - detect-touch-events: 2.0.2 - detect-node-es@1.1.0: {} - detect-passive-events@1.0.5: {} - - detect-pointer@1.0.3: {} - - detect-touch-events@2.0.2: {} - didyoumean@1.2.2: {} dir-glob@3.0.1: @@ -7752,17 +7531,6 @@ snapshots: highlight.js@11.10.0: {} - history@4.10.1: - dependencies: - '@babel/runtime': 7.25.6 - loose-envify: 1.4.0 - resolve-pathname: 3.0.0 - tiny-invariant: 1.3.3 - tiny-warning: 1.0.3 - value-equal: 1.0.1 - - hoist-non-react-statics@2.5.5: {} - hosted-git-info@2.8.9: {} hosted-git-info@4.1.0: @@ -8026,8 +7794,6 @@ snapshots: is-yarn-global@0.4.1: {} - isarray@0.0.1: {} - isarray@1.0.0: {} isarray@2.0.5: {} @@ -8057,21 +7823,6 @@ snapshots: jiti@1.21.6: {} - jotai-immer@0.4.1(immer@10.1.1)(jotai@2.9.3(@types/react@18.3.4)(react@18.3.1)): - dependencies: - immer: 10.1.1 - jotai: 2.9.3(@types/react@18.3.4)(react@18.3.1) - - jotai-tanstack-query@0.8.7(@tanstack/query-core@5.56.1)(jotai@2.9.3(@types/react@18.3.4)(react@18.3.1)): - dependencies: - '@tanstack/query-core': 5.56.1 - jotai: 2.9.3(@types/react@18.3.4)(react@18.3.1) - - jotai@2.9.3(@types/react@18.3.4)(react@18.3.1): - optionalDependencies: - '@types/react': 18.3.4 - react: 18.3.1 - js-tokens@4.0.0: {} js-yaml@4.1.0: @@ -8584,10 +8335,6 @@ snapshots: lru-cache: 10.4.3 minipass: 7.1.2 - path-to-regexp@1.8.0: - dependencies: - isarray: 0.0.1 - path-type@3.0.0: dependencies: pify: 3.0.0 @@ -8660,12 +8407,6 @@ snapshots: get-intrinsic: 1.2.4 iterate-value: 1.0.2 - prop-types@15.8.1: - dependencies: - loose-envify: 1.4.0 - object-assign: 4.1.1 - react-is: 16.13.1 - proto-list@1.2.4: {} protocols@2.0.1: {} @@ -8717,14 +8458,6 @@ snapshots: date-fns: 3.6.0 react: 18.3.1 - react-dom@16.14.0(react@16.14.0): - dependencies: - loose-envify: 1.4.0 - object-assign: 4.1.1 - prop-types: 15.8.1 - react: 16.14.0 - scheduler: 0.19.1 - react-dom@18.3.1(react@18.3.1): dependencies: loose-envify: 1.4.0 @@ -8735,15 +8468,6 @@ snapshots: dependencies: react: 18.3.1 - react-interactive@0.8.3(react@16.14.0): - dependencies: - detect-it: 3.0.7 - object-assign: 4.1.1 - prop-types: 15.8.1 - react: 16.14.0 - - react-is@16.13.1: {} - react-redux@9.1.2(@types/react@18.3.4)(react@18.3.1)(redux@5.0.1): dependencies: '@types/use-sync-external-store': 0.0.3 @@ -8790,27 +8514,6 @@ snapshots: react: 18.3.1 react-dom: 18.3.1(react@18.3.1) - react-router-dom@4.3.1(react@16.14.0): - dependencies: - history: 4.10.1 - invariant: 2.2.4 - loose-envify: 1.4.0 - prop-types: 15.8.1 - react: 16.14.0 - react-router: 4.3.1(react@16.14.0) - warning: 4.0.3 - - react-router@4.3.1(react@16.14.0): - dependencies: - history: 4.10.1 - hoist-non-react-statics: 2.5.5 - invariant: 2.2.4 - loose-envify: 1.4.0 - path-to-regexp: 1.8.0 - prop-types: 15.8.1 - react: 16.14.0 - warning: 4.0.3 - react-style-singleton@2.2.1(@types/react@18.3.4)(react@18.3.1): dependencies: get-nonce: 1.0.1 @@ -8820,21 +8523,6 @@ snapshots: optionalDependencies: '@types/react': 18.3.4 - react-svg@16.1.34(react-dom@18.3.1(react@18.3.1))(react@18.3.1): - dependencies: - '@babel/runtime': 7.25.6 - '@tanem/svg-injector': 10.1.68 - '@types/prop-types': 15.7.12 - prop-types: 15.8.1 - react: 18.3.1 - react-dom: 18.3.1(react@18.3.1) - - react@16.14.0: - dependencies: - loose-envify: 1.4.0 - object-assign: 4.1.1 - prop-types: 15.8.1 - react@18.3.1: dependencies: loose-envify: 1.4.0 @@ -8966,8 +8654,6 @@ snapshots: resolve-from@5.0.0: {} - resolve-pathname@3.0.0: {} - resolve@1.22.8: dependencies: is-core-module: 2.15.1 @@ -9135,11 +8821,6 @@ snapshots: dependencies: xmlchars: 2.2.0 - scheduler@0.19.1: - dependencies: - loose-envify: 1.4.0 - object-assign: 4.1.1 - scheduler@0.23.2: dependencies: loose-envify: 1.4.0 @@ -9439,10 +9120,6 @@ snapshots: tiny-emitter@2.1.0: {} - tiny-invariant@1.3.3: {} - - tiny-warning@1.0.3: {} - tinybench@2.9.0: {} tinyexec@0.3.0: {} @@ -9630,19 +9307,8 @@ snapshots: spdx-correct: 3.2.0 spdx-expression-parse: 3.0.1 - value-equal@1.0.1: {} - varint@6.0.0: {} - vaul@0.9.1(@types/react-dom@18.3.0)(@types/react@18.3.4)(react-dom@18.3.1(react@18.3.1))(react@18.3.1): - dependencies: - '@radix-ui/react-dialog': 1.1.1(@types/react-dom@18.3.0)(@types/react@18.3.4)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - react: 18.3.1 - react-dom: 18.3.1(react@18.3.1) - transitivePeerDependencies: - - '@types/react' - - '@types/react-dom' - vite-node@2.0.5(@types/node@18.19.47)(sass-embedded@1.77.8): dependencies: cac: 6.7.14 @@ -9734,10 +9400,6 @@ snapshots: dependencies: xml-name-validator: 5.0.0 - warning@4.0.3: - dependencies: - loose-envify: 1.4.0 - wcwidth@1.0.1: dependencies: defaults: 1.0.4 @@ -9873,5 +9535,3 @@ snapshots: yargs-parser: 21.1.1 yocto-queue@1.1.1: {} - - zod@3.23.8: {} diff --git a/src/TabSettings.tsx b/src/TabSettings.tsx deleted file mode 100644 index 5088286..0000000 --- a/src/TabSettings.tsx +++ /dev/null @@ -1,254 +0,0 @@ -import { zodResolver } from "@hookform/resolvers/zod" -import { useForm } from "react-hook-form" -import { z } from "zod" - -import { - Checkbox, - Button, - Form, - FormControl, - FormDescription, - FormField, - FormItem, - FormLabel, - Switch, - Input, - toast -} from "@/components/ui" - -const notificationsFormSchema = z.object({ - type: z.enum(["all", "mentions", "none"], { - required_error: "You need to select a notification type.", - }), - mobile: z.boolean().default(false).optional(), - communication_emails: z.boolean().default(false).optional(), - social_emails: z.boolean().default(false).optional(), - marketing_emails: z.boolean().default(false).optional(), - security_emails: z.boolean(), -}) - -type NotificationsFormValues = z.infer - -// This can come from your database or API. -const defaultValues: Partial = { - communication_emails: false, - marketing_emails: false, - social_emails: true, - security_emails: true, -} - -export default function Gear() { - const form = useForm({ - resolver: zodResolver(notificationsFormSchema), - defaultValues, - }) - - function onSubmit(data: NotificationsFormValues) { - toast({ - title: "You submitted the following values:", - description: ( -
-          {JSON.stringify(data, null, 2)}
-        
- ), - }) - } - - return ( -
-

设置 | Settings

-
- -
-
-
模型设置
- ( - -
- - API请求域名 - - - API 服务请求的域名,https:// http:// 协议开头 - -
-
- - - -
-
- )} - /> - - ( - -
- - API请求路径 - - - API 服务请求的 path - -
-
- - - -
-
- )} - /> - - - ( - -
- - API Key - - - API 请求授权 Key - -
-
- - - -
-
- )} - /> - - ( - -
- - 显示对话时间 - - - 在聊天气泡框边上显示对话时间 - -
- - - -
- )} - /> - ( - -
- - 上下文记忆 - - - 对话时将把当前会话的前后上下文问题记住,用于开启多轮对话(会消耗大量Token) - -
- - - -
- )} - /> - ( - -
- Token 用量 - - 展示当前问题的Token预计消耗情况 - -
- - - -
- )} - /> - ( - -
- Security emails - - Receive emails about your account activity and security. - -
- - - -
- )} - /> -
-
- ( - - - - -
- - Use different settings for my mobile devices - - - You can manage your mobile notifications in the{" "} - - -
-
- )} - /> -
- - -
- - - -
- - - ) -} \ No newline at end of file diff --git a/src/api/prompt.ts b/src/api/prompt.ts index 81621fe..872c497 100644 --- a/src/api/prompt.ts +++ b/src/api/prompt.ts @@ -6,8 +6,6 @@ import { } from "@/rust-bindings"; import { Prompt } from "@/rust-bindings"; -import { debounce } from "lodash"; - import { Logger } from "@/lib/log"; const logger = new Logger("prompt.ts"); /** diff --git a/src/components/custom/prompt/Prompt.tsx b/src/components/custom/prompt/Prompt.tsx index 1b0b434..0da7590 100644 --- a/src/components/custom/prompt/Prompt.tsx +++ b/src/components/custom/prompt/Prompt.tsx @@ -52,7 +52,7 @@ export function Prompt() { direction="horizontal" className="h-full items-stretch" > - +

Prompts

diff --git a/src/components/custom/prompt/components/PromptContent.tsx b/src/components/custom/prompt/components/PromptContent.tsx index 5c2efe7..3339b9d 100644 --- a/src/components/custom/prompt/components/PromptContent.tsx +++ b/src/components/custom/prompt/components/PromptContent.tsx @@ -83,7 +83,7 @@ export function PromptContent() {
- diff --git a/src/components/custom/prompt/components/PromptMeta.tsx b/src/components/custom/prompt/components/PromptMeta.tsx index a335b47..d82772b 100644 --- a/src/components/custom/prompt/components/PromptMeta.tsx +++ b/src/components/custom/prompt/components/PromptMeta.tsx @@ -1,7 +1,6 @@ import { Input, Separator } from "@/components/ui"; import { useAppSelector, useAppDispatch } from "@/hooks/use-state"; import { updateSelectPrompt } from "@/store/prompts"; -import { useState, useEffect } from "react"; export function PromptMeta() { const selectedPrompt = useAppSelector( diff --git a/src/components/custom/prompt/components/PromptToolbar.tsx b/src/components/custom/prompt/components/PromptToolbar.tsx index e756286..b7552b8 100644 --- a/src/components/custom/prompt/components/PromptToolbar.tsx +++ b/src/components/custom/prompt/components/PromptToolbar.tsx @@ -2,7 +2,6 @@ import { Star, StarOff, Copy, - DownloadCloud, Tag, Trash, Check, @@ -13,7 +12,6 @@ import { Tooltip, TooltipContent, TooltipTrigger, - Input, } from "@/components/ui"; import { ask } from "@tauri-apps/api/dialog"; @@ -29,7 +27,6 @@ import { } from "@/store/prompts"; export function PromptToolbar() { - const dispatch = useAppDispatch(); const prompts = useAppSelector((state) => state.prompts.prompts); @@ -137,23 +134,6 @@ export function PromptToolbar() { 添加标签 -
- -
- - - - - - 下载 - @@ -170,7 +150,9 @@ export function PromptToolbar() { 删除 +
+
))} diff --git a/src/components/custom/settings/settings.tsx b/src/components/custom/settings/settings.tsx index 2a9e208..2288d74 100644 --- a/src/components/custom/settings/settings.tsx +++ b/src/components/custom/settings/settings.tsx @@ -6,14 +6,14 @@ import { import { TooltipProvider } from "@/components/ui/tooltip"; import { SettingsNav } from "@/components/custom/settings/settings-nav"; -import { useSettingsNavigator } from "@/hooks/use-settings-nav"; import ModelSettings from "@/components/custom/settings/settings-model"; import AppSettings from "@/components/custom/settings/settings-app"; import AboutSettings from "@/components/custom/settings/settings-about"; +import { useAppSelector } from "@/hooks/use-state"; export default function Prompt() { - const [settingsLinkConfig, _] = useSettingsNavigator(); + const settingsLinkConfig = useAppSelector((state) => state.settingNav); return ( = ({ - iconName, - size = 24, - color = "#000", -}) => { - return ( - - ); -}; - -export { BoxIcon }; diff --git a/src/components/ui/index.tsx b/src/components/ui/index.tsx index f1fbd1f..237a6ff 100644 --- a/src/components/ui/index.tsx +++ b/src/components/ui/index.tsx @@ -4,7 +4,6 @@ export * from "./avatar" export * from "./tabs" export * from "./scroll-area" export * from "./separator" -export * from "./box-icon" export * from "./form" export * from "./toast" export * from "./toaster" diff --git a/src/hooks/use-conversation.tsx b/src/hooks/use-conversation.tsx index 0ebfd59..c5bcace 100644 --- a/src/hooks/use-conversation.tsx +++ b/src/hooks/use-conversation.tsx @@ -12,7 +12,6 @@ import { import { chatWithOpenAI } from "@/api/openai"; import { debounce, random_id } from "@/lib/utils"; -import { produce } from "immer"; import { useAppDispatch, useAppSelector } from "@/hooks/use-state"; import { asyncPromptActiveFetch } from "@/store/prompts"; @@ -78,13 +77,14 @@ export function useConversation() { const insertedConv = await insertSession(newConv); - setConverList( - produce((draft) => { - draft.unshift(insertedConv); - // 要放在这个函数里面 - handleSelectConver(insertedConv.id); - }) - ); + setConverList((draft) => { + handleSelectConver(insertedConv.id); + if (draft.length === 0) { + return [insertedConv]; + } else { + return [insertedConv, ...draft]; + } + }); }; /** diff --git a/src/hooks/use-settings-nav.tsx b/src/hooks/use-settings-nav.tsx deleted file mode 100644 index 9125181..0000000 --- a/src/hooks/use-settings-nav.tsx +++ /dev/null @@ -1,37 +0,0 @@ -import { LucideIcon, Brain, AppWindow, CircleHelp } from "lucide-react"; - -import { atom, useAtom } from "jotai"; - -declare type LinkItem = { - id: number; - title: string; - icon: LucideIcon; -}; - -const links: LinkItem[] = [ - { - id: 0, - title: "模型设置", - icon: Brain, - }, - - { - id: 1, - title: "外观设置", - icon: AppWindow, - }, - { - id: 2, - title: "帮助关于", - icon: CircleHelp, - }, -]; - -const settingsNavConfig = atom({ - links, - selected: 0, -}); - -export function useSettingsNavigator() { - return useAtom(settingsNavConfig); -} diff --git a/src/store/index.ts b/src/store/index.ts index 29e6fc2..3e68257 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -1,13 +1,15 @@ import { configureStore, ThunkAction, Action } from "@reduxjs/toolkit"; import navigatorReducer from "./navigator"; import promptsReducer from "./prompts"; -import appCinfigReducer from "./app-config" +import appCinfigReducer from "./app-config"; +import settingsNav from "./settings-nav"; const store = configureStore({ reducer: { navigator: navigatorReducer, prompts: promptsReducer, appConfig: appCinfigReducer, + settingNav: settingsNav, }, }); diff --git a/src/store/settings-nav/index.ts b/src/store/settings-nav/index.ts new file mode 100644 index 0000000..c87721c --- /dev/null +++ b/src/store/settings-nav/index.ts @@ -0,0 +1,49 @@ +import { createSlice } from "@reduxjs/toolkit"; + +export type NavigatorTabTypes = "chat" | "prompt" | "settings" | "debug"; + +declare type LinkItem = { + id: number; + title: string; + icon: string; +}; + +const links: LinkItem[] = [ + { + id: 0, + title: "模型设置", + icon: "Brain", + }, + + { + id: 1, + title: "外观设置", + icon: "AppWindow", + }, + { + id: 2, + title: "帮助关于", + icon: "CircleHelp", + }, +]; + +const settingsNavConfig = { + links, + selected: 0, +}; + +const settingsNav = createSlice({ + name: "settings-nav", + initialState: settingsNavConfig, + reducers: { + setSettingsNav: (state, action) => { + console.log("update config", { prev: state, next: action.payload }); + return action.payload; + }, + }, + extraReducers(_builder) {}, +}); + +export const { setSettingsNav } = settingsNav.actions; +// default reducer +export default settingsNav.reducer; diff --git a/vite.config.ts b/vite.config.ts index 15f8671..96d8979 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -2,11 +2,9 @@ import { defineConfig } from "vite"; import react from "@vitejs/plugin-react"; import svgr from "vite-plugin-svgr"; import path from "path"; -import jotaiDebugLabel from 'jotai/babel/plugin-debug-label' -import jotaiReactRefresh from 'jotai/babel/plugin-react-refresh' // https://vitejs.dev/config/ export default defineConfig({ - plugins: [svgr(), react({ babel: { plugins: [jotaiDebugLabel, jotaiReactRefresh] } })], + plugins: [svgr(), react()], // Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build` //