feat: 添加vLLM适配器、修复SSE流式输出和中间件问题
CI / lint (push) Has been cancelled
CI / test (push) Has been cancelled
CI / build (push) Has been cancelled
CI / security-scan (push) Has been cancelled

- 新增 vLLM 适配器 (internal/adapter/vllm.go),支持 OpenAI 兼容 API
- 修复 responseWriter 未实现 http.Flusher 导致 SSE 流式输出 500 错误
- 调整中间件顺序:BodyLimit 移至 Auth 之前,提前拒绝超大请求
- BodyLimit 增强:检查 Content-Length header
- 导出 Server.Authenticator() 方法供测试使用
- 配置更新:使用本地 deepseek-r1:1.5b 模型,新增 vllm-chat 逻辑模型
- 修复 handlers.go 中未使用的 target 参数 lint 警告
This commit is contained in:
freedakgmail
2026-08-03 07:52:50 +08:00
parent 93a469061d
commit 63eec59773
5 changed files with 331 additions and 4 deletions
+6
View File
@@ -95,6 +95,12 @@ func (rw *responseWriter) WriteHeader(code int) {
rw.ResponseWriter.WriteHeader(code)
}
func (rw *responseWriter) Flush() {
if f, ok := rw.ResponseWriter.(http.Flusher); ok {
f.Flush()
}
}
// GetRequestID extracts the request ID from context.
func GetRequestID(ctx context.Context) string {
if v, ok := ctx.Value(RequestIDKey).(string); ok {