From 720469dfc83d1bf1add59a5ba429456740410308 Mon Sep 17 00:00:00 2001 From: aedes Date: Tue, 21 Apr 2026 17:18:48 +0300 Subject: [PATCH] fix: proxy only Anthropic via VPS; sechenov direct (VPS was banned) --- server.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/server.js b/server.js index f7b4a56..5ba2808 100644 --- a/server.js +++ b/server.js @@ -2,13 +2,11 @@ const express = require('express'); const path = require('path'); const fs = require('fs'); const os = require('os'); -const { ProxyAgent, setGlobalDispatcher } = require('undici'); +const { ProxyAgent } = require('undici'); const proxyUrl = process.env.HTTPS_PROXY || process.env.HTTP_PROXY; -if (proxyUrl) { - setGlobalDispatcher(new ProxyAgent(proxyUrl)); - console.log(`✓ Using proxy: ${proxyUrl}`); -} +const anthropicAgent = proxyUrl ? new ProxyAgent(proxyUrl) : undefined; +if (proxyUrl) console.log(`✓ Anthropic proxy: ${proxyUrl} (sechenov: direct)`); const app = express(); const PUBLIC_DIR = path.join(__dirname, 'public'); @@ -57,6 +55,7 @@ const SYSTEM_PROMPT = [ async function callClaude(modelId, text, accessToken) { return fetch('https://api.anthropic.com/v1/messages', { method: 'POST', + dispatcher: anthropicAgent, headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${accessToken}`,