feat: 添加MCP调试插件并优化流式超时处理
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled

refactor(relay): 将Provider Key管理路由移至model_config模块
fix(saas): 修复demo_keys与provider_keys的匹配逻辑
perf(runtime): 将流式响应超时从60秒延长至180秒以适配思考型模型
docs: 新增模块化审计和上线前功能测试方案文档
chore: 添加tauri-plugin-mcp依赖及相关配置
This commit is contained in:
iven
2026-04-08 13:39:06 +08:00
parent 81d1702484
commit ade534d1ce
18 changed files with 2051 additions and 627 deletions

View File

@@ -4,7 +4,7 @@ pub mod types;
pub mod service;
pub mod handlers;
use axum::routing::{delete, get, post};
use axum::routing::{delete, get, post, put};
use crate::state::AppState;
/// 模型配置路由 (需要认证)
@@ -14,6 +14,10 @@ pub fn routes() -> axum::Router<AppState> {
.route("/api/v1/providers", get(handlers::list_providers).post(handlers::create_provider))
.route("/api/v1/providers/:id", get(handlers::get_provider).patch(handlers::update_provider).delete(handlers::delete_provider))
.route("/api/v1/providers/:id/models", get(handlers::list_provider_models))
// Provider Key Pool (admin only, moved from relay to avoid quota middleware)
.route("/api/v1/providers/:provider_id/keys", get(crate::relay::handlers::list_provider_keys).post(crate::relay::handlers::add_provider_key))
.route("/api/v1/providers/:provider_id/keys/:key_id/toggle", put(crate::relay::handlers::toggle_provider_key))
.route("/api/v1/providers/:provider_id/keys/:key_id", delete(crate::relay::handlers::delete_provider_key))
// Models
.route("/api/v1/models", get(handlers::list_models).post(handlers::create_model))
.route("/api/v1/models/:id", get(handlers::get_model).patch(handlers::update_model).delete(handlers::delete_model))

View File

@@ -230,7 +230,7 @@ pub async fn create_model(db: &PgPool, req: &CreateModelRequest) -> SaasResult<M
"INSERT INTO models (id, provider_id, model_id, alias, context_window, max_output_tokens, supports_streaming, supports_vision, enabled, pricing_input, pricing_output, created_at, updated_at)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, true, $9, $10, $11, $11)"
)
.bind(&id).bind(&req.provider_id).bind(&req.model_id).bind(&req.alias)
.bind(&id).bind(&req.provider_id).bind(&req.model_id).bind(req.alias.as_deref().unwrap_or(&req.model_id))
.bind(ctx).bind(max_out).bind(streaming).bind(vision).bind(pi).bind(po).bind(&now)
.execute(db).await.map_err(|e| SaasError::from_sqlx_unique(e, &format!("模型 '{}' 在 Provider '{}'", req.model_id, req.provider_id)))?;

View File

@@ -66,7 +66,7 @@ pub struct ModelInfo {
pub struct CreateModelRequest {
pub provider_id: String,
pub model_id: String,
pub alias: String,
pub alias: Option<String>,
pub context_window: Option<i64>,
pub max_output_tokens: Option<i64>,
pub supports_streaming: Option<bool>,