Skip to content

Commit 01f782b

Browse files
committed
update
1 parent 24d49ce commit 01f782b

File tree

2 files changed

+12
-18
lines changed

2 files changed

+12
-18
lines changed

backend/internal/adapters/anthropic_adapter.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,6 @@ func NewAnthropicAdapter(cfg *config.Config, db *gorm.DB, cacheClient cache.Cach
3131

3232
// ProcessRequest handles the request for the Anthropic API.
3333
func (a *AnthropicAdapter) ProcessRequest() (*services.TargetRequest, error) {
34-
// Log all incoming headers for debugging
35-
for name, values := range a.c.Request.Header {
36-
for _, value := range values {
37-
logger.Infof("Incoming Header: %s: %s", name, value)
38-
}
39-
}
40-
4134
// 1. Authenticate the proxy request. Try 'x-api-key', 'x-anthropic-api-key', then 'Authorization' header.
4235
proxyKey := a.c.GetHeader("x-api-key")
4336
if proxyKey == "" {

frontend/vite.config.js

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,22 +36,23 @@ export default defineConfig(({ mode }) => {
3636
// 指定开发服务器端口,与 docker-compose.yml 中保持一致
3737
port: 5173,
3838
proxy: {
39-
// 将所有 /api 开头的请求代理到后端服务
39+
// 将所有 /admin 开头的请求代理到后端服务
40+
'/admin': {
41+
target: env.VITE_API_TARGET_URL || 'http://localhost:8000',
42+
changeOrigin: true,
43+
},
44+
// 将所有 /llm 开头的请求代理到后端服务
45+
'/llm': {
46+
target: env.VITE_API_TARGET_URL || 'http://localhost:8000',
47+
changeOrigin: true,
48+
},
49+
// 保留 /api 代理规则以实现兼容性
4050
'/api': {
41-
// 现在 env.VITE_API_TARGET_URL 可以被正确读取了
4251
target: env.VITE_API_TARGET_URL || 'http://localhost:8000',
43-
44-
// changeOrigin: true 对于代理是必需的,它会修改请求头中的 Host,
45-
// 使其与目标服务器匹配,很多后端服务都需要这个配置。
4652
changeOrigin: true,
47-
48-
// 如果您的后端 API 路由本身就包含了 /api (例如 /api/admin/login),
49-
// 那么就不需要 rewrite。
50-
// 如果后端路由是 /admin/login,而前端请求的是 /api/admin/login,
51-
// 那么就需要取消下面的注释来移除 /api 前缀。
5253
rewrite: (path) => path.replace(/^\/api/, ''),
5354
}
5455
}
5556
}
5657
}
57-
})
58+
})

0 commit comments

Comments
 (0)