mirror of
https://github.com/aiclientproxy/proxycast.git
synced 2026-09-24 23:10:56 +08:00
fix: 修复编译错误和 dead_code 警告
This commit is contained in:
@@ -29,6 +29,9 @@ __pycache__/
|
||||
.history
|
||||
docs/prd/
|
||||
|
||||
# Internal roadmap (private)
|
||||
docs/roadmap/
|
||||
|
||||
# Issues tracking (internal use only)
|
||||
.issues/
|
||||
|
||||
|
||||
@@ -202,6 +202,7 @@ fn build_system_prompt_with_skills(
|
||||
}
|
||||
|
||||
/// 图片输入参数
|
||||
#[allow(dead_code)]
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct ImageInputParam {
|
||||
pub data: String,
|
||||
|
||||
@@ -191,6 +191,7 @@ pub struct AsterChatRequest {
|
||||
pub session_id: String,
|
||||
pub event_name: String,
|
||||
#[serde(default)]
|
||||
#[allow(dead_code)]
|
||||
pub images: Option<Vec<ImageInput>>,
|
||||
/// Provider 配置(可选,如果未配置则使用当前配置)
|
||||
#[serde(default)]
|
||||
@@ -198,6 +199,7 @@ pub struct AsterChatRequest {
|
||||
}
|
||||
|
||||
/// 图片输入
|
||||
#[allow(dead_code)]
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct ImageInput {
|
||||
pub data: String,
|
||||
@@ -356,6 +358,7 @@ pub async fn aster_session_get(session_id: String) -> Result<SessionDetail, Stri
|
||||
pub struct ConfirmRequest {
|
||||
pub request_id: String,
|
||||
pub confirmed: bool,
|
||||
#[allow(dead_code)]
|
||||
pub response: Option<String>,
|
||||
}
|
||||
|
||||
|
||||
@@ -230,6 +230,7 @@ use tokio::sync::RwLock;
|
||||
/// 流式消息事件
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[serde(tag = "type", rename_all = "snake_case")]
|
||||
#[allow(dead_code)]
|
||||
pub enum StreamEvent {
|
||||
/// 开始生成
|
||||
Start { message_id: String },
|
||||
@@ -252,9 +253,11 @@ pub struct SendMessageRequest {
|
||||
pub event_name: String,
|
||||
/// Provider 配置(可选)
|
||||
#[serde(default)]
|
||||
#[allow(dead_code)]
|
||||
pub provider: Option<String>,
|
||||
/// 模型名称(可选)
|
||||
#[serde(default)]
|
||||
#[allow(dead_code)]
|
||||
pub model: Option<String>,
|
||||
}
|
||||
|
||||
|
||||
@@ -158,6 +158,7 @@ pub fn get_accessible_url(listen_host: &str, port: u16) -> String {
|
||||
///
|
||||
/// # 返回
|
||||
/// 格式为 `http://{host}:{port}` 的 URL
|
||||
#[allow(dead_code)]
|
||||
pub fn get_local_url(listen_host: &str, port: u16) -> String {
|
||||
let host = match listen_host {
|
||||
"0.0.0.0" | "localhost" => "127.0.0.1".to_string(),
|
||||
|
||||
@@ -22,6 +22,7 @@ use tauri::State;
|
||||
use tokio::sync::RwLock;
|
||||
|
||||
/// Workspace 管理器状态
|
||||
#[allow(dead_code)]
|
||||
pub struct WorkspaceManagerState(pub Arc<RwLock<Option<WorkspaceManager>>>);
|
||||
|
||||
/// Workspace 列表项(前端展示用)
|
||||
|
||||
@@ -230,6 +230,7 @@ pub struct VertexApiKeyEntry {
|
||||
pub disabled: bool,
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn default_auth_type() -> String {
|
||||
"oauth".to_string()
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
//!
|
||||
//! 定义请求处理过程中可能发生的错误
|
||||
|
||||
#![allow(dead_code)]
|
||||
|
||||
use thiserror::Error;
|
||||
|
||||
/// 处理错误
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
//!
|
||||
//! 验证请求的 API Key
|
||||
|
||||
#![allow(dead_code)]
|
||||
|
||||
use super::traits::{PipelineStep, StepError};
|
||||
use crate::processor::RequestContext;
|
||||
use async_trait::async_trait;
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
//!
|
||||
//! 根据配置的规则注入请求参数
|
||||
|
||||
#![allow(dead_code)]
|
||||
|
||||
use super::traits::{PipelineStep, StepError};
|
||||
use crate::injection::Injector;
|
||||
use crate::processor::RequestContext;
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
//!
|
||||
//! 执行插件的前置和后置钩子
|
||||
|
||||
#![allow(dead_code)]
|
||||
|
||||
use super::traits::{PipelineStep, StepError};
|
||||
use crate::plugin::PluginManager;
|
||||
use crate::processor::RequestContext;
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
//!
|
||||
//! 集成重试、故障转移和超时控制
|
||||
|
||||
#![allow(dead_code)]
|
||||
|
||||
use super::traits::{PipelineStep, StepError};
|
||||
use crate::processor::RequestContext;
|
||||
use crate::resilience::{
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
//!
|
||||
//! 记录请求统计和 Token 使用
|
||||
|
||||
#![allow(dead_code)]
|
||||
|
||||
use super::traits::{PipelineStep, StepError};
|
||||
use crate::processor::RequestContext;
|
||||
use crate::telemetry::{
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
//!
|
||||
//! 定义所有管道步骤必须实现的接口
|
||||
|
||||
#![allow(dead_code)]
|
||||
|
||||
use crate::processor::RequestContext;
|
||||
use async_trait::async_trait;
|
||||
use thiserror::Error;
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
//! let router = AmpRouter::new(config);
|
||||
//!
|
||||
//! // 解析 provider 路由
|
||||
|
||||
#![allow(dead_code)]
|
||||
//! let result = router.parse_provider_route("/api/provider/anthropic/v1/messages");
|
||||
//! assert!(result.is_some());
|
||||
//! ```
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
//!
|
||||
//! 解析请求路径,确定目标 Provider 和协议。
|
||||
|
||||
#![allow(dead_code)]
|
||||
|
||||
use super::route_registry::{RegisteredRoute, RouteRegistry, RouteType};
|
||||
use crate::models::provider_pool_model::PoolProviderType;
|
||||
use std::sync::Arc;
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
//!
|
||||
//! 管理所有注册的路由,支持动态添加和查询。
|
||||
|
||||
#![allow(dead_code)]
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::collections::HashMap;
|
||||
|
||||
|
||||
@@ -69,6 +69,7 @@ use crate::server_utils::{
|
||||
};
|
||||
use crate::session::store_thought_signature;
|
||||
use crate::stream::{PipelineConfig, StreamPipeline};
|
||||
use crate::streaming::traits::StreamingProvider;
|
||||
use crate::streaming::{
|
||||
StreamConfig, StreamContext, StreamError, StreamFormat as StreamingFormat, StreamManager,
|
||||
StreamResponse,
|
||||
|
||||
@@ -1077,6 +1077,7 @@ async fn count_tokens(
|
||||
/// Gemini 原生协议处理
|
||||
/// 路由: POST /v1/gemini/{model}:{method}
|
||||
/// 例如: /v1/gemini/gemini-3-pro-preview:generateContent
|
||||
#[allow(dead_code)]
|
||||
async fn gemini_generate_content(
|
||||
State(state): State<AppState>,
|
||||
headers: HeaderMap,
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
//! - 需求 1.5: 流式传输开始时发送 `message_start` 和 `content_block_start` 事件
|
||||
//! - 需求 1.6: 流式传输完成时发送 `content_block_stop`、`message_delta` 和 `message_stop` 事件
|
||||
|
||||
#![allow(dead_code)]
|
||||
|
||||
use crate::streaming::aws_parser::AwsEvent;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::collections::HashMap;
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
//! - 需求 2.5: 优雅处理错误并继续处理
|
||||
//! - 需求 2.6: 支持部分 chunk 的增量解析
|
||||
|
||||
#![allow(dead_code)]
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::collections::HashMap;
|
||||
|
||||
|
||||
@@ -14,9 +14,12 @@
|
||||
//! - 需求 6.3: Provider 错误转发
|
||||
//! - 需求 6.5: 可配置的流式响应超时
|
||||
|
||||
use crate::streaming::converter::StreamFormat;
|
||||
#![allow(dead_code)]
|
||||
|
||||
use crate::streaming::converter::{StreamConverter, StreamFormat};
|
||||
use crate::streaming::error::StreamError;
|
||||
use crate::streaming::metrics::StreamMetrics;
|
||||
use crate::streaming::traits::StreamResponse;
|
||||
use bytes::Bytes;
|
||||
use futures::{Stream, StreamExt};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
//! - 需求 4.5: 跟踪 chunk 数量和接收的总字节数
|
||||
//! - 需求 7.5: 记录流式指标(吞吐量、延迟、错误率)
|
||||
|
||||
#![allow(dead_code)]
|
||||
|
||||
use chrono::{DateTime, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tracing::info;
|
||||
|
||||
@@ -9,6 +9,10 @@
|
||||
//! - 需求 1.3: OpenAICustomProvider 流式支持
|
||||
//! - 需求 1.4: AntigravityProvider 流式支持
|
||||
|
||||
#![allow(dead_code)]
|
||||
|
||||
use crate::models::openai::ChatCompletionRequest;
|
||||
use crate::providers::ProviderError;
|
||||
use crate::streaming::StreamError;
|
||||
use async_trait::async_trait;
|
||||
use bytes::Bytes;
|
||||
|
||||
@@ -6,13 +6,14 @@
|
||||
//! - 流式响应转发
|
||||
//! - 心跳检测和连接生命周期管理
|
||||
|
||||
#![allow(dead_code)]
|
||||
|
||||
mod handler;
|
||||
mod lifecycle;
|
||||
mod processor;
|
||||
mod stream;
|
||||
mod types;
|
||||
|
||||
pub use handler::ws_handler;
|
||||
pub use processor::MessageProcessor;
|
||||
pub use types::{
|
||||
KiroTokenInfo, WsApiRequest, WsApiResponse, WsConfig, WsConnection, WsEndpoint, WsError,
|
||||
|
||||
Reference in New Issue
Block a user