fix: add support for claude.ai reverse proxy

This commit is contained in:
ikechan8370 2023-09-13 20:25:02 +08:00
parent bb51e53e02
commit 08e92d871e
3 changed files with 13 additions and 4 deletions

View file

@ -103,8 +103,9 @@ export class ClaudeAIClient {
// redirect: 'manual'
// // referrer: 'https://claude.ai/chat/bba5a67d-ee59-4196-a371-ece8a35db1f2'
// })
let host = Config.claudeAIReverseProxy || 'https://claude.ai'
const cycleTLS = await initCycleTLS()
let result = await cycleTLS(`https://claude.ai/api/organizations/${this.organizationId}/chat_conversations`, {
let result = await cycleTLS(`${host}/api/organizations/${this.organizationId}/chat_conversations`, {
ja3: this.JA3,
userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36',
proxy: this.proxy,
@ -140,7 +141,8 @@ export class ClaudeAIClient {
timezone: 'Asia/Hong_Kong'
}
}
let url = 'https://claude.ai/api/append_message'
let host = Config.claudeAIReverseProxy || 'https://claude.ai'
let url = host + '/api/append_message'
const cycleTLS = await initCycleTLS()
let streamDataRes = await cycleTLS(url, {
ja3: this.JA3,

View file

@ -147,6 +147,7 @@ const defaultConfig = {
// claude2
claudeAIOrganizationId: '',
claudeAISessionKey: '',
claudeAIReverseProxy: '',
claudeAIJA3: '772,4865-4866-4867-49195-49199-49196-49200-52393-52392-49171-49172-156-157-47-53,27-5-65281-13-35-0-51-18-16-43-10-45-11-17513-23,29-23-24,0',
claudeAIUA: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36',
version: 'v2.7.4'