diff --git a/.gitignore b/.gitignore index 190bb19..2871092 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,7 @@ CLAUDE.md config.json provider_pools.json fetch_system_prompt.txt -input_system_prompt.txt \ No newline at end of file +input_system_prompt.txt +token-store.json +usage-cache.json +*_oauth_creds.json \ No newline at end of file diff --git a/install-and-run.bat b/install-and-run.bat old mode 100644 new mode 100755 diff --git a/install-and-run.sh b/install-and-run.sh old mode 100644 new mode 100755 diff --git a/jest.config.js b/jest.config.js index b61803a..c5f4a2a 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,7 +1,7 @@ export default { testEnvironment: 'node', transform: { - '^.+\\.js$': 'babel-jest', + '^.+\\.(js|mjs)$': 'babel-jest', }, transformIgnorePatterns: [ '/node_modules/(?!(uuid)/)', // uuid is an ESM module that needs to be transformed @@ -15,8 +15,7 @@ export default { '^(\\.{1,2}/.*)\\.js$': '$1' }, testMatch: [ - '**/tests/api-server.test.js', - '**/tests/api-integration.test.js' + '**/tests/**/*.test.js' ], collectCoverageFrom: [ 'src/**/*.js', diff --git a/package-lock.json b/package-lock.json index 80ddcb2..e1098a1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,5 @@ { - "name": "AIClient2API", + "name": "AIClient-2-API", "lockfileVersion": 3, "requires": true, "packages": { diff --git a/src/converters/strategies/GeminiConverter.js b/src/converters/strategies/GeminiConverter.js index 4e092a9..41a9d06 100644 --- a/src/converters/strategies/GeminiConverter.js +++ b/src/converters/strategies/GeminiConverter.js @@ -209,6 +209,7 @@ export class GeminiConverter extends BaseConverter { } if (part.functionCall) { toolCalls.push({ + index: toolCalls.length, id: part.functionCall.id || `call_${uuidv4()}`, type: 'function', function: { @@ -231,6 +232,11 @@ export class GeminiConverter extends BaseConverter { candidate.finishReason.toLowerCase(); } + // 如果包含工具调用,且完成原因为 stop,则将完成原因修改为 tool_calls + if (toolCalls.length > 0 && finishReason === 'stop') { + finishReason = 'tool_calls'; + } + // 构建delta对象 const delta = {}; if (content) delta.content = content; diff --git a/static/login.html b/static/login.html index 0c1bcce..5ad696e 100644 --- a/static/login.html +++ b/static/login.html @@ -219,7 +219,7 @@