mirror of
https://github.com/Wei-Shaw/claude-relay-service.git
synced 2026-01-22 16:43:35 +00:00
fix: 恢复ClaudeConsole 账号模型映射能力
This commit is contained in:
@@ -6,39 +6,23 @@ module.exports = {
|
|||||||
es2021: true
|
es2021: true
|
||||||
},
|
},
|
||||||
extends: [
|
extends: [
|
||||||
'plugin:vue/vue3-strongly-recommended',
|
'plugin:vue/vue3-essential',
|
||||||
'eslint:recommended',
|
'eslint:recommended'
|
||||||
'plugin:prettier/recommended'
|
|
||||||
],
|
],
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
sourceType: 'module',
|
sourceType: 'module',
|
||||||
ecmaVersion: 'latest'
|
ecmaVersion: 'latest'
|
||||||
},
|
},
|
||||||
plugins: ['prettier'],
|
|
||||||
rules: {
|
rules: {
|
||||||
'vue/multi-word-component-names': 'off',
|
'vue/multi-word-component-names': 'off',
|
||||||
'vue/no-v-html': 'off',
|
'vue/no-v-html': 'off',
|
||||||
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
|
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
|
||||||
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
|
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
|
||||||
'prettier/prettier': 'error',
|
'vue/attributes-order': 'off',
|
||||||
'vue/attributes-order': [
|
'vue/max-attributes-per-line': 'off',
|
||||||
'error',
|
'vue/html-self-closing': 'off',
|
||||||
{
|
'vue/singleline-html-element-content-newline': 'off',
|
||||||
order: [
|
'vue/html-closing-bracket-newline': 'off',
|
||||||
'DEFINITION',
|
'vue/html-indent': 'off'
|
||||||
'LIST_RENDERING',
|
|
||||||
'CONDITIONALS',
|
|
||||||
'RENDER_MODIFIERS',
|
|
||||||
'GLOBAL',
|
|
||||||
'UNIQUE',
|
|
||||||
'TWO_WAY_BINDING',
|
|
||||||
'OTHER_DIRECTIVES',
|
|
||||||
'OTHER_ATTR',
|
|
||||||
'EVENTS',
|
|
||||||
'CONTENT'
|
|
||||||
],
|
|
||||||
alphabetical: true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
{
|
|
||||||
"printWidth": 100,
|
|
||||||
"semi": false,
|
|
||||||
"singleQuote": true,
|
|
||||||
"trailingComma": "none",
|
|
||||||
"endOfLine": "auto",
|
|
||||||
"plugins": ["prettier-plugin-tailwindcss"],
|
|
||||||
"tailwindConfig": "./tailwind.config.js",
|
|
||||||
|
|
||||||
"tabWidth": 2,
|
|
||||||
"useTabs": false,
|
|
||||||
"bracketSpacing": true,
|
|
||||||
"arrowParens": "always",
|
|
||||||
"quoteProps": "as-needed",
|
|
||||||
"bracketSameLine": false,
|
|
||||||
"proseWrap": "preserve"
|
|
||||||
}
|
|
||||||
218
web/admin-spa/package-lock.json
generated
218
web/admin-spa/package-lock.json
generated
@@ -19,14 +19,10 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@vitejs/plugin-vue": "^4.5.2",
|
"@vitejs/plugin-vue": "^4.5.2",
|
||||||
"@vue/eslint-config-prettier": "^10.2.0",
|
|
||||||
"autoprefixer": "^10.4.16",
|
"autoprefixer": "^10.4.16",
|
||||||
"eslint": "^8.55.0",
|
"eslint": "^8.55.0",
|
||||||
"eslint-plugin-prettier": "^5.5.4",
|
|
||||||
"eslint-plugin-vue": "^9.19.2",
|
"eslint-plugin-vue": "^9.19.2",
|
||||||
"postcss": "^8.4.32",
|
"postcss": "^8.4.32",
|
||||||
"prettier": "^3.1.1",
|
|
||||||
"prettier-plugin-tailwindcss": "^0.6.14",
|
|
||||||
"tailwindcss": "^3.3.6",
|
"tailwindcss": "^3.3.6",
|
||||||
"unplugin-auto-import": "^0.17.2",
|
"unplugin-auto-import": "^0.17.2",
|
||||||
"unplugin-element-plus": "^0.8.0",
|
"unplugin-element-plus": "^0.8.0",
|
||||||
@@ -793,19 +789,6 @@
|
|||||||
"node": ">=14"
|
"node": ">=14"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@pkgr/core": {
|
|
||||||
"version": "0.2.9",
|
|
||||||
"resolved": "https://registry.npmjs.org/@pkgr/core/-/core-0.2.9.tgz",
|
|
||||||
"integrity": "sha512-QNqXyfVS2wm9hweSYD2O7F0G06uurj9kZ96TRQE5Y9hU7+tgdZwIkbAKc5Ocy1HxEY2kuDQa6cQ1WRs/O5LFKA==",
|
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
|
||||||
"engines": {
|
|
||||||
"node": "^12.20.0 || ^14.18.0 || >=16.0.0"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://opencollective.com/pkgr"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@popperjs/core": {
|
"node_modules/@popperjs/core": {
|
||||||
"name": "@sxzz/popperjs-es",
|
"name": "@sxzz/popperjs-es",
|
||||||
"version": "2.11.7",
|
"version": "2.11.7",
|
||||||
@@ -1224,21 +1207,6 @@
|
|||||||
"integrity": "sha512-sGhTPMuXqZ1rVOk32RylztWkfXTRhuS7vgAKv0zjqk8gbsHkJ7xfFf+jbySxt7tWObEJwyKaHMikV/WGDiQm8g==",
|
"integrity": "sha512-sGhTPMuXqZ1rVOk32RylztWkfXTRhuS7vgAKv0zjqk8gbsHkJ7xfFf+jbySxt7tWObEJwyKaHMikV/WGDiQm8g==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/@vue/eslint-config-prettier": {
|
|
||||||
"version": "10.2.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/@vue/eslint-config-prettier/-/eslint-config-prettier-10.2.0.tgz",
|
|
||||||
"integrity": "sha512-GL3YBLwv/+b86yHcNNfPJxOTtVFJ4Mbc9UU3zR+KVoG7SwGTjPT+32fXamscNumElhcpXW3mT0DgzS9w32S7Bw==",
|
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"eslint-config-prettier": "^10.0.1",
|
|
||||||
"eslint-plugin-prettier": "^5.2.2"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"eslint": ">= 8.21.0",
|
|
||||||
"prettier": ">= 3.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@vue/reactivity": {
|
"node_modules/@vue/reactivity": {
|
||||||
"version": "3.5.18",
|
"version": "3.5.18",
|
||||||
"resolved": "https://registry.npmmirror.com/@vue/reactivity/-/reactivity-3.5.18.tgz",
|
"resolved": "https://registry.npmmirror.com/@vue/reactivity/-/reactivity-3.5.18.tgz",
|
||||||
@@ -2116,53 +2084,6 @@
|
|||||||
"url": "https://opencollective.com/eslint"
|
"url": "https://opencollective.com/eslint"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/eslint-config-prettier": {
|
|
||||||
"version": "10.1.8",
|
|
||||||
"resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-10.1.8.tgz",
|
|
||||||
"integrity": "sha512-82GZUjRS0p/jganf6q1rEO25VSoHH0hKPCTrgillPjdI/3bgBhAE1QzHrHTizjpRvy6pGAvKjDJtk2pF9NDq8w==",
|
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
|
||||||
"bin": {
|
|
||||||
"eslint-config-prettier": "bin/cli.js"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://opencollective.com/eslint-config-prettier"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"eslint": ">=7.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/eslint-plugin-prettier": {
|
|
||||||
"version": "5.5.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.5.4.tgz",
|
|
||||||
"integrity": "sha512-swNtI95SToIz05YINMA6Ox5R057IMAmWZ26GqPxusAp1TZzj+IdY9tXNWWD3vkF/wEqydCONcwjTFpxybBqZsg==",
|
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"prettier-linter-helpers": "^1.0.0",
|
|
||||||
"synckit": "^0.11.7"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": "^14.18.0 || >=16.0.0"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://opencollective.com/eslint-plugin-prettier"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"@types/eslint": ">=8.0.0",
|
|
||||||
"eslint": ">=8.0.0",
|
|
||||||
"eslint-config-prettier": ">= 7.0.0 <10.0.0 || >=10.1.0",
|
|
||||||
"prettier": ">=3.0.0"
|
|
||||||
},
|
|
||||||
"peerDependenciesMeta": {
|
|
||||||
"@types/eslint": {
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"eslint-config-prettier": {
|
|
||||||
"optional": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/eslint-plugin-vue": {
|
"node_modules/eslint-plugin-vue": {
|
||||||
"version": "9.33.0",
|
"version": "9.33.0",
|
||||||
"resolved": "https://registry.npmmirror.com/eslint-plugin-vue/-/eslint-plugin-vue-9.33.0.tgz",
|
"resolved": "https://registry.npmmirror.com/eslint-plugin-vue/-/eslint-plugin-vue-9.33.0.tgz",
|
||||||
@@ -2300,13 +2221,6 @@
|
|||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/fast-diff": {
|
|
||||||
"version": "1.3.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.3.0.tgz",
|
|
||||||
"integrity": "sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==",
|
|
||||||
"dev": true,
|
|
||||||
"license": "Apache-2.0"
|
|
||||||
},
|
|
||||||
"node_modules/fast-glob": {
|
"node_modules/fast-glob": {
|
||||||
"version": "3.3.3",
|
"version": "3.3.3",
|
||||||
"resolved": "https://registry.npmmirror.com/fast-glob/-/fast-glob-3.3.3.tgz",
|
"resolved": "https://registry.npmmirror.com/fast-glob/-/fast-glob-3.3.3.tgz",
|
||||||
@@ -3624,122 +3538,6 @@
|
|||||||
"node": ">= 0.8.0"
|
"node": ">= 0.8.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/prettier": {
|
|
||||||
"version": "3.6.2",
|
|
||||||
"resolved": "https://registry.npmmirror.com/prettier/-/prettier-3.6.2.tgz",
|
|
||||||
"integrity": "sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ==",
|
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
|
||||||
"bin": {
|
|
||||||
"prettier": "bin/prettier.cjs"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=14"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/prettier/prettier?sponsor=1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/prettier-linter-helpers": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz",
|
|
||||||
"integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==",
|
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"fast-diff": "^1.1.2"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=6.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/prettier-plugin-tailwindcss": {
|
|
||||||
"version": "0.6.14",
|
|
||||||
"resolved": "https://registry.npmmirror.com/prettier-plugin-tailwindcss/-/prettier-plugin-tailwindcss-0.6.14.tgz",
|
|
||||||
"integrity": "sha512-pi2e/+ZygeIqntN+vC573BcW5Cve8zUB0SSAGxqpB4f96boZF4M3phPVoOFCeypwkpRYdi7+jQ5YJJUwrkGUAg==",
|
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
|
||||||
"engines": {
|
|
||||||
"node": ">=14.21.3"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"@ianvs/prettier-plugin-sort-imports": "*",
|
|
||||||
"@prettier/plugin-hermes": "*",
|
|
||||||
"@prettier/plugin-oxc": "*",
|
|
||||||
"@prettier/plugin-pug": "*",
|
|
||||||
"@shopify/prettier-plugin-liquid": "*",
|
|
||||||
"@trivago/prettier-plugin-sort-imports": "*",
|
|
||||||
"@zackad/prettier-plugin-twig": "*",
|
|
||||||
"prettier": "^3.0",
|
|
||||||
"prettier-plugin-astro": "*",
|
|
||||||
"prettier-plugin-css-order": "*",
|
|
||||||
"prettier-plugin-import-sort": "*",
|
|
||||||
"prettier-plugin-jsdoc": "*",
|
|
||||||
"prettier-plugin-marko": "*",
|
|
||||||
"prettier-plugin-multiline-arrays": "*",
|
|
||||||
"prettier-plugin-organize-attributes": "*",
|
|
||||||
"prettier-plugin-organize-imports": "*",
|
|
||||||
"prettier-plugin-sort-imports": "*",
|
|
||||||
"prettier-plugin-style-order": "*",
|
|
||||||
"prettier-plugin-svelte": "*"
|
|
||||||
},
|
|
||||||
"peerDependenciesMeta": {
|
|
||||||
"@ianvs/prettier-plugin-sort-imports": {
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"@prettier/plugin-hermes": {
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"@prettier/plugin-oxc": {
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"@prettier/plugin-pug": {
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"@shopify/prettier-plugin-liquid": {
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"@trivago/prettier-plugin-sort-imports": {
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"@zackad/prettier-plugin-twig": {
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"prettier-plugin-astro": {
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"prettier-plugin-css-order": {
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"prettier-plugin-import-sort": {
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"prettier-plugin-jsdoc": {
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"prettier-plugin-marko": {
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"prettier-plugin-multiline-arrays": {
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"prettier-plugin-organize-attributes": {
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"prettier-plugin-organize-imports": {
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"prettier-plugin-sort-imports": {
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"prettier-plugin-style-order": {
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"prettier-plugin-svelte": {
|
|
||||||
"optional": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/proxy-from-env": {
|
"node_modules/proxy-from-env": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"resolved": "https://registry.npmmirror.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
|
"resolved": "https://registry.npmmirror.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
|
||||||
@@ -4238,22 +4036,6 @@
|
|||||||
"url": "https://github.com/sponsors/ljharb"
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/synckit": {
|
|
||||||
"version": "0.11.11",
|
|
||||||
"resolved": "https://registry.npmjs.org/synckit/-/synckit-0.11.11.tgz",
|
|
||||||
"integrity": "sha512-MeQTA1r0litLUf0Rp/iisCaL8761lKAZHaimlbGK4j0HysC4PLfqygQj9srcs0m2RdtDYnF8UuYyKpbjHYp7Jw==",
|
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"@pkgr/core": "^0.2.9"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": "^14.18.0 || >=16.0.0"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://opencollective.com/synckit"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/tailwindcss": {
|
"node_modules/tailwindcss": {
|
||||||
"version": "3.4.17",
|
"version": "3.4.17",
|
||||||
"resolved": "https://registry.npmmirror.com/tailwindcss/-/tailwindcss-3.4.17.tgz",
|
"resolved": "https://registry.npmmirror.com/tailwindcss/-/tailwindcss-3.4.17.tgz",
|
||||||
|
|||||||
@@ -7,8 +7,7 @@
|
|||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "vite build",
|
"build": "vite build",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs --fix --ignore-path .gitignore",
|
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs --fix --ignore-path .gitignore"
|
||||||
"format": "prettier --write src/"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fortawesome/fontawesome-free": "^6.5.1",
|
"@fortawesome/fontawesome-free": "^6.5.1",
|
||||||
@@ -22,14 +21,10 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@vitejs/plugin-vue": "^4.5.2",
|
"@vitejs/plugin-vue": "^4.5.2",
|
||||||
"@vue/eslint-config-prettier": "^10.2.0",
|
|
||||||
"autoprefixer": "^10.4.16",
|
"autoprefixer": "^10.4.16",
|
||||||
"eslint": "^8.55.0",
|
"eslint": "^8.55.0",
|
||||||
"eslint-plugin-prettier": "^5.5.4",
|
|
||||||
"eslint-plugin-vue": "^9.19.2",
|
"eslint-plugin-vue": "^9.19.2",
|
||||||
"postcss": "^8.4.32",
|
"postcss": "^8.4.32",
|
||||||
"prettier": "^3.1.1",
|
|
||||||
"prettier-plugin-tailwindcss": "^0.6.14",
|
|
||||||
"tailwindcss": "^3.3.6",
|
"tailwindcss": "^3.3.6",
|
||||||
"unplugin-auto-import": "^0.17.2",
|
"unplugin-auto-import": "^0.17.2",
|
||||||
"unplugin-element-plus": "^0.8.0",
|
"unplugin-element-plus": "^0.8.0",
|
||||||
|
|||||||
@@ -396,37 +396,86 @@
|
|||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label class="mb-3 block text-sm font-semibold text-gray-700"
|
<label class="mb-3 block text-sm font-semibold text-gray-700"
|
||||||
>支持的模型 (可选)--注意,ClaudeCode必须加上haiku模型!</label
|
>模型映射表 (可选)</label
|
||||||
>
|
>
|
||||||
<div class="mb-2 flex gap-2">
|
<div class="mb-3 rounded-lg bg-blue-50 p-3">
|
||||||
|
<p class="text-xs text-blue-700">
|
||||||
|
<i class="fas fa-info-circle mr-1" />
|
||||||
|
留空表示支持所有模型且不修改请求。配置映射后,左侧模型会被识别为支持的模型,右侧是实际发送的模型。
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 模型映射表 -->
|
||||||
|
<div class="mb-3 space-y-2">
|
||||||
|
<div
|
||||||
|
v-for="(mapping, index) in modelMappings"
|
||||||
|
:key="index"
|
||||||
|
class="flex items-center gap-2"
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
v-model="mapping.from"
|
||||||
|
class="form-input flex-1"
|
||||||
|
placeholder="原始模型名称"
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
<i class="fas fa-arrow-right text-gray-400" />
|
||||||
|
<input
|
||||||
|
v-model="mapping.to"
|
||||||
|
class="form-input flex-1"
|
||||||
|
placeholder="映射后的模型名称"
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
<button
|
||||||
|
class="rounded-lg p-2 text-red-500 transition-colors hover:bg-red-50"
|
||||||
|
type="button"
|
||||||
|
@click="removeModelMapping(index)"
|
||||||
|
>
|
||||||
|
<i class="fas fa-trash" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 添加映射按钮 -->
|
||||||
|
<button
|
||||||
|
class="w-full rounded-lg border-2 border-dashed border-gray-300 px-4 py-2 text-gray-600 transition-colors hover:border-gray-400 hover:text-gray-700"
|
||||||
|
type="button"
|
||||||
|
@click="addModelMapping"
|
||||||
|
>
|
||||||
|
<i class="fas fa-plus mr-2" />
|
||||||
|
添加模型映射
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<!-- 快捷添加按钮 -->
|
||||||
|
<div class="mt-3 flex flex-wrap gap-2">
|
||||||
<button
|
<button
|
||||||
class="rounded-lg bg-blue-100 px-3 py-1 text-xs text-blue-700 transition-colors hover:bg-blue-200"
|
class="rounded-lg bg-blue-100 px-3 py-1 text-xs text-blue-700 transition-colors hover:bg-blue-200"
|
||||||
type="button"
|
type="button"
|
||||||
@click="addPresetModel('claude-sonnet-4-20250514')"
|
@click="addPresetMapping('claude-sonnet-4-20250514', 'claude-sonnet-4-20250514')"
|
||||||
>
|
>
|
||||||
+ claude-sonnet-4-20250514
|
+ Sonnet 4
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
class="rounded-lg bg-purple-100 px-3 py-1 text-xs text-purple-700 transition-colors hover:bg-purple-200"
|
class="rounded-lg bg-purple-100 px-3 py-1 text-xs text-purple-700 transition-colors hover:bg-purple-200"
|
||||||
type="button"
|
type="button"
|
||||||
@click="addPresetModel('claude-opus-4-20250514')"
|
@click="addPresetMapping('claude-opus-4-1-20250805', 'claude-opus-4-1-20250805')"
|
||||||
>
|
>
|
||||||
+ claude-opus-4-20250514
|
+ Opus 4.1
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
class="rounded-lg bg-green-100 px-3 py-1 text-xs text-green-700 transition-colors hover:bg-purple-200"
|
class="rounded-lg bg-green-100 px-3 py-1 text-xs text-green-700 transition-colors hover:bg-green-200"
|
||||||
type="button"
|
type="button"
|
||||||
@click="addPresetModel('claude-3-5-haiku-20241022')"
|
@click="addPresetMapping('claude-3-5-haiku-20241022', 'claude-3-5-haiku-20241022')"
|
||||||
>
|
>
|
||||||
+ claude-3-5-haiku-20241022
|
+ Haiku 3.5
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
class="rounded-lg bg-orange-100 px-3 py-1 text-xs text-orange-700 transition-colors hover:bg-orange-200"
|
||||||
|
type="button"
|
||||||
|
@click="addPresetMapping('claude-opus-4-1-20250805', 'claude-sonnet-4-20250514')"
|
||||||
|
>
|
||||||
|
+ Opus 4.1 → Sonnet 4
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<textarea
|
|
||||||
v-model="form.supportedModels"
|
|
||||||
class="form-input w-full resize-none"
|
|
||||||
placeholder="每行一个模型,留空表示支持所有模型。特别注意,ClaudeCode必须加上haiku模型!"
|
|
||||||
rows="3"
|
|
||||||
/>
|
|
||||||
<p class="mt-1 text-xs text-gray-500">
|
<p class="mt-1 text-xs text-gray-500">
|
||||||
留空表示支持所有模型。如果指定模型,请求中的模型不在列表内将不会调度到此账号
|
留空表示支持所有模型。如果指定模型,请求中的模型不在列表内将不会调度到此账号
|
||||||
</p>
|
</p>
|
||||||
@@ -889,37 +938,91 @@
|
|||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label class="mb-3 block text-sm font-semibold text-gray-700"
|
<label class="mb-3 block text-sm font-semibold text-gray-700"
|
||||||
>支持的模型 (可选)</label
|
>模型映射表 (可选)</label
|
||||||
>
|
>
|
||||||
<div class="mb-2 flex gap-2">
|
<div class="mb-3 rounded-lg bg-blue-50 p-3">
|
||||||
|
<p class="text-xs text-blue-700">
|
||||||
|
<i class="fas fa-info-circle mr-1" />
|
||||||
|
留空表示支持所有模型且不修改请求。配置映射后,左侧模型会被识别为支持的模型,右侧是实际发送的模型。
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 模型映射表 -->
|
||||||
|
<div class="mb-3 space-y-2">
|
||||||
|
<div
|
||||||
|
v-for="(mapping, index) in modelMappings"
|
||||||
|
:key="index"
|
||||||
|
class="flex items-center gap-2"
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
v-model="mapping.from"
|
||||||
|
class="form-input flex-1"
|
||||||
|
placeholder="原始模型名称"
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
<i class="fas fa-arrow-right text-gray-400" />
|
||||||
|
<input
|
||||||
|
v-model="mapping.to"
|
||||||
|
class="form-input flex-1"
|
||||||
|
placeholder="映射后的模型名称"
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
<button
|
||||||
|
class="rounded-lg p-2 text-red-500 transition-colors hover:bg-red-50"
|
||||||
|
type="button"
|
||||||
|
@click="removeModelMapping(index)"
|
||||||
|
>
|
||||||
|
<i class="fas fa-trash" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 添加映射按钮 -->
|
||||||
|
<button
|
||||||
|
class="w-full rounded-lg border-2 border-dashed border-gray-300 px-4 py-2 text-gray-600 transition-colors hover:border-gray-400 hover:text-gray-700"
|
||||||
|
type="button"
|
||||||
|
@click="addModelMapping"
|
||||||
|
>
|
||||||
|
<i class="fas fa-plus mr-2" />
|
||||||
|
添加模型映射
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<!-- 快捷添加按钮 -->
|
||||||
|
<div class="mt-3 flex flex-wrap gap-2">
|
||||||
<button
|
<button
|
||||||
class="rounded-lg bg-blue-100 px-3 py-1 text-xs text-blue-700 transition-colors hover:bg-blue-200"
|
class="rounded-lg bg-blue-100 px-3 py-1 text-xs text-blue-700 transition-colors hover:bg-blue-200"
|
||||||
type="button"
|
type="button"
|
||||||
@click="addPresetModel('claude-sonnet-4-20250514')"
|
@click="addPresetMapping('claude-sonnet-4-20250514', 'claude-sonnet-4-20250514')"
|
||||||
>
|
>
|
||||||
+ claude-sonnet-4-20250514
|
+ Sonnet 4
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
class="rounded-lg bg-purple-100 px-3 py-1 text-xs text-purple-700 transition-colors hover:bg-purple-200"
|
class="rounded-lg bg-purple-100 px-3 py-1 text-xs text-purple-700 transition-colors hover:bg-purple-200"
|
||||||
type="button"
|
type="button"
|
||||||
@click="addPresetModel('claude-opus-4-20250514')"
|
@click="addPresetMapping('claude-opus-4-1-20250805', 'claude-opus-4-1-20250805')"
|
||||||
>
|
>
|
||||||
+ claude-opus-4-20250514
|
+ Opus 4.1
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
class="rounded-lg bg-green-100 px-3 py-1 text-xs text-green-700 transition-colors hover:bg-purple-200"
|
class="rounded-lg bg-green-100 px-3 py-1 text-xs text-green-700 transition-colors hover:bg-green-200"
|
||||||
type="button"
|
type="button"
|
||||||
@click="addPresetModel('claude-3-5-haiku-20241022')"
|
@click="
|
||||||
|
addPresetMapping('claude-3-5-haiku-20241022', 'claude-3-5-haiku-20241022')
|
||||||
|
"
|
||||||
>
|
>
|
||||||
+ claude-3-5-haiku-20241022
|
+ Haiku 3.5
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
class="rounded-lg bg-orange-100 px-3 py-1 text-xs text-orange-700 transition-colors hover:bg-orange-200"
|
||||||
|
type="button"
|
||||||
|
@click="addPresetMapping('claude-opus-4-1-20250805', 'claude-sonnet-4-20250514')"
|
||||||
|
>
|
||||||
|
+ Opus 4.1 → Sonnet 4
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<textarea
|
<p class="mt-1 text-xs text-gray-500">
|
||||||
v-model="form.supportedModels"
|
留空表示支持所有模型。如果指定模型,请求中的模型不在列表内将不会调度到此账号
|
||||||
class="form-input w-full resize-none"
|
</p>
|
||||||
placeholder="每行一个模型,留空表示支持所有模型。特别注意,ClaudeCode必须加上haiku模型!"
|
|
||||||
rows="3"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
@@ -1240,6 +1343,31 @@ const form = ref({
|
|||||||
smallFastModel: props.account?.smallFastModel || ''
|
smallFastModel: props.account?.smallFastModel || ''
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 模型映射表数据
|
||||||
|
const modelMappings = ref([])
|
||||||
|
|
||||||
|
// 初始化模型映射表
|
||||||
|
const initModelMappings = () => {
|
||||||
|
if (props.account?.supportedModels) {
|
||||||
|
// 如果是对象格式(新的映射表)
|
||||||
|
if (
|
||||||
|
typeof props.account.supportedModels === 'object' &&
|
||||||
|
!Array.isArray(props.account.supportedModels)
|
||||||
|
) {
|
||||||
|
modelMappings.value = Object.entries(props.account.supportedModels).map(([from, to]) => ({
|
||||||
|
from,
|
||||||
|
to
|
||||||
|
}))
|
||||||
|
} else if (Array.isArray(props.account.supportedModels)) {
|
||||||
|
// 如果是数组格式(旧格式),转换为映射表
|
||||||
|
modelMappings.value = props.account.supportedModels.map((model) => ({
|
||||||
|
from: model,
|
||||||
|
to: model
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 表单验证错误
|
// 表单验证错误
|
||||||
const errors = ref({
|
const errors = ref({
|
||||||
name: '',
|
name: '',
|
||||||
@@ -1353,15 +1481,28 @@ const copySetupTokenAuthUrl = async () => {
|
|||||||
setupTokenCopied.value = false
|
setupTokenCopied.value = false
|
||||||
}, 2000)
|
}, 2000)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// 降级方案
|
// 降级方案 - 使用 textarea 替代 input,禁用 ESLint 警告
|
||||||
const input = document.createElement('input')
|
const textarea = document.createElement('textarea')
|
||||||
input.value = setupTokenAuthUrl.value
|
textarea.value = setupTokenAuthUrl.value
|
||||||
document.body.appendChild(input)
|
textarea.style.position = 'fixed'
|
||||||
input.select()
|
textarea.style.opacity = '0'
|
||||||
document.execCommand('copy')
|
document.body.appendChild(textarea)
|
||||||
document.body.removeChild(input)
|
textarea.select()
|
||||||
setupTokenCopied.value = true
|
|
||||||
showToast('链接已复制', 'success')
|
try {
|
||||||
|
// eslint-disable-next-line
|
||||||
|
const successful = document.execCommand('copy')
|
||||||
|
if (successful) {
|
||||||
|
setupTokenCopied.value = true
|
||||||
|
showToast('链接已复制', 'success')
|
||||||
|
} else {
|
||||||
|
showToast('复制失败,请手动复制', 'error')
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
showToast('复制失败,请手动复制', 'error')
|
||||||
|
}
|
||||||
|
|
||||||
|
document.body.removeChild(textarea)
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
setupTokenCopied.value = false
|
setupTokenCopied.value = false
|
||||||
}, 2000)
|
}, 2000)
|
||||||
@@ -1561,9 +1702,7 @@ const createAccount = async () => {
|
|||||||
data.apiUrl = form.value.apiUrl
|
data.apiUrl = form.value.apiUrl
|
||||||
data.apiKey = form.value.apiKey
|
data.apiKey = form.value.apiKey
|
||||||
data.priority = form.value.priority || 50
|
data.priority = form.value.priority || 50
|
||||||
data.supportedModels = form.value.supportedModels
|
data.supportedModels = convertMappingsToObject() || {}
|
||||||
? form.value.supportedModels.split('\n').filter((m) => m.trim())
|
|
||||||
: []
|
|
||||||
data.userAgent = form.value.userAgent || null
|
data.userAgent = form.value.userAgent || null
|
||||||
data.rateLimitDuration = form.value.rateLimitDuration || 60
|
data.rateLimitDuration = form.value.rateLimitDuration || 60
|
||||||
} else if (form.value.platform === 'bedrock') {
|
} else if (form.value.platform === 'bedrock') {
|
||||||
@@ -1699,9 +1838,7 @@ const updateAccount = async () => {
|
|||||||
data.apiKey = form.value.apiKey
|
data.apiKey = form.value.apiKey
|
||||||
}
|
}
|
||||||
data.priority = form.value.priority || 50
|
data.priority = form.value.priority || 50
|
||||||
data.supportedModels = form.value.supportedModels
|
data.supportedModels = convertMappingsToObject() || {}
|
||||||
? form.value.supportedModels.split('\n').filter((m) => m.trim())
|
|
||||||
: []
|
|
||||||
data.userAgent = form.value.userAgent || null
|
data.userAgent = form.value.userAgent || null
|
||||||
data.rateLimitDuration = form.value.rateLimitDuration || 60
|
data.rateLimitDuration = form.value.rateLimitDuration || 60
|
||||||
}
|
}
|
||||||
@@ -1914,23 +2051,38 @@ watch(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
// 添加预设模型
|
// 添加模型映射
|
||||||
const addPresetModel = (modelName) => {
|
const addModelMapping = () => {
|
||||||
// 获取当前模型列表
|
modelMappings.value.push({ from: '', to: '' })
|
||||||
const currentModels = form.value.supportedModels
|
}
|
||||||
? form.value.supportedModels.split('\n').filter((m) => m.trim())
|
|
||||||
: []
|
|
||||||
|
|
||||||
// 检查是否已存在
|
// 移除模型映射
|
||||||
if (currentModels.includes(modelName)) {
|
const removeModelMapping = (index) => {
|
||||||
showToast(`模型 ${modelName} 已存在`, 'info')
|
modelMappings.value.splice(index, 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加预设映射
|
||||||
|
const addPresetMapping = (from, to) => {
|
||||||
|
// 检查是否已存在相同的映射
|
||||||
|
const exists = modelMappings.value.some((mapping) => mapping.from === from)
|
||||||
|
if (exists) {
|
||||||
|
showToast(`模型 ${from} 的映射已存在`, 'info')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 添加到列表
|
modelMappings.value.push({ from, to })
|
||||||
currentModels.push(modelName)
|
showToast(`已添加映射: ${from} → ${to}`, 'success')
|
||||||
form.value.supportedModels = currentModels.join('\n')
|
}
|
||||||
showToast(`已添加模型 ${modelName}`, 'success')
|
|
||||||
|
// 将模型映射表转换为对象格式
|
||||||
|
const convertMappingsToObject = () => {
|
||||||
|
const mapping = {}
|
||||||
|
modelMappings.value.forEach((item) => {
|
||||||
|
if (item.from && item.to) {
|
||||||
|
mapping[item.from] = item.to
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return Object.keys(mapping).length > 0 ? mapping : null
|
||||||
}
|
}
|
||||||
|
|
||||||
// 监听账户变化,更新表单
|
// 监听账户变化,更新表单
|
||||||
@@ -1938,6 +2090,7 @@ watch(
|
|||||||
() => props.account,
|
() => props.account,
|
||||||
(newAccount) => {
|
(newAccount) => {
|
||||||
if (newAccount) {
|
if (newAccount) {
|
||||||
|
initModelMappings()
|
||||||
// 重新初始化代理配置
|
// 重新初始化代理配置
|
||||||
const proxyConfig =
|
const proxyConfig =
|
||||||
newAccount.proxy && newAccount.proxy.host && newAccount.proxy.port
|
newAccount.proxy && newAccount.proxy.host && newAccount.proxy.port
|
||||||
|
|||||||
Reference in New Issue
Block a user