mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-03 01:40:21 +08:00
feat: 全栈功能增强 - 扩展 provider/pool 管理、完善调度与数据层、重构前端 Pool 页面
后端: - 扩展 pool_admin payloads 和 provider query models,增强 endpoint key 管理 - 完善 scheduler-core 候选排序与请求候选逻辑 - 增强 usage-runtime 写入、provider-transport 网络层与 OAuth 刷新 - 改进 AI pipeline 响应转换与流式处理 - 扩展 global_models/provider_catalog 数据层查询能力 - 增强 video-tasks-core 多 provider 支持 - 新增大量集成测试覆盖 pool/keys/provider_query/frontdoor 前端: - 重构 PoolManagement 页面,拆分状态管理/对话框逻辑到独立模块 - 新增 poolAdvancedDialog/poolSchedulingDialog/poolManagementState/poolMobilePresentation 工具函数及测试 - 改进 Dialog 组件与 provider tabs 显示 部署: - 更新 Rust CI workflow 和 Dockerfile 构建配置 Closes #275 Co-authored-by: AAEE86 <ppk0227@hotmail.com>
This commit is contained in:
@@ -24,6 +24,7 @@ pub use request::{
|
||||
apply_local_body_rules, apply_local_header_rules, body_rules_are_locally_supported,
|
||||
build_kiro_provider_headers, build_kiro_provider_request_body,
|
||||
header_rules_are_locally_supported, supports_local_kiro_request_shape,
|
||||
KiroProviderHeadersInput,
|
||||
};
|
||||
pub use url::{
|
||||
build_kiro_generate_assistant_response_url, resolve_kiro_base_url,
|
||||
|
||||
@@ -77,16 +77,32 @@ pub fn build_kiro_provider_request_body(
|
||||
Some(provider_request_body)
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub struct KiroProviderHeadersInput<'a> {
|
||||
pub headers: &'a http::HeaderMap,
|
||||
pub provider_request_body: &'a Value,
|
||||
pub original_request_body: &'a Value,
|
||||
pub header_rules: Option<&'a Value>,
|
||||
pub auth_header: &'a str,
|
||||
pub auth_value: &'a str,
|
||||
pub auth_config: &'a KiroAuthConfig,
|
||||
pub machine_id: &'a str,
|
||||
}
|
||||
|
||||
pub fn build_kiro_provider_headers(
|
||||
headers: &http::HeaderMap,
|
||||
provider_request_body: &Value,
|
||||
original_request_body: &Value,
|
||||
header_rules: Option<&Value>,
|
||||
auth_header: &str,
|
||||
auth_value: &str,
|
||||
auth_config: &KiroAuthConfig,
|
||||
machine_id: &str,
|
||||
input: KiroProviderHeadersInput<'_>,
|
||||
) -> Option<BTreeMap<String, String>> {
|
||||
let KiroProviderHeadersInput {
|
||||
headers,
|
||||
provider_request_body,
|
||||
original_request_body,
|
||||
header_rules,
|
||||
auth_header,
|
||||
auth_value,
|
||||
auth_config,
|
||||
machine_id,
|
||||
} = input;
|
||||
|
||||
let mut out = BTreeMap::new();
|
||||
for (name, value) in headers {
|
||||
let Ok(value) = value.to_str() else {
|
||||
@@ -133,7 +149,7 @@ mod tests {
|
||||
use super::super::credentials::KiroAuthConfig;
|
||||
use super::{
|
||||
build_kiro_provider_headers, build_kiro_provider_request_body,
|
||||
supports_local_kiro_request_shape,
|
||||
supports_local_kiro_request_shape, KiroProviderHeadersInput,
|
||||
};
|
||||
|
||||
#[test]
|
||||
@@ -221,19 +237,19 @@ mod tests {
|
||||
node_version: None,
|
||||
access_token: Some("cached-token".to_string()),
|
||||
};
|
||||
let headers = build_kiro_provider_headers(
|
||||
&http::HeaderMap::new(),
|
||||
&json!({"conversationState": {}}),
|
||||
&json!({"messages": []}),
|
||||
Some(&json!([
|
||||
let headers = build_kiro_provider_headers(KiroProviderHeadersInput {
|
||||
headers: &http::HeaderMap::new(),
|
||||
provider_request_body: &json!({"conversationState": {}}),
|
||||
original_request_body: &json!({"messages": []}),
|
||||
header_rules: Some(&json!([
|
||||
{"action":"set","key":"accept","value":"text/plain"},
|
||||
{"action":"set","key":"x-endpoint-tag","value":"kiro-local"}
|
||||
])),
|
||||
"authorization",
|
||||
"Bearer cached-token",
|
||||
&auth_config,
|
||||
"machine-123",
|
||||
)
|
||||
auth_header: "authorization",
|
||||
auth_value: "Bearer cached-token",
|
||||
auth_config: &auth_config,
|
||||
machine_id: "machine-123",
|
||||
})
|
||||
.expect("headers should build");
|
||||
|
||||
assert_eq!(
|
||||
|
||||
@@ -153,19 +153,14 @@ pub fn resolve_transport_tls_profile(
|
||||
}
|
||||
|
||||
fn effective_proxy_config(transport: &GatewayProviderTransportSnapshot) -> Option<&Value> {
|
||||
for candidate in [
|
||||
[
|
||||
transport.key.proxy.as_ref(),
|
||||
transport.endpoint.proxy.as_ref(),
|
||||
transport.provider.proxy.as_ref(),
|
||||
]
|
||||
.into_iter()
|
||||
.flatten()
|
||||
{
|
||||
if proxy_enabled(candidate) {
|
||||
return Some(candidate);
|
||||
}
|
||||
}
|
||||
None
|
||||
.find(|candidate| proxy_enabled(candidate))
|
||||
}
|
||||
|
||||
fn proxy_enabled(value: &Value) -> bool {
|
||||
|
||||
@@ -16,6 +16,7 @@ use super::kiro::{
|
||||
use super::snapshot::GatewayProviderTransportSnapshot;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum LocalResolvedOAuthRequestAuth {
|
||||
#[allow(dead_code)]
|
||||
Header {
|
||||
|
||||
Reference in New Issue
Block a user