mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-19 22:52:08 +08:00
🐛 fix: agent OAuth support and fast model settings
- Fix agent OAuth authentication by routing through proxy API server - Update model environment variables to use ANTHROPIC_DEFAULT_*_MODEL - Allow forwarding of sentry-trace, baggage, content-length, connection headers Fixes #10785, #11014
This commit is contained in:
parent
0767952a6f
commit
ef22e74794
@ -7,15 +7,7 @@ import { Provider } from '@types'
|
|||||||
import { Response } from 'express'
|
import { Response } from 'express'
|
||||||
|
|
||||||
const logger = loggerService.withContext('MessagesService')
|
const logger = loggerService.withContext('MessagesService')
|
||||||
const EXCLUDED_FORWARD_HEADERS: ReadonlySet<string> = new Set([
|
const EXCLUDED_FORWARD_HEADERS: ReadonlySet<string> = new Set(['host', 'x-api-key', 'authorization'])
|
||||||
'host',
|
|
||||||
'x-api-key',
|
|
||||||
'authorization',
|
|
||||||
'sentry-trace',
|
|
||||||
'baggage',
|
|
||||||
'content-length',
|
|
||||||
'connection'
|
|
||||||
])
|
|
||||||
|
|
||||||
export interface ValidationResult {
|
export interface ValidationResult {
|
||||||
isValid: boolean
|
isValid: boolean
|
||||||
|
|||||||
@ -98,14 +98,17 @@ class ClaudeCodeService implements AgentServiceInterface {
|
|||||||
const env = {
|
const env = {
|
||||||
...loginShellEnvWithoutProxies,
|
...loginShellEnvWithoutProxies,
|
||||||
// TODO: fix the proxy api server
|
// TODO: fix the proxy api server
|
||||||
// ANTHROPIC_API_KEY: apiConfig.apiKey,
|
ANTHROPIC_API_KEY: apiConfig.apiKey,
|
||||||
// ANTHROPIC_AUTH_TOKEN: apiConfig.apiKey,
|
ANTHROPIC_AUTH_TOKEN: apiConfig.apiKey,
|
||||||
// ANTHROPIC_BASE_URL: `http://${apiConfig.host}:${apiConfig.port}/${modelInfo.provider.id}`,
|
ANTHROPIC_BASE_URL: `http://${apiConfig.host}:${apiConfig.port}/${modelInfo.provider.id}`,
|
||||||
ANTHROPIC_API_KEY: modelInfo.provider.apiKey,
|
// ANTHROPIC_API_KEY: modelInfo.provider.apiKey,
|
||||||
ANTHROPIC_AUTH_TOKEN: modelInfo.provider.apiKey,
|
// ANTHROPIC_AUTH_TOKEN: modelInfo.provider.apiKey,
|
||||||
ANTHROPIC_BASE_URL: modelInfo.provider.anthropicApiHost?.trim() || modelInfo.provider.apiHost,
|
// ANTHROPIC_BASE_URL: modelInfo.provider.anthropicApiHost?.trim() || modelInfo.provider.apiHost,
|
||||||
ANTHROPIC_MODEL: modelInfo.modelId,
|
ANTHROPIC_MODEL: modelInfo.modelId,
|
||||||
ANTHROPIC_SMALL_FAST_MODEL: modelInfo.modelId,
|
ANTHROPIC_DEFAULT_OPUS_MODEL: modelInfo.modelId,
|
||||||
|
ANTHROPIC_DEFAULT_SONNET_MODEL: modelInfo.modelId,
|
||||||
|
// TODO: support set small model in UI
|
||||||
|
ANTHROPIC_DEFAULT_HAIKU_MODEL: modelInfo.modelId,
|
||||||
ELECTRON_RUN_AS_NODE: '1',
|
ELECTRON_RUN_AS_NODE: '1',
|
||||||
ELECTRON_NO_ATTACH_CONSOLE: '1'
|
ELECTRON_NO_ATTACH_CONSOLE: '1'
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user