mirror of
https://github.com/AstrBotDevs/AstrBot
synced 2026-07-02 02:30:16 +08:00
Compare commits
3 Commits
fix/llm_to
...
feat/confi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a743b49740 | ||
|
|
34bc57b9c6 | ||
|
|
b63f06bffa |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -64,3 +64,5 @@ GenieData/
|
||||
.worktrees/
|
||||
|
||||
dashboard/bun.lock
|
||||
.claude
|
||||
.env
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore"
|
||||
},
|
||||
"dependencies": {
|
||||
"qrcode": "^1.5.4",
|
||||
"@guolao/vue-monaco-editor": "^1.5.4",
|
||||
"@tiptap/starter-kit": "2.1.7",
|
||||
"@tiptap/vue-3": "2.1.7",
|
||||
@@ -35,6 +34,7 @@
|
||||
"monaco-editor": "^0.52.2",
|
||||
"pinia": "2.1.6",
|
||||
"pinyin-pro": "^3.26.0",
|
||||
"qrcode": "^1.5.4",
|
||||
"shiki": "^3.20.0",
|
||||
"stream-markdown": "^0.0.13",
|
||||
"vee-validate": "4.11.3",
|
||||
@@ -61,7 +61,7 @@
|
||||
"eslint": "8.48.0",
|
||||
"eslint-plugin-vue": "9.17.0",
|
||||
"prettier": "3.0.2",
|
||||
"sass": "1.66.1",
|
||||
"sass": "1.98.0",
|
||||
"sass-loader": "13.3.2",
|
||||
"subset-font": "^2.4.0",
|
||||
"typescript": "5.1.6",
|
||||
|
||||
271
dashboard/pnpm-lock.yaml
generated
271
dashboard/pnpm-lock.yaml
generated
@@ -86,7 +86,7 @@ importers:
|
||||
version: 4.11.3(vue@3.3.4)
|
||||
vite-plugin-vuetify:
|
||||
specifier: 2.1.3
|
||||
version: 2.1.3(vite@6.4.1(@types/node@20.19.32)(sass@1.66.1)(terser@5.46.0))(vue@3.3.4)(vuetify@3.7.11)
|
||||
version: 2.1.3(vite@6.4.1(@types/node@20.19.32)(sass@1.98.0)(terser@5.46.0))(vue@3.3.4)(vuetify@3.7.11)
|
||||
vue:
|
||||
specifier: 3.3.4
|
||||
version: 3.3.4
|
||||
@@ -129,7 +129,7 @@ importers:
|
||||
version: 20.19.32
|
||||
'@vitejs/plugin-vue':
|
||||
specifier: 5.2.4
|
||||
version: 5.2.4(vite@6.4.1(@types/node@20.19.32)(sass@1.66.1)(terser@5.46.0))(vue@3.3.4)
|
||||
version: 5.2.4(vite@6.4.1(@types/node@20.19.32)(sass@1.98.0)(terser@5.46.0))(vue@3.3.4)
|
||||
'@vue/eslint-config-prettier':
|
||||
specifier: 8.0.0
|
||||
version: 8.0.0(@types/eslint@9.6.1)(eslint@8.48.0)(prettier@3.0.2)
|
||||
@@ -149,11 +149,11 @@ importers:
|
||||
specifier: 3.0.2
|
||||
version: 3.0.2
|
||||
sass:
|
||||
specifier: 1.66.1
|
||||
version: 1.66.1
|
||||
specifier: 1.98.0
|
||||
version: 1.98.0
|
||||
sass-loader:
|
||||
specifier: 13.3.2
|
||||
version: 13.3.2(sass@1.66.1)(webpack@5.105.0)
|
||||
version: 13.3.2(sass@1.98.0)(webpack@5.105.0)
|
||||
subset-font:
|
||||
specifier: ^2.4.0
|
||||
version: 2.4.0
|
||||
@@ -162,13 +162,13 @@ importers:
|
||||
version: 5.1.6
|
||||
vite:
|
||||
specifier: 6.4.1
|
||||
version: 6.4.1(@types/node@20.19.32)(sass@1.66.1)(terser@5.46.0)
|
||||
version: 6.4.1(@types/node@20.19.32)(sass@1.98.0)(terser@5.46.0)
|
||||
vite-plugin-webfont-dl:
|
||||
specifier: ^3.12.0
|
||||
version: 3.12.0(vite@6.4.1(@types/node@20.19.32)(sass@1.66.1)(terser@5.46.0))
|
||||
version: 3.12.0(vite@6.4.1(@types/node@20.19.32)(sass@1.98.0)(terser@5.46.0))
|
||||
vue-cli-plugin-vuetify:
|
||||
specifier: 2.5.8
|
||||
version: 2.5.8(sass-loader@13.3.2(sass@1.66.1)(webpack@5.105.0))(vue@3.3.4)(vuetify-loader@2.0.0-alpha.9(@vue/compiler-sfc@3.3.4)(vue@3.3.4)(vuetify@3.7.11)(webpack@5.105.0))(webpack@5.105.0)
|
||||
version: 2.5.8(sass-loader@13.3.2(sass@1.98.0)(webpack@5.105.0))(vue@3.3.4)(vuetify-loader@2.0.0-alpha.9(@vue/compiler-sfc@3.3.4)(vue@3.3.4)(vuetify@3.7.11)(webpack@5.105.0))(webpack@5.105.0)
|
||||
vue-tsc:
|
||||
specifier: 1.8.8
|
||||
version: 1.8.8(typescript@5.1.6)
|
||||
@@ -496,6 +496,94 @@ packages:
|
||||
resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==}
|
||||
engines: {node: '>= 8'}
|
||||
|
||||
'@parcel/watcher-android-arm64@2.5.6':
|
||||
resolution: {integrity: sha512-YQxSS34tPF/6ZG7r/Ih9xy+kP/WwediEUsqmtf0cuCV5TPPKw/PQHRhueUo6JdeFJaqV3pyjm0GdYjZotbRt/A==}
|
||||
engines: {node: '>= 10.0.0'}
|
||||
cpu: [arm64]
|
||||
os: [android]
|
||||
|
||||
'@parcel/watcher-darwin-arm64@2.5.6':
|
||||
resolution: {integrity: sha512-Z2ZdrnwyXvvvdtRHLmM4knydIdU9adO3D4n/0cVipF3rRiwP+3/sfzpAwA/qKFL6i1ModaabkU7IbpeMBgiVEA==}
|
||||
engines: {node: '>= 10.0.0'}
|
||||
cpu: [arm64]
|
||||
os: [darwin]
|
||||
|
||||
'@parcel/watcher-darwin-x64@2.5.6':
|
||||
resolution: {integrity: sha512-HgvOf3W9dhithcwOWX9uDZyn1lW9R+7tPZ4sug+NGrGIo4Rk1hAXLEbcH1TQSqxts0NYXXlOWqVpvS1SFS4fRg==}
|
||||
engines: {node: '>= 10.0.0'}
|
||||
cpu: [x64]
|
||||
os: [darwin]
|
||||
|
||||
'@parcel/watcher-freebsd-x64@2.5.6':
|
||||
resolution: {integrity: sha512-vJVi8yd/qzJxEKHkeemh7w3YAn6RJCtYlE4HPMoVnCpIXEzSrxErBW5SJBgKLbXU3WdIpkjBTeUNtyBVn8TRng==}
|
||||
engines: {node: '>= 10.0.0'}
|
||||
cpu: [x64]
|
||||
os: [freebsd]
|
||||
|
||||
'@parcel/watcher-linux-arm-glibc@2.5.6':
|
||||
resolution: {integrity: sha512-9JiYfB6h6BgV50CCfasfLf/uvOcJskMSwcdH1PHH9rvS1IrNy8zad6IUVPVUfmXr+u+Km9IxcfMLzgdOudz9EQ==}
|
||||
engines: {node: '>= 10.0.0'}
|
||||
cpu: [arm]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@parcel/watcher-linux-arm-musl@2.5.6':
|
||||
resolution: {integrity: sha512-Ve3gUCG57nuUUSyjBq/MAM0CzArtuIOxsBdQ+ftz6ho8n7s1i9E1Nmk/xmP323r2YL0SONs1EuwqBp2u1k5fxg==}
|
||||
engines: {node: '>= 10.0.0'}
|
||||
cpu: [arm]
|
||||
os: [linux]
|
||||
libc: [musl]
|
||||
|
||||
'@parcel/watcher-linux-arm64-glibc@2.5.6':
|
||||
resolution: {integrity: sha512-f2g/DT3NhGPdBmMWYoxixqYr3v/UXcmLOYy16Bx0TM20Tchduwr4EaCbmxh1321TABqPGDpS8D/ggOTaljijOA==}
|
||||
engines: {node: '>= 10.0.0'}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@parcel/watcher-linux-arm64-musl@2.5.6':
|
||||
resolution: {integrity: sha512-qb6naMDGlbCwdhLj6hgoVKJl2odL34z2sqkC7Z6kzir8b5W65WYDpLB6R06KabvZdgoHI/zxke4b3zR0wAbDTA==}
|
||||
engines: {node: '>= 10.0.0'}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
libc: [musl]
|
||||
|
||||
'@parcel/watcher-linux-x64-glibc@2.5.6':
|
||||
resolution: {integrity: sha512-kbT5wvNQlx7NaGjzPFu8nVIW1rWqV780O7ZtkjuWaPUgpv2NMFpjYERVi0UYj1msZNyCzGlaCWEtzc+exjMGbQ==}
|
||||
engines: {node: '>= 10.0.0'}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@parcel/watcher-linux-x64-musl@2.5.6':
|
||||
resolution: {integrity: sha512-1JRFeC+h7RdXwldHzTsmdtYR/Ku8SylLgTU/reMuqdVD7CtLwf0VR1FqeprZ0eHQkO0vqsbvFLXUmYm/uNKJBg==}
|
||||
engines: {node: '>= 10.0.0'}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
libc: [musl]
|
||||
|
||||
'@parcel/watcher-win32-arm64@2.5.6':
|
||||
resolution: {integrity: sha512-3ukyebjc6eGlw9yRt678DxVF7rjXatWiHvTXqphZLvo7aC5NdEgFufVwjFfY51ijYEWpXbqF5jtrK275z52D4Q==}
|
||||
engines: {node: '>= 10.0.0'}
|
||||
cpu: [arm64]
|
||||
os: [win32]
|
||||
|
||||
'@parcel/watcher-win32-ia32@2.5.6':
|
||||
resolution: {integrity: sha512-k35yLp1ZMwwee3Ez/pxBi5cf4AoBKYXj00CZ80jUz5h8prpiaQsiRPKQMxoLstNuqe2vR4RNPEAEcjEFzhEz/g==}
|
||||
engines: {node: '>= 10.0.0'}
|
||||
cpu: [ia32]
|
||||
os: [win32]
|
||||
|
||||
'@parcel/watcher-win32-x64@2.5.6':
|
||||
resolution: {integrity: sha512-hbQlYcCq5dlAX9Qx+kFb0FHue6vbjlf0FrNzSKdYK2APUf7tGfGxQCk2ihEREmbR6ZMc0MVAD5RIX/41gpUzTw==}
|
||||
engines: {node: '>= 10.0.0'}
|
||||
cpu: [x64]
|
||||
os: [win32]
|
||||
|
||||
'@parcel/watcher@2.5.6':
|
||||
resolution: {integrity: sha512-tmmZ3lQxAe/k/+rNnXQRawJ4NjxO2hqiOLTHvWchtGZULp4RyFeh6aU4XdOYBFe2KE1oShQTv4AblOs2iOrNnQ==}
|
||||
engines: {node: '>= 10.0.0'}
|
||||
|
||||
'@pkgr/core@0.2.9':
|
||||
resolution: {integrity: sha512-QNqXyfVS2wm9hweSYD2O7F0G06uurj9kZ96TRQE5Y9hU7+tgdZwIkbAKc5Ocy1HxEY2kuDQa6cQ1WRs/O5LFKA==}
|
||||
engines: {node: ^12.20.0 || ^14.18.0 || >=16.0.0}
|
||||
@@ -1218,10 +1306,6 @@ packages:
|
||||
resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==}
|
||||
engines: {node: '>=8'}
|
||||
|
||||
anymatch@3.1.3:
|
||||
resolution: {integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==}
|
||||
engines: {node: '>= 8'}
|
||||
|
||||
apexcharts@3.42.0:
|
||||
resolution: {integrity: sha512-hYhzZqh2Efny9uiutkGU2M/EarJ4Nn8s6dxZ0C7E7N+SV4d1xjTioXi2NLn4UKVJabZkb3HnpXDoumXgtAymwg==}
|
||||
|
||||
@@ -1254,10 +1338,6 @@ packages:
|
||||
big.js@5.2.2:
|
||||
resolution: {integrity: sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==}
|
||||
|
||||
binary-extensions@2.3.0:
|
||||
resolution: {integrity: sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==}
|
||||
engines: {node: '>=8'}
|
||||
|
||||
boolbase@1.0.0:
|
||||
resolution: {integrity: sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==}
|
||||
|
||||
@@ -1324,9 +1404,9 @@ packages:
|
||||
chevrotain@11.0.3:
|
||||
resolution: {integrity: sha512-ci2iJH6LeIkvP9eJW6gpueU8cnZhv85ELY8w8WiFtNjMHA5ad6pQLaJo9mEly/9qUyCpvqX8/POVUTf18/HFdw==}
|
||||
|
||||
chokidar@3.6.0:
|
||||
resolution: {integrity: sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==}
|
||||
engines: {node: '>= 8.10.0'}
|
||||
chokidar@4.0.3:
|
||||
resolution: {integrity: sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==}
|
||||
engines: {node: '>= 14.16.0'}
|
||||
|
||||
chrome-trace-event@1.0.4:
|
||||
resolution: {integrity: sha512-rNjApaLzuwaOTjCiT8lSDdGN1APCiqkChLMJxJPWLunPAt5fy8xgU9/jNOchV84wfIxrA0lRQB7oCT8jrn/wrQ==}
|
||||
@@ -1590,6 +1670,10 @@ packages:
|
||||
resolution: {integrity: sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==}
|
||||
engines: {node: '>=6'}
|
||||
|
||||
detect-libc@2.1.2:
|
||||
resolution: {integrity: sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==}
|
||||
engines: {node: '>=8'}
|
||||
|
||||
devlop@1.1.0:
|
||||
resolution: {integrity: sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA==}
|
||||
|
||||
@@ -1966,10 +2050,6 @@ packages:
|
||||
resolution: {integrity: sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==}
|
||||
engines: {node: '>= 0.10'}
|
||||
|
||||
is-binary-path@2.1.0:
|
||||
resolution: {integrity: sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==}
|
||||
engines: {node: '>=8'}
|
||||
|
||||
is-buffer@2.0.5:
|
||||
resolution: {integrity: sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==}
|
||||
engines: {node: '>=4'}
|
||||
@@ -2235,13 +2315,12 @@ packages:
|
||||
neo-async@2.6.2:
|
||||
resolution: {integrity: sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==}
|
||||
|
||||
node-addon-api@7.1.1:
|
||||
resolution: {integrity: sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==}
|
||||
|
||||
node-releases@2.0.36:
|
||||
resolution: {integrity: sha512-TdC8FSgHz8Mwtw9g5L4gR/Sh9XhSP/0DEkQxfEFXOpiul5IiHgHan2VhYYb6agDSfp4KuvltmGApc8HMgUrIkA==}
|
||||
|
||||
normalize-path@3.0.0:
|
||||
resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
|
||||
nth-check@2.1.1:
|
||||
resolution: {integrity: sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==}
|
||||
|
||||
@@ -2481,9 +2560,9 @@ packages:
|
||||
queue-microtask@1.2.3:
|
||||
resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==}
|
||||
|
||||
readdirp@3.6.0:
|
||||
resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==}
|
||||
engines: {node: '>=8.10.0'}
|
||||
readdirp@4.1.2:
|
||||
resolution: {integrity: sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==}
|
||||
engines: {node: '>= 14.18.0'}
|
||||
|
||||
rechoir@0.6.2:
|
||||
resolution: {integrity: sha512-HFM8rkZ+i3zrV+4LQjwQ0W+ez98pApMGM3HUrN04j3CqzPOzl9nmP15Y8YXNm8QHGv/eacOVEjqhmWpkRV0NAw==}
|
||||
@@ -2569,8 +2648,8 @@ packages:
|
||||
sass-embedded:
|
||||
optional: true
|
||||
|
||||
sass@1.66.1:
|
||||
resolution: {integrity: sha512-50c+zTsZOJVgFfTgwwEzkjA3/QACgdNsKueWPyAR0mRINIvLAStVQBbPg14iuqEQ74NPDbXzJARJ/O4SI1zftA==}
|
||||
sass@1.98.0:
|
||||
resolution: {integrity: sha512-+4N/u9dZ4PrgzGgPlKnaaRQx64RO0JBKs9sDhQ2pLgN6JQZ25uPQZKQYaBJU48Kd5BxgXoJ4e09Dq7nMcOUW3A==}
|
||||
engines: {node: '>=14.0.0'}
|
||||
hasBin: true
|
||||
|
||||
@@ -3339,6 +3418,67 @@ snapshots:
|
||||
'@nodelib/fs.scandir': 2.1.5
|
||||
fastq: 1.20.1
|
||||
|
||||
'@parcel/watcher-android-arm64@2.5.6':
|
||||
optional: true
|
||||
|
||||
'@parcel/watcher-darwin-arm64@2.5.6':
|
||||
optional: true
|
||||
|
||||
'@parcel/watcher-darwin-x64@2.5.6':
|
||||
optional: true
|
||||
|
||||
'@parcel/watcher-freebsd-x64@2.5.6':
|
||||
optional: true
|
||||
|
||||
'@parcel/watcher-linux-arm-glibc@2.5.6':
|
||||
optional: true
|
||||
|
||||
'@parcel/watcher-linux-arm-musl@2.5.6':
|
||||
optional: true
|
||||
|
||||
'@parcel/watcher-linux-arm64-glibc@2.5.6':
|
||||
optional: true
|
||||
|
||||
'@parcel/watcher-linux-arm64-musl@2.5.6':
|
||||
optional: true
|
||||
|
||||
'@parcel/watcher-linux-x64-glibc@2.5.6':
|
||||
optional: true
|
||||
|
||||
'@parcel/watcher-linux-x64-musl@2.5.6':
|
||||
optional: true
|
||||
|
||||
'@parcel/watcher-win32-arm64@2.5.6':
|
||||
optional: true
|
||||
|
||||
'@parcel/watcher-win32-ia32@2.5.6':
|
||||
optional: true
|
||||
|
||||
'@parcel/watcher-win32-x64@2.5.6':
|
||||
optional: true
|
||||
|
||||
'@parcel/watcher@2.5.6':
|
||||
dependencies:
|
||||
detect-libc: 2.1.2
|
||||
is-glob: 4.0.3
|
||||
node-addon-api: 7.1.1
|
||||
picomatch: 4.0.3
|
||||
optionalDependencies:
|
||||
'@parcel/watcher-android-arm64': 2.5.6
|
||||
'@parcel/watcher-darwin-arm64': 2.5.6
|
||||
'@parcel/watcher-darwin-x64': 2.5.6
|
||||
'@parcel/watcher-freebsd-x64': 2.5.6
|
||||
'@parcel/watcher-linux-arm-glibc': 2.5.6
|
||||
'@parcel/watcher-linux-arm-musl': 2.5.6
|
||||
'@parcel/watcher-linux-arm64-glibc': 2.5.6
|
||||
'@parcel/watcher-linux-arm64-musl': 2.5.6
|
||||
'@parcel/watcher-linux-x64-glibc': 2.5.6
|
||||
'@parcel/watcher-linux-x64-musl': 2.5.6
|
||||
'@parcel/watcher-win32-arm64': 2.5.6
|
||||
'@parcel/watcher-win32-ia32': 2.5.6
|
||||
'@parcel/watcher-win32-x64': 2.5.6
|
||||
optional: true
|
||||
|
||||
'@pkgr/core@0.2.9': {}
|
||||
|
||||
'@popperjs/core@2.11.8': {}
|
||||
@@ -3865,9 +4005,9 @@ snapshots:
|
||||
|
||||
'@ungap/structured-clone@1.3.0': {}
|
||||
|
||||
'@vitejs/plugin-vue@5.2.4(vite@6.4.1(@types/node@20.19.32)(sass@1.66.1)(terser@5.46.0))(vue@3.3.4)':
|
||||
'@vitejs/plugin-vue@5.2.4(vite@6.4.1(@types/node@20.19.32)(sass@1.98.0)(terser@5.46.0))(vue@3.3.4)':
|
||||
dependencies:
|
||||
vite: 6.4.1(@types/node@20.19.32)(sass@1.66.1)(terser@5.46.0)
|
||||
vite: 6.4.1(@types/node@20.19.32)(sass@1.98.0)(terser@5.46.0)
|
||||
vue: 3.3.4
|
||||
|
||||
'@volar/language-core@1.10.10':
|
||||
@@ -4151,11 +4291,6 @@ snapshots:
|
||||
dependencies:
|
||||
color-convert: 2.0.1
|
||||
|
||||
anymatch@3.1.3:
|
||||
dependencies:
|
||||
normalize-path: 3.0.0
|
||||
picomatch: 2.3.1
|
||||
|
||||
apexcharts@3.42.0:
|
||||
dependencies:
|
||||
'@yr/monotone-cubic-spline': 1.0.3
|
||||
@@ -4192,8 +4327,6 @@ snapshots:
|
||||
|
||||
big.js@5.2.2: {}
|
||||
|
||||
binary-extensions@2.3.0: {}
|
||||
|
||||
boolbase@1.0.0: {}
|
||||
|
||||
brace-expansion@1.1.12:
|
||||
@@ -4267,17 +4400,9 @@ snapshots:
|
||||
'@chevrotain/utils': 11.0.3
|
||||
lodash-es: 4.17.23
|
||||
|
||||
chokidar@3.6.0:
|
||||
chokidar@4.0.3:
|
||||
dependencies:
|
||||
anymatch: 3.1.3
|
||||
braces: 3.0.3
|
||||
glob-parent: 5.1.2
|
||||
is-binary-path: 2.1.0
|
||||
is-glob: 4.0.3
|
||||
normalize-path: 3.0.0
|
||||
readdirp: 3.6.0
|
||||
optionalDependencies:
|
||||
fsevents: 2.3.3
|
||||
readdirp: 4.1.2
|
||||
|
||||
chrome-trace-event@1.0.4: {}
|
||||
|
||||
@@ -4547,6 +4672,9 @@ snapshots:
|
||||
|
||||
dequal@2.0.3: {}
|
||||
|
||||
detect-libc@2.1.2:
|
||||
optional: true
|
||||
|
||||
devlop@1.1.0:
|
||||
dependencies:
|
||||
dequal: 2.0.3
|
||||
@@ -4967,10 +5095,6 @@ snapshots:
|
||||
|
||||
interpret@1.4.0: {}
|
||||
|
||||
is-binary-path@2.1.0:
|
||||
dependencies:
|
||||
binary-extensions: 2.3.0
|
||||
|
||||
is-buffer@2.0.5: {}
|
||||
|
||||
is-core-module@2.16.1:
|
||||
@@ -5226,9 +5350,10 @@ snapshots:
|
||||
|
||||
neo-async@2.6.2: {}
|
||||
|
||||
node-releases@2.0.36: {}
|
||||
node-addon-api@7.1.1:
|
||||
optional: true
|
||||
|
||||
normalize-path@3.0.0: {}
|
||||
node-releases@2.0.36: {}
|
||||
|
||||
nth-check@2.1.1:
|
||||
dependencies:
|
||||
@@ -5486,9 +5611,7 @@ snapshots:
|
||||
|
||||
queue-microtask@1.2.3: {}
|
||||
|
||||
readdirp@3.6.0:
|
||||
dependencies:
|
||||
picomatch: 2.3.1
|
||||
readdirp@4.1.2: {}
|
||||
|
||||
rechoir@0.6.2:
|
||||
dependencies:
|
||||
@@ -5574,18 +5697,20 @@ snapshots:
|
||||
|
||||
safer-buffer@2.1.2: {}
|
||||
|
||||
sass-loader@13.3.2(sass@1.66.1)(webpack@5.105.0):
|
||||
sass-loader@13.3.2(sass@1.98.0)(webpack@5.105.0):
|
||||
dependencies:
|
||||
neo-async: 2.6.2
|
||||
webpack: 5.105.0
|
||||
optionalDependencies:
|
||||
sass: 1.66.1
|
||||
sass: 1.98.0
|
||||
|
||||
sass@1.66.1:
|
||||
sass@1.98.0:
|
||||
dependencies:
|
||||
chokidar: 3.6.0
|
||||
chokidar: 4.0.3
|
||||
immutable: 4.3.8
|
||||
source-map-js: 1.2.1
|
||||
optionalDependencies:
|
||||
'@parcel/watcher': 2.5.6
|
||||
|
||||
schema-utils@3.3.0:
|
||||
dependencies:
|
||||
@@ -5860,28 +5985,28 @@ snapshots:
|
||||
'@types/unist': 3.0.3
|
||||
vfile-message: 4.0.3
|
||||
|
||||
vite-plugin-vuetify@2.1.3(vite@6.4.1(@types/node@20.19.32)(sass@1.66.1)(terser@5.46.0))(vue@3.3.4)(vuetify@3.7.11):
|
||||
vite-plugin-vuetify@2.1.3(vite@6.4.1(@types/node@20.19.32)(sass@1.98.0)(terser@5.46.0))(vue@3.3.4)(vuetify@3.7.11):
|
||||
dependencies:
|
||||
'@vuetify/loader-shared': 2.1.2(vue@3.3.4)(vuetify@3.7.11)
|
||||
debug: 4.4.3
|
||||
upath: 2.0.1
|
||||
vite: 6.4.1(@types/node@20.19.32)(sass@1.66.1)(terser@5.46.0)
|
||||
vite: 6.4.1(@types/node@20.19.32)(sass@1.98.0)(terser@5.46.0)
|
||||
vue: 3.3.4
|
||||
vuetify: 3.7.11(typescript@5.1.6)(vite-plugin-vuetify@2.1.3)(vue@3.3.4)
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
vite-plugin-webfont-dl@3.12.0(vite@6.4.1(@types/node@20.19.32)(sass@1.66.1)(terser@5.46.0)):
|
||||
vite-plugin-webfont-dl@3.12.0(vite@6.4.1(@types/node@20.19.32)(sass@1.98.0)(terser@5.46.0)):
|
||||
dependencies:
|
||||
axios: 1.13.5
|
||||
clean-css: 5.3.3
|
||||
flat-cache: 6.1.20
|
||||
picocolors: 1.1.1
|
||||
vite: 6.4.1(@types/node@20.19.32)(sass@1.66.1)(terser@5.46.0)
|
||||
vite: 6.4.1(@types/node@20.19.32)(sass@1.98.0)(terser@5.46.0)
|
||||
transitivePeerDependencies:
|
||||
- debug
|
||||
|
||||
vite@6.4.1(@types/node@20.19.32)(sass@1.66.1)(terser@5.46.0):
|
||||
vite@6.4.1(@types/node@20.19.32)(sass@1.98.0)(terser@5.46.0):
|
||||
dependencies:
|
||||
esbuild: 0.25.12
|
||||
fdir: 6.5.0(picomatch@4.0.3)
|
||||
@@ -5892,7 +6017,7 @@ snapshots:
|
||||
optionalDependencies:
|
||||
'@types/node': 20.19.32
|
||||
fsevents: 2.3.3
|
||||
sass: 1.66.1
|
||||
sass: 1.98.0
|
||||
terser: 5.46.0
|
||||
|
||||
vscode-jsonrpc@8.2.0: {}
|
||||
@@ -5912,7 +6037,7 @@ snapshots:
|
||||
|
||||
vscode-uri@3.0.8: {}
|
||||
|
||||
vue-cli-plugin-vuetify@2.5.8(sass-loader@13.3.2(sass@1.66.1)(webpack@5.105.0))(vue@3.3.4)(vuetify-loader@2.0.0-alpha.9(@vue/compiler-sfc@3.3.4)(vue@3.3.4)(vuetify@3.7.11)(webpack@5.105.0))(webpack@5.105.0):
|
||||
vue-cli-plugin-vuetify@2.5.8(sass-loader@13.3.2(sass@1.98.0)(webpack@5.105.0))(vue@3.3.4)(vuetify-loader@2.0.0-alpha.9(@vue/compiler-sfc@3.3.4)(vue@3.3.4)(vuetify@3.7.11)(webpack@5.105.0))(webpack@5.105.0):
|
||||
dependencies:
|
||||
null-loader: 4.0.1(webpack@5.105.0)
|
||||
semver: 7.7.4
|
||||
@@ -5920,7 +6045,7 @@ snapshots:
|
||||
vue: 3.3.4
|
||||
webpack: 5.105.0
|
||||
optionalDependencies:
|
||||
sass-loader: 13.3.2(sass@1.66.1)(webpack@5.105.0)
|
||||
sass-loader: 13.3.2(sass@1.98.0)(webpack@5.105.0)
|
||||
vuetify-loader: 2.0.0-alpha.9(@vue/compiler-sfc@3.3.4)(vue@3.3.4)(vuetify@3.7.11)(webpack@5.105.0)
|
||||
|
||||
vue-demi@0.14.10(vue@3.3.4):
|
||||
@@ -6002,7 +6127,7 @@ snapshots:
|
||||
vue: 3.3.4
|
||||
optionalDependencies:
|
||||
typescript: 5.1.6
|
||||
vite-plugin-vuetify: 2.1.3(vite@6.4.1(@types/node@20.19.32)(sass@1.66.1)(terser@5.46.0))(vue@3.3.4)(vuetify@3.7.11)
|
||||
vite-plugin-vuetify: 2.1.3(vite@6.4.1(@types/node@20.19.32)(sass@1.98.0)(terser@5.46.0))(vue@3.3.4)(vuetify@3.7.11)
|
||||
|
||||
w3c-keyname@2.2.8: {}
|
||||
|
||||
|
||||
@@ -1,36 +1,42 @@
|
||||
import { createApp } from 'vue';
|
||||
import { createPinia } from 'pinia';
|
||||
import App from './App.vue';
|
||||
import { router } from './router';
|
||||
import vuetify from './plugins/vuetify';
|
||||
import confirmPlugin from './plugins/confirmPlugin';
|
||||
import { setupI18n } from './i18n/composables';
|
||||
import '@/scss/style.scss';
|
||||
import VueApexCharts from 'vue3-apexcharts';
|
||||
import { createApp } from "vue";
|
||||
import { createPinia } from "pinia";
|
||||
import App from "./App.vue";
|
||||
import { router } from "./router";
|
||||
import vuetify from "./plugins/vuetify";
|
||||
import confirmPlugin from "./plugins/confirmPlugin";
|
||||
import { setupI18n } from "./i18n/composables";
|
||||
import "@/scss/style.scss";
|
||||
import VueApexCharts from "vue3-apexcharts";
|
||||
|
||||
import print from 'vue3-print-nb';
|
||||
import { loader } from '@guolao/vue-monaco-editor'
|
||||
import * as monaco from 'monaco-editor';
|
||||
import editorWorker from 'monaco-editor/esm/vs/editor/editor.worker?worker';
|
||||
import jsonWorker from 'monaco-editor/esm/vs/language/json/json.worker?worker';
|
||||
import cssWorker from 'monaco-editor/esm/vs/language/css/css.worker?worker';
|
||||
import htmlWorker from 'monaco-editor/esm/vs/language/html/html.worker?worker';
|
||||
import tsWorker from 'monaco-editor/esm/vs/language/typescript/ts.worker?worker';
|
||||
import axios from 'axios';
|
||||
import { waitForRouterReadyInBackground } from './utils/routerReadiness.mjs';
|
||||
import print from "vue3-print-nb";
|
||||
import { loader } from "@guolao/vue-monaco-editor";
|
||||
import * as monaco from "monaco-editor";
|
||||
import editorWorker from "monaco-editor/esm/vs/editor/editor.worker?worker";
|
||||
import jsonWorker from "monaco-editor/esm/vs/language/json/json.worker?worker";
|
||||
import cssWorker from "monaco-editor/esm/vs/language/css/css.worker?worker";
|
||||
import htmlWorker from "monaco-editor/esm/vs/language/html/html.worker?worker";
|
||||
import tsWorker from "monaco-editor/esm/vs/language/typescript/ts.worker?worker";
|
||||
import axios from "axios";
|
||||
import { waitForRouterReadyInBackground } from "./utils/routerReadiness.mjs";
|
||||
import {
|
||||
getApiBaseUrl,
|
||||
resolveApiUrl,
|
||||
resolvePublicUrl,
|
||||
setApiBaseUrl,
|
||||
} from "@/utils/request";
|
||||
|
||||
(self as any).MonacoEnvironment = {
|
||||
getWorker(_: string, label: string) {
|
||||
if (label === 'json') {
|
||||
if (label === "json") {
|
||||
return new jsonWorker();
|
||||
}
|
||||
if (label === 'css' || label === 'scss' || label === 'less') {
|
||||
if (label === "css" || label === "scss" || label === "less") {
|
||||
return new cssWorker();
|
||||
}
|
||||
if (label === 'html' || label === 'handlebars' || label === 'razor') {
|
||||
if (label === "html" || label === "handlebars" || label === "razor") {
|
||||
return new htmlWorker();
|
||||
}
|
||||
if (label === 'typescript' || label === 'javascript') {
|
||||
if (label === "typescript" || label === "javascript") {
|
||||
return new tsWorker();
|
||||
}
|
||||
return new editorWorker();
|
||||
@@ -38,102 +44,150 @@ import { waitForRouterReadyInBackground } from './utils/routerReadiness.mjs';
|
||||
};
|
||||
|
||||
// 初始化新的i18n系统,等待完成后再挂载应用
|
||||
setupI18n().then(async () => {
|
||||
console.log('🌍 新i18n系统初始化完成');
|
||||
|
||||
const app = createApp(App);
|
||||
const pinia = createPinia();
|
||||
app.use(pinia);
|
||||
app.use(router);
|
||||
app.use(print);
|
||||
app.use(VueApexCharts);
|
||||
app.use(vuetify);
|
||||
app.use(confirmPlugin);
|
||||
await router.isReady();
|
||||
app.mount('#app');
|
||||
|
||||
// 挂载后同步 Vuetify 主题
|
||||
import('./stores/customizer').then(({ useCustomizerStore }) => {
|
||||
const customizer = useCustomizerStore(pinia);
|
||||
vuetify.theme.global.name.value = customizer.uiTheme;
|
||||
const storedPrimary = localStorage.getItem('themePrimary');
|
||||
const storedSecondary = localStorage.getItem('themeSecondary');
|
||||
if (storedPrimary || storedSecondary) {
|
||||
const themes = vuetify.theme.themes.value;
|
||||
['PurpleTheme', 'PurpleThemeDark'].forEach((name) => {
|
||||
const theme = themes[name];
|
||||
if (!theme?.colors) return;
|
||||
if (storedPrimary) theme.colors.primary = storedPrimary;
|
||||
if (storedSecondary) theme.colors.secondary = storedSecondary;
|
||||
if (storedPrimary && theme.colors.darkprimary) theme.colors.darkprimary = storedPrimary;
|
||||
if (storedSecondary && theme.colors.darksecondary) theme.colors.darksecondary = storedSecondary;
|
||||
});
|
||||
}
|
||||
});
|
||||
}).catch(error => {
|
||||
console.error('❌ 新i18n系统初始化失败:', error);
|
||||
|
||||
// 即使i18n初始化失败,也要挂载应用(使用回退机制)
|
||||
const app = createApp(App);
|
||||
const pinia = createPinia();
|
||||
app.use(pinia);
|
||||
app.use(router);
|
||||
app.use(print);
|
||||
app.use(VueApexCharts);
|
||||
app.use(vuetify);
|
||||
app.use(confirmPlugin);
|
||||
app.mount('#app');
|
||||
waitForRouterReadyInBackground(router);
|
||||
|
||||
// 挂载后同步 Vuetify 主题
|
||||
import('./stores/customizer').then(({ useCustomizerStore }) => {
|
||||
const customizer = useCustomizerStore(pinia);
|
||||
vuetify.theme.global.name.value = customizer.uiTheme;
|
||||
const storedPrimary = localStorage.getItem('themePrimary');
|
||||
const storedSecondary = localStorage.getItem('themeSecondary');
|
||||
if (storedPrimary || storedSecondary) {
|
||||
const themes = vuetify.theme.themes.value;
|
||||
['PurpleTheme', 'PurpleThemeDark'].forEach((name) => {
|
||||
const theme = themes[name];
|
||||
if (!theme?.colors) return;
|
||||
if (storedPrimary) theme.colors.primary = storedPrimary;
|
||||
if (storedSecondary) theme.colors.secondary = storedSecondary;
|
||||
if (storedPrimary && theme.colors.darkprimary) theme.colors.darkprimary = storedPrimary;
|
||||
if (storedSecondary && theme.colors.darksecondary) theme.colors.darksecondary = storedSecondary;
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
setupI18n()
|
||||
.then(async () => {
|
||||
console.log("🌍 新i18n系统初始化完成");
|
||||
|
||||
const app = createApp(App);
|
||||
const pinia = createPinia();
|
||||
app.use(pinia);
|
||||
app.use(router);
|
||||
app.use(print);
|
||||
app.use(VueApexCharts);
|
||||
app.use(vuetify);
|
||||
app.use(confirmPlugin);
|
||||
await router.isReady();
|
||||
app.mount("#app");
|
||||
|
||||
// 挂载后同步 Vuetify 主题
|
||||
import("./stores/customizer").then(({ useCustomizerStore }) => {
|
||||
const customizer = useCustomizerStore(pinia);
|
||||
vuetify.theme.global.name.value = customizer.uiTheme;
|
||||
const storedPrimary = localStorage.getItem("themePrimary");
|
||||
const storedSecondary = localStorage.getItem("themeSecondary");
|
||||
if (storedPrimary || storedSecondary) {
|
||||
const themes = vuetify.theme.themes.value;
|
||||
["PurpleTheme", "PurpleThemeDark"].forEach((name) => {
|
||||
const theme = themes[name];
|
||||
if (!theme?.colors) return;
|
||||
if (storedPrimary) theme.colors.primary = storedPrimary;
|
||||
if (storedSecondary) theme.colors.secondary = storedSecondary;
|
||||
if (storedPrimary && theme.colors.darkprimary)
|
||||
theme.colors.darkprimary = storedPrimary;
|
||||
if (storedSecondary && theme.colors.darksecondary)
|
||||
theme.colors.darksecondary = storedSecondary;
|
||||
});
|
||||
}
|
||||
});
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error("❌ 新i18n系统初始化失败:", error);
|
||||
|
||||
// 即使i18n初始化失败,也要挂载应用(使用回退机制)
|
||||
const app = createApp(App);
|
||||
const pinia = createPinia();
|
||||
app.use(pinia);
|
||||
app.use(router);
|
||||
app.use(print);
|
||||
app.use(VueApexCharts);
|
||||
app.use(vuetify);
|
||||
app.use(confirmPlugin);
|
||||
app.mount("#app");
|
||||
waitForRouterReadyInBackground(router);
|
||||
|
||||
// 挂载后同步 Vuetify 主题
|
||||
import("./stores/customizer").then(({ useCustomizerStore }) => {
|
||||
const customizer = useCustomizerStore(pinia);
|
||||
vuetify.theme.global.name.value = customizer.uiTheme;
|
||||
const storedPrimary = localStorage.getItem("themePrimary");
|
||||
const storedSecondary = localStorage.getItem("themeSecondary");
|
||||
if (storedPrimary || storedSecondary) {
|
||||
const themes = vuetify.theme.themes.value;
|
||||
["PurpleTheme", "PurpleThemeDark"].forEach((name) => {
|
||||
const theme = themes[name];
|
||||
if (!theme?.colors) return;
|
||||
if (storedPrimary) theme.colors.primary = storedPrimary;
|
||||
if (storedSecondary) theme.colors.secondary = storedSecondary;
|
||||
if (storedPrimary && theme.colors.darkprimary)
|
||||
theme.colors.darkprimary = storedPrimary;
|
||||
if (storedSecondary && theme.colors.darksecondary)
|
||||
theme.colors.darksecondary = storedSecondary;
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
axios.interceptors.request.use((config) => {
|
||||
const token = localStorage.getItem('token');
|
||||
const token = localStorage.getItem("token");
|
||||
if (token) {
|
||||
config.headers['Authorization'] = `Bearer ${token}`;
|
||||
config.headers["Authorization"] = `Bearer ${token}`;
|
||||
}
|
||||
const locale = localStorage.getItem('astrbot-locale');
|
||||
const locale = localStorage.getItem("astrbot-locale");
|
||||
if (locale) {
|
||||
config.headers['Accept-Language'] = locale;
|
||||
config.headers["Accept-Language"] = locale;
|
||||
}
|
||||
return config;
|
||||
});
|
||||
|
||||
// Keep fetch() calls consistent with axios by automatically attaching the JWT.
|
||||
// Some parts of the UI use fetch directly; without this, those requests will 401.
|
||||
const _origFetch = window.fetch.bind(window);
|
||||
window.fetch = (input: RequestInfo | URL, init?: RequestInit) => {
|
||||
const token = localStorage.getItem('token');
|
||||
if (!token) return _origFetch(input, init);
|
||||
|
||||
const headers = new Headers(init?.headers || (typeof input !== 'string' && 'headers' in input ? (input as Request).headers : undefined));
|
||||
if (!headers.has('Authorization')) {
|
||||
headers.set('Authorization', `Bearer ${token}`);
|
||||
// 1. 定义加载配置的函数
|
||||
async function loadAppConfig() {
|
||||
try {
|
||||
const configUrl = new URL(resolvePublicUrl("config.json"));
|
||||
configUrl.searchParams.set("t", `${Date.now()}`);
|
||||
const response = await fetch(configUrl.toString());
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP error! status: ${response.status}`);
|
||||
}
|
||||
return await response.json();
|
||||
} catch (error) {
|
||||
console.warn("Failed to load config.json, falling back to default.", error);
|
||||
return {};
|
||||
}
|
||||
const locale = localStorage.getItem('astrbot-locale');
|
||||
if (locale && !headers.has('Accept-Language')) {
|
||||
headers.set('Accept-Language', locale);
|
||||
}
|
||||
return _origFetch(input, { ...init, headers });
|
||||
};
|
||||
}
|
||||
|
||||
loader.config({ monaco })
|
||||
async function initApp() {
|
||||
const config = await loadAppConfig();
|
||||
const configApiUrl = config.apiBaseUrl || "";
|
||||
const envApiUrl = import.meta.env.VITE_API_BASE || "";
|
||||
|
||||
const localApiUrl = localStorage.getItem("apiBaseUrl");
|
||||
const apiBaseUrl =
|
||||
localApiUrl !== null ? localApiUrl : configApiUrl || envApiUrl;
|
||||
|
||||
if (apiBaseUrl) {
|
||||
console.log(`API Base URL set to: ${apiBaseUrl}`);
|
||||
}
|
||||
|
||||
setApiBaseUrl(apiBaseUrl);
|
||||
|
||||
// Keep fetch() calls consistent with axios by automatically attaching the JWT.
|
||||
// Some parts of the UI use fetch directly; without this, those requests will 401.
|
||||
const _origFetch = window.fetch.bind(window);
|
||||
window.fetch = (input: RequestInfo | URL, init?: RequestInit) => {
|
||||
let url = input;
|
||||
if (typeof input === "string" && input.startsWith("/api")) {
|
||||
url = resolveApiUrl(input, getApiBaseUrl());
|
||||
}
|
||||
|
||||
const token = localStorage.getItem("token");
|
||||
const headers = new Headers(
|
||||
init?.headers ||
|
||||
(typeof input !== "string" && "headers" in input
|
||||
? (input as Request).headers
|
||||
: undefined),
|
||||
);
|
||||
|
||||
if (token && !headers.has("Authorization")) {
|
||||
headers.set("Authorization", `Bearer ${token}`);
|
||||
}
|
||||
const locale = localStorage.getItem("astrbot-locale");
|
||||
if (locale && !headers.has("Accept-Language")) {
|
||||
headers.set("Accept-Language", locale);
|
||||
}
|
||||
return _origFetch(url, { ...init, headers });
|
||||
};
|
||||
}
|
||||
|
||||
initApp();
|
||||
|
||||
loader.config({ monaco });
|
||||
|
||||
182
dashboard/src/utils/request.ts
Normal file
182
dashboard/src/utils/request.ts
Normal file
@@ -0,0 +1,182 @@
|
||||
import axios, { type InternalAxiosRequestConfig } from "axios";
|
||||
|
||||
const ABSOLUTE_URL_PATTERN = /^[a-zA-Z][a-zA-Z\d+\-.]*:\/\//;
|
||||
|
||||
function isAbsoluteUrl(value: string): boolean {
|
||||
return ABSOLUTE_URL_PATTERN.test(value);
|
||||
}
|
||||
|
||||
function stripTrailingSlashes(value: string): string {
|
||||
return value.replace(/\/+$/, "");
|
||||
}
|
||||
|
||||
function ensureLeadingSlash(value: string): string {
|
||||
if (!value) {
|
||||
return "/";
|
||||
}
|
||||
return value.startsWith("/") ? value : `/${value}`;
|
||||
}
|
||||
|
||||
function stripLeadingApiPrefix(path: string): string {
|
||||
const normalizedPath = ensureLeadingSlash(path);
|
||||
const strippedPath = normalizedPath.replace(/^\/api(?=\/|$)/, "");
|
||||
return strippedPath || "/";
|
||||
}
|
||||
|
||||
function baseEndsWithApi(baseUrl: string): boolean {
|
||||
if (!baseUrl) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isAbsoluteUrl(baseUrl)) {
|
||||
try {
|
||||
return new URL(baseUrl).pathname.replace(/\/+$/, "").endsWith("/api");
|
||||
} catch {
|
||||
return baseUrl.replace(/\/+$/, "").endsWith("/api");
|
||||
}
|
||||
}
|
||||
|
||||
return stripTrailingSlashes(baseUrl).endsWith("/api");
|
||||
}
|
||||
|
||||
function normalizePathForBase(path: string, baseUrl = ""): string {
|
||||
if (!path) {
|
||||
return "/";
|
||||
}
|
||||
|
||||
if (isAbsoluteUrl(path)) {
|
||||
return path;
|
||||
}
|
||||
|
||||
const normalizedPath = ensureLeadingSlash(path);
|
||||
if (baseEndsWithApi(baseUrl)) {
|
||||
return stripLeadingApiPrefix(normalizedPath);
|
||||
}
|
||||
return normalizedPath;
|
||||
}
|
||||
|
||||
function joinBaseAndPath(baseUrl: string, path: string): string {
|
||||
const cleanBase = stripTrailingSlashes(baseUrl);
|
||||
const cleanPath = path.replace(/^\/+/, "");
|
||||
return `${cleanBase}/${cleanPath}`;
|
||||
}
|
||||
|
||||
function normalizeBaseUrl(baseUrl: string | null | undefined): string {
|
||||
return stripTrailingSlashes(baseUrl?.trim() || "");
|
||||
}
|
||||
|
||||
export function normalizeConfiguredApiBaseUrl(
|
||||
baseUrl: string | null | undefined,
|
||||
): string {
|
||||
return normalizeBaseUrl(baseUrl);
|
||||
}
|
||||
|
||||
export function getApiBaseUrlValidationError(
|
||||
baseUrl: string | null | undefined,
|
||||
): string {
|
||||
const normalizedBaseUrl = normalizeConfiguredApiBaseUrl(baseUrl);
|
||||
|
||||
if (!normalizedBaseUrl) {
|
||||
return "";
|
||||
}
|
||||
|
||||
try {
|
||||
const parsedUrl = new URL(normalizedBaseUrl);
|
||||
if (!["http:", "https:"].includes(parsedUrl.protocol)) {
|
||||
return "API Base URL must use http:// or https://";
|
||||
}
|
||||
} catch {
|
||||
return "API Base URL must be a valid absolute URL";
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
export function getApiBaseUrl(): string {
|
||||
return normalizeBaseUrl(service.defaults.baseURL);
|
||||
}
|
||||
|
||||
export function setApiBaseUrl(baseUrl: string | null | undefined): string {
|
||||
const normalizedBaseUrl = normalizeBaseUrl(baseUrl);
|
||||
service.defaults.baseURL = normalizedBaseUrl;
|
||||
return normalizedBaseUrl;
|
||||
}
|
||||
|
||||
export function resolveApiUrl(
|
||||
path: string,
|
||||
baseUrl: string | null | undefined = getApiBaseUrl(),
|
||||
): string {
|
||||
const normalizedBaseUrl = normalizeBaseUrl(baseUrl);
|
||||
const normalizedPath = normalizePathForBase(path, normalizedBaseUrl);
|
||||
|
||||
if (isAbsoluteUrl(normalizedPath)) {
|
||||
return normalizedPath;
|
||||
}
|
||||
|
||||
if (!normalizedBaseUrl) {
|
||||
return normalizedPath;
|
||||
}
|
||||
|
||||
return joinBaseAndPath(normalizedBaseUrl, normalizedPath);
|
||||
}
|
||||
|
||||
export function resolvePublicUrl(path: string): string {
|
||||
const base = import.meta.env.BASE_URL || "/";
|
||||
const cleanBase = base.endsWith("/") ? base : `${base}/`;
|
||||
return new URL(
|
||||
path.replace(/^\/+/, ""),
|
||||
window.location.origin + cleanBase,
|
||||
).toString();
|
||||
}
|
||||
|
||||
export function resolveWebSocketUrl(
|
||||
path: string,
|
||||
queryParams?: Record<string, string>,
|
||||
): string {
|
||||
const resolvedApiUrl = resolveApiUrl(path);
|
||||
const url = new URL(resolvedApiUrl, window.location.href);
|
||||
|
||||
if (url.protocol === "https:") {
|
||||
url.protocol = "wss:";
|
||||
} else if (url.protocol === "http:") {
|
||||
url.protocol = "ws:";
|
||||
}
|
||||
|
||||
if (queryParams) {
|
||||
Object.entries(queryParams).forEach(([key, value]) => {
|
||||
url.searchParams.set(key, value);
|
||||
});
|
||||
}
|
||||
|
||||
return url.toString();
|
||||
}
|
||||
|
||||
const service = axios.create({
|
||||
baseURL: normalizeBaseUrl(import.meta.env.VITE_API_BASE),
|
||||
timeout: 10000,
|
||||
});
|
||||
|
||||
service.interceptors.request.use((config: InternalAxiosRequestConfig) => {
|
||||
const normalizedBaseUrl = normalizeBaseUrl(
|
||||
config.baseURL ?? service.defaults.baseURL,
|
||||
);
|
||||
|
||||
if (typeof config.url === "string") {
|
||||
config.url = normalizePathForBase(config.url, normalizedBaseUrl);
|
||||
}
|
||||
|
||||
const token = localStorage.getItem("token");
|
||||
if (token) {
|
||||
config.headers.set("Authorization", `Bearer ${token}`);
|
||||
}
|
||||
|
||||
const locale = localStorage.getItem("astrbot-locale");
|
||||
if (locale) {
|
||||
config.headers.set("Accept-Language", locale);
|
||||
}
|
||||
|
||||
return config;
|
||||
});
|
||||
|
||||
export default service;
|
||||
export * from "axios";
|
||||
@@ -1,17 +1,17 @@
|
||||
import { fileURLToPath, URL } from 'url';
|
||||
import { defineConfig } from 'vite';
|
||||
import vue from '@vitejs/plugin-vue';
|
||||
import vuetify from 'vite-plugin-vuetify';
|
||||
import webfontDl from 'vite-plugin-webfont-dl';
|
||||
import { fileURLToPath, URL } from "url";
|
||||
import { defineConfig } from "vite";
|
||||
import vue from "@vitejs/plugin-vue";
|
||||
import vuetify from "vite-plugin-vuetify";
|
||||
import webfontDl from "vite-plugin-webfont-dl";
|
||||
// @ts-ignore — .mjs not in TS project scope; Vite resolves this at runtime
|
||||
import { runMdiSubset } from './scripts/subset-mdi-font.mjs';
|
||||
import { runMdiSubset } from "./scripts/subset-mdi-font.mjs";
|
||||
|
||||
// Vite plugin: run MDI icon font subsetting (build only)
|
||||
function mdiSubset() {
|
||||
return {
|
||||
name: 'vite-plugin-mdi-subset',
|
||||
name: "vite-plugin-mdi-subset",
|
||||
async buildStart() {
|
||||
console.log('\n🔧 Running MDI icon font subsetting...');
|
||||
console.log("\n🔧 Running MDI icon font subsetting...");
|
||||
await runMdiSubset();
|
||||
},
|
||||
};
|
||||
@@ -21,47 +21,50 @@ function mdiSubset() {
|
||||
export default defineConfig(({ command }) => ({
|
||||
plugins: [
|
||||
// Only run MDI subsetting during production builds, skip in dev server
|
||||
...(command === 'build' ? [mdiSubset()] : []),
|
||||
...(command === "build" ? [mdiSubset()] : []),
|
||||
vue({
|
||||
template: {
|
||||
compilerOptions: {
|
||||
isCustomElement: (tag) => ['v-list-recognize-title'].includes(tag)
|
||||
}
|
||||
}
|
||||
isCustomElement: (tag) => ["v-list-recognize-title"].includes(tag),
|
||||
},
|
||||
},
|
||||
}),
|
||||
vuetify({
|
||||
autoImport: true
|
||||
autoImport: true,
|
||||
}),
|
||||
webfontDl()
|
||||
webfontDl(),
|
||||
],
|
||||
resolve: {
|
||||
alias: {
|
||||
mermaid: 'mermaid/dist/mermaid.js',
|
||||
'@': fileURLToPath(new URL('./src', import.meta.url))
|
||||
}
|
||||
mermaid: "mermaid/dist/mermaid.js",
|
||||
"@": fileURLToPath(new URL("./src", import.meta.url)),
|
||||
},
|
||||
},
|
||||
css: {
|
||||
preprocessorOptions: {
|
||||
scss: {}
|
||||
}
|
||||
scss: {
|
||||
api: "modern-compiler",
|
||||
silenceDeprecations: ["import", "global-builtin"],
|
||||
},
|
||||
},
|
||||
},
|
||||
build: {
|
||||
sourcemap: false,
|
||||
chunkSizeWarningLimit: 1024 * 1024 // Set the limit to 1 MB
|
||||
chunkSizeWarningLimit: 1024 * 1024, // Set the limit to 1 MB
|
||||
},
|
||||
optimizeDeps: {
|
||||
exclude: ['vuetify'],
|
||||
entries: ['./src/**/*.vue']
|
||||
exclude: ["vuetify"],
|
||||
entries: ["./src/**/*.vue"],
|
||||
},
|
||||
server: {
|
||||
host: '0.0.0.0',
|
||||
host: "0.0.0.0",
|
||||
port: 3000,
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: 'http://127.0.0.1:6185/',
|
||||
"/api": {
|
||||
target: "http://127.0.0.1:6185/",
|
||||
changeOrigin: true,
|
||||
ws: true
|
||||
}
|
||||
}
|
||||
}
|
||||
ws: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user