feat: 添加vLLM适配器、修复SSE流式输出和中间件问题
- 新增 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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user