Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions desktop-tauri/i18n/i18n-src/en/requests.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@
"在路由页查看": "View on the Routing page",
"在途 {n}": "",
"处理中": "Processing",
"辅助识图": "Assisted image reading",
"切换视觉模型": "Vision model reroute",
"已完成": "Completed",
"失败": "Failed",
"失败请求不记录用量": "Usage is not recorded for failed requests",
"失败({status}):{error}": "Failed ({status}): {error}",
"失败:{error}": "Failed: {error}",
Expand Down Expand Up @@ -135,6 +139,33 @@
"本轮尝试失败,正在退避等待或切换到下一个账号": "This attempt failed; backing off or switching to the next account",
"来源客户端": "",
"来源客户端:{client}": "Source client: {client}",
"请求头识别为 {identified},已改写归属为 {client}": "Identified as {identified} from request headers; attribution rewritten to {client}",
"识别结果(请求头识别出的真实客户端)": "Identification result (the real client recognized from request headers)",
"最终归属(记账时的客户端)": "Final attribution (the client recorded for accounting)",
"未改写,保留识别结果": "Not rewritten; the identified client is kept",
"供应商归属规则": "Provider attribution rules",
"默认归属客户端": "Default attribution client",
"命中规则:{provider} → {client}": "Matched rule: {provider} → {client}",
"该供应商已有归属规则,保存将覆盖它": "This provider already has an attribution rule; saving overwrites it",
"这条请求没有记录供应商(旧数据或未走到转发),不能从这里改归属": "No provider recorded for this request (legacy data or it never reached forwarding); attribution cannot be changed here",
"请选择供应商": "Select a provider",
"请选择归属客户端": "Select a client",
"选择供应商": "Select provider",
"选择归属客户端": "Select client",
"搜索供应商": "Search providers",
"搜索客户端": "Search clients",
"供应商": "Provider",
"归属客户端": "Client",
"自定义 · {name}": "Custom · {name}",
"保存归属规则": "Save attribution rule",
"删除归属规则": "Delete attribution rule",
"添加自定义头匹配规则…": "Add a custom header rule…",
"编辑这条头匹配规则…": "Edit this header rule…",
"设置识别规则": "Set identification rules",
"取消": "Cancel",
"保存中…": "Saving…",
"命中依据:{header} · {pattern}": "Matched on: {header} · {pattern}",
"保留草稿并读取最新设置": "Keep draft and reload latest settings",
"查看该请求的上游原始报文": "View the raw upstream payload for this request",
"模型": "Model",
"模型映射:{from} → {to}": "",
Expand Down
3 changes: 3 additions & 0 deletions desktop-tauri/i18n/i18n-src/en/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -1006,6 +1006,9 @@
"自动同步上次失败": "Last auto sync failed",
"自动续写": "Auto continuation",
"自定义 User-Agent": "Custom User-Agent",
"自定义 · {name}": "Custom · {name}",
"自定义头匹配规则": "Custom header rules",
"按列表自上而下匹配,位于来源声明之后、内置规则之前;可用于给难认的标识钉规则。": "Matched top-down in list order, after caller declarations and before builtin rules; use it to pin hard-to-recognize clients.",
"自定义客户端分类": "Custom client categories",
"自定义客户端数量已达上限": "Custom client limit reached",
"自定义提供商 {id}": "Custom provider {id}",
Expand Down
31 changes: 31 additions & 0 deletions desktop-tauri/i18n/i18n-src/ja/requests.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@
"在路由页查看": "ルーティングページで表示",
"在途 {n}": "",
"处理中": "処理中",
"辅助识图": "補助画像認識",
"切换视觉模型": "視覚モデルへ切替",
"已完成": "完了",
"失败": "失敗",
"失败请求不记录用量": "失敗したリクエストは使用量を記録しません",
"失败({status}):{error}": "失敗({status}):{error}",
"失败:{error}": "失敗:{error}",
Expand Down Expand Up @@ -135,6 +139,33 @@
"本轮尝试失败,正在退避等待或切换到下一个账号": "今回の試行は失敗し、バックオフ待機中または次のアカウントへの切り替え中です",
"来源客户端": "",
"来源客户端:{client}": "接続元クライアント:{client}",
"请求头识别为 {identified},已改写归属为 {client}": "リクエストヘッダーでは {identified} と識別され、帰属先は {client} に書き換えられました",
"识别结果(请求头识别出的真实客户端)": "識別結果(ヘッダーから識別された実際のクライアント)",
"最终归属(记账时的客户端)": "最終的な帰属(記録時に使用するクライアント)",
"未改写,保留识别结果": "書き換えなし、識別結果を保持",
"供应商归属规则": "プロバイダー帰属ルール",
"默认归属客户端": "既定の帰属クライアント",
"命中规则:{provider} → {client}": "適用ルール:{provider} → {client}",
"该供应商已有归属规则,保存将覆盖它": "このプロバイダーには既に帰属ルールがあり、保存すると上書きされます",
"这条请求没有记录供应商(旧数据或未走到转发),不能从这里改归属": "このリクエストにはプロバイダーの記録がなく(旧データまたは転送未遂)、ここでは帰属を変更できません",
"请选择供应商": "プロバイダーを選択してください",
"请选择归属客户端": "クライアントを選択してください",
"选择供应商": "プロバイダーを選択",
"选择归属客户端": "クライアントを選択",
"搜索供应商": "プロバイダーを検索",
"搜索客户端": "クライアントを検索",
"供应商": "プロバイダー",
"归属客户端": "クライアント",
"自定义 · {name}": "カスタム · {name}",
"保存归属规则": "帰属ルールを保存",
"删除归属规则": "帰属ルールを削除",
"添加自定义头匹配规则…": "カスタムヘッダールールを追加…",
"编辑这条头匹配规则…": "このヘッダールールを編集…",
"设置识别规则": "識別ルールを設定",
"取消": "キャンセル",
"保存中…": "保存中…",
"命中依据:{header} · {pattern}": "識別根拠:{header} · {pattern}",
"保留草稿并读取最新设置": "下書きを保持して最新設定を読み込む",
"查看该请求的上游原始报文": "このリクエストのアップストリーム生ペイロードを表示",
"模型": "モデル",
"模型映射:{from} → {to}": "",
Expand Down
3 changes: 3 additions & 0 deletions desktop-tauri/i18n/i18n-src/ja/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -1007,6 +1007,9 @@
"自动同步上次失败": "前回の自動同期に失敗しました",
"自动续写": "自動継続生成",
"自定义 User-Agent": "カスタム User-Agent",
"自定义 · {name}": "カスタム · {name}",
"自定义头匹配规则": "カスタムヘッダールール",
"按列表自上而下匹配,位于来源声明之后、内置规则之前;可用于给难认的标识钉规则。": "リストの上から順に照合し、発信元宣言の後・内蔵ルールの前に適用します。識別しにくいクライアントの固定に使えます。",
"自定义客户端分类": "カスタムクライアント分類",
"自定义客户端数量已达上限": "カスタムクライアント数が上限に達しました",
"自定义提供商 {id}": "カスタムプロバイダー {id}",
Expand Down
31 changes: 31 additions & 0 deletions desktop-tauri/i18n/i18n-src/ko/requests.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@
"在路由页查看": "라우팅 페이지에서 보기",
"在途 {n}": "",
"处理中": "처리 중",
"辅助识图": "보조 이미지 인식",
"切换视觉模型": "비전 모델 전환",
"已完成": "완료",
"失败": "실패",
"失败请求不记录用量": "실패한 요청은 사용량을 기록하지 않음",
"失败({status}):{error}": "실패({status}): {error}",
"失败:{error}": "실패: {error}",
Expand Down Expand Up @@ -135,6 +139,33 @@
"本轮尝试失败,正在退避等待或切换到下一个账号": "이번 시도가 실패하여 백오프 대기 중이거나 다음 계정으로 전환 중입니다",
"来源客户端": "",
"来源客户端:{client}": "요청 클라이언트: {client}",
"请求头识别为 {identified},已改写归属为 {client}": "요청 헤더에서는 {identified}로 식별되었으며 귀속은 {client}로 변경되었습니다",
"识别结果(请求头识别出的真实客户端)": "식별 결과(헤더에서 식별된 실제 클라이언트)",
"最终归属(记账时的客户端)": "최종 귀속(기록 시 클라이언트)",
"未改写,保留识别结果": "변경 없음, 식별 결과 유지",
"供应商归属规则": "공급자 귀속 규칙",
"默认归属客户端": "기본 귀속 클라이언트",
"命中规则:{provider} → {client}": "적용 규칙: {provider} → {client}",
"该供应商已有归属规则,保存将覆盖它": "이 공급자에는 이미 귀속 규칙이 있으며 저장 시 덮어씁니다",
"这条请求没有记录供应商(旧数据或未走到转发),不能从这里改归属": "이 요청에는 공급자 기록이 없어(구 데이터 또는 전달 미도달) 여기서 귀속을 변경할 수 없습니다",
"请选择供应商": "공급자를 선택하세요",
"请选择归属客户端": "클라이언트를 선택하세요",
"选择供应商": "공급자 선택",
"选择归属客户端": "클라이언트 선택",
"搜索供应商": "공급자 검색",
"搜索客户端": "클라이언트 검색",
"供应商": "공급자",
"归属客户端": "클라이언트",
"自定义 · {name}": "사용자 지정 · {name}",
"保存归属规则": "귀속 규칙 저장",
"删除归属规则": "귀속 규칙 삭제",
"添加自定义头匹配规则…": "사용자 지정 헤더 규칙 추가…",
"编辑这条头匹配规则…": "이 헤더 규칙 편집…",
"设置识别规则": "식별 규칙 설정",
"取消": "취소",
"保存中…": "저장 중…",
"命中依据:{header} · {pattern}": "판정 근거: {header} · {pattern}",
"保留草稿并读取最新设置": "임시 보관 후 최신 설정 다시 읽기",
"查看该请求的上游原始报文": "이 요청의 업스트림 원시 페이로드 보기",
"模型": "모델",
"模型映射:{from} → {to}": "",
Expand Down
3 changes: 3 additions & 0 deletions desktop-tauri/i18n/i18n-src/ko/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -1007,6 +1007,9 @@
"自动同步上次失败": "마지막 자동 동기화 실패",
"自动续写": "자동 이어쓰기",
"自定义 User-Agent": "사용자 정의 User-Agent",
"自定义 · {name}": "사용자 지정 · {name}",
"自定义头匹配规则": "사용자 지정 헤더 규칙",
"按列表自上而下匹配,位于来源声明之后、内置规则之前;可用于给难认的标识钉规则。": "목록 위에서 아래로 순서대로 매칭되며, 발신 선언 뒤·내장 규칙 앞에 적용됩니다. 식별하기 어려운 클라이언트를 고정하는 데 사용합니다.",
"自定义客户端分类": "사용자 지정 클라이언트 분류",
"自定义客户端数量已达上限": "사용자 지정 클라이언트 수가 한도에 도달함",
"自定义提供商 {id}": "커스텀 제공자 {id}",
Expand Down
31 changes: 31 additions & 0 deletions desktop-tauri/i18n/i18n-src/pt-BR/requests.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@
"在路由页查看": "Ver na página de roteamento",
"在途 {n}": "",
"处理中": "Processando",
"辅助识图": "Leitura de imagem assistida",
"切换视觉模型": "Alternar para modelo de visão",
"已完成": "Concluído",
"失败": "Falhou",
"失败请求不记录用量": "Requisições com falha não registram uso",
"失败({status}):{error}": "Falhou ({status}): {error}",
"失败:{error}": "Falhou: {error}",
Expand Down Expand Up @@ -135,6 +139,33 @@
"本轮尝试失败,正在退避等待或切换到下一个账号": "Esta rodada falhou; aguardando o backoff ou trocando para a próxima conta",
"来源客户端": "",
"来源客户端:{client}": "Cliente de origem: {client}",
"请求头识别为 {identified},已改写归属为 {client}": "Identificado como {identified} pelos cabeçalhos da requisição; atribuição reescrita para {client}",
"识别结果(请求头识别出的真实客户端)": "Resultado da identificação (o cliente real reconhecido pelos cabeçalhos)",
"最终归属(记账时的客户端)": "Atribuição final (o cliente registrado na contabilização)",
"未改写,保留识别结果": "Não reescrita; o cliente identificado é mantido",
"供应商归属规则": "Regras de atribuição por provedor",
"默认归属客户端": "Cliente de atribuição padrão",
"命中规则:{provider} → {client}": "Regra aplicada: {provider} → {client}",
"该供应商已有归属规则,保存将覆盖它": "Este provedor já tem uma regra de atribuição; salvar vai substituí-la",
"这条请求没有记录供应商(旧数据或未走到转发),不能从这里改归属": "Esta requisição não tem provedor registrado (dados antigos ou nunca chegou ao encaminhamento); a atribuição não pode ser alterada aqui",
"请选择供应商": "Selecione um provedor",
"请选择归属客户端": "Selecione um cliente",
"选择供应商": "Selecionar provedor",
"选择归属客户端": "Selecionar cliente",
"搜索供应商": "Pesquisar provedores",
"搜索客户端": "Pesquisar clientes",
"供应商": "Provedor",
"归属客户端": "Cliente",
"自定义 · {name}": "Personalizado · {name}",
"保存归属规则": "Salvar regra de atribuição",
"删除归属规则": "Excluir regra de atribuição",
"添加自定义头匹配规则…": "Adicionar regra de cabeçalho personalizada…",
"编辑这条头匹配规则…": "Editar esta regra de cabeçalho…",
"设置识别规则": "Definir regras de identificação",
"取消": "Cancelar",
"保存中…": "Salvando…",
"命中依据:{header} · {pattern}": "Base da correspondência: {header} · {pattern}",
"保留草稿并读取最新设置": "Manter rascunho e recarregar as configurações",
"查看该请求的上游原始报文": "Ver o payload bruto do upstream desta requisição",
"模型": "Modelo",
"模型映射:{from} → {to}": "",
Expand Down
3 changes: 3 additions & 0 deletions desktop-tauri/i18n/i18n-src/pt-BR/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -1007,6 +1007,9 @@
"自动同步上次失败": "A última sincronização automática falhou",
"自动续写": "Continuação automática",
"自定义 User-Agent": "User-Agent personalizado",
"自定义 · {name}": "Personalizado · {name}",
"自定义头匹配规则": "Regras de cabeçalho personalizadas",
"按列表自上而下匹配,位于来源声明之后、内置规则之前;可用于给难认的标识钉规则。": "Correspondência de cima para baixo na ordem da lista, após as declarações de origem e antes das regras internas; use para fixar clientes difíceis de reconhecer.",
"自定义客户端分类": "Categorias de clientes personalizadas",
"自定义客户端数量已达上限": "Limite de clientes personalizados atingido",
"自定义提供商 {id}": "Provedor personalizado {id}",
Expand Down
31 changes: 31 additions & 0 deletions desktop-tauri/i18n/i18n-src/zh-Hant/requests.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@
"在路由页查看": "在路由頁檢視",
"在途 {n}": "",
"处理中": "",
"辅助识图": "",
"切换视觉模型": "",
"已完成": "",
"失败": "",
"失败请求不记录用量": "",
"失败({status}):{error}": "",
"失败:{error}": "",
Expand Down Expand Up @@ -135,6 +139,33 @@
"本轮尝试失败,正在退避等待或切换到下一个账号": "",
"来源客户端": "",
"来源客户端:{client}": "",
"请求头识别为 {identified},已改写归属为 {client}": "",
"识别结果(请求头识别出的真实客户端)": "",
"最终归属(记账时的客户端)": "",
"未改写,保留识别结果": "",
"供应商归属规则": "",
"默认归属客户端": "",
"命中规则:{provider} → {client}": "",
"该供应商已有归属规则,保存将覆盖它": "",
"这条请求没有记录供应商(旧数据或未走到转发),不能从这里改归属": "",
"请选择供应商": "",
"请选择归属客户端": "",
"选择供应商": "",
"选择归属客户端": "",
"搜索供应商": "",
"搜索客户端": "",
"供应商": "",
"归属客户端": "",
"自定义 · {name}": "",
"保存归属规则": "",
"删除归属规则": "",
"添加自定义头匹配规则…": "",
"编辑这条头匹配规则…": "",
"设置识别规则": "",
"取消": "",
"保存中…": "",
"命中依据:{header} · {pattern}": "",
"保留草稿并读取最新设置": "",
"查看该请求的上游原始报文": "",
"模型": "",
"模型映射:{from} → {to}": "",
Expand Down
3 changes: 3 additions & 0 deletions desktop-tauri/i18n/i18n-src/zh-Hant/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -970,6 +970,9 @@
"自动同步上次失败": "",
"自动续写": "",
"自定义 User-Agent": "",
"自定义 · {name}": "",
"自定义头匹配规则": "",
"按列表自上而下匹配,位于来源声明之后、内置规则之前;可用于给难认的标识钉规则。": "",
"自定义客户端分类": "",
"自定义客户端数量已达上限": "",
"自定义提供商 {id}": "",
Expand Down
2 changes: 1 addition & 1 deletion desktop-tauri/src-tauri/server/src/server/api/assistant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ pub async fn chat(State(state): State<ServerState>, headers: HeaderMap, body: By
if let Some(token) = cancellation::register(&telemetry_id) {
telemetry.set_cancel_token(token);
}
let mut guard = DisconnectGuard::new(state.request_stats(), telemetry.clone(), started_at);
let mut guard = DisconnectGuard::new(state.request_stats(), telemetry.clone(), started_at, &access.source.client);

let outcome = state
.upstream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ async fn summarize(state: &ServerState, id: &str, access: ModelAccess) -> Result
if let Some(token) = crate::server::core::upstream::cancellation::register(&request_id) {
telemetry.set_cancel_token(token);
}
let mut guard = DisconnectGuard::new(state.request_stats(), telemetry.clone(), started);
let mut guard = DisconnectGuard::new(state.request_stats(), telemetry.clone(), started, &access.source.client);
let outcome = state.upstream().forward_assistant(ForwardRequest {
body, stream: false, dedupe_key: String::new(), client_headers: HeaderMap::new(), telemetry: telemetry.clone(),
allowed_providers: access.scope, pinned_account: None, ignore_model_gate: false, proxy_override: None,
Expand Down
5 changes: 3 additions & 2 deletions desktop-tauri/src-tauri/server/src/server/api/chat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ pub async fn chat_completions(
// 客户端在响应产生前断开时 axum 会直接取消 handler,收尾记账走不到 ——
// 守卫的 Drop 补一条 408 终态(详见 `DisconnectGuard` 的说明)。
// 正常路径必须显式调 `complete()` / `handoff()`,见下面的三个出口。
let mut guard = DisconnectGuard::new(state.request_stats(), telemetry.clone(), started_at);
let mut guard = DisconnectGuard::new(state.request_stats(), telemetry.clone(), started_at, &request_source.client);
// 在途回写:选路一定就把「谁在承载」、发送体一定稿就把「上游真名」写进这条
// 进行中行(连同尝试链、首响、脱敏命中)—— 列表页 1 秒轮询,于是这些读数在
// 转发期间就能看到,不必等收尾。接线在这里、core 只持有闭包,理由见
Expand All @@ -200,6 +200,7 @@ pub async fn chat_completions(
state.request_stats(),
telemetry_id,
started_at,
&request_source.client,
));
// 自动续写的上下文(开关 `autoContinue` **默认关**)。关着时这里连一份 clone
// 都不做 —— `plan()` 先问开关,再决定要不要复制请求体/请求头/白名单。
Expand Down Expand Up @@ -507,4 +508,4 @@ pub fn spawn_catalog_refresh(state: &ServerState) {
crate::server::logging::verbose("[Maintenance]", &error);
}
});
}
}
Loading
Loading