2a98b60830
新增前端运行时配置接口下发画板 Agent 开关 将画板 Agent 入口改为读取后端运行时配置 把开关变量改为 GENARRATIVE_ENABLE_IMAGE_EDITOR_AGENT_SIDEBAR 补充前后端测试和生产环境变量文档
26 lines
715 B
Rust
26 lines
715 B
Rust
use axum::{
|
|
Json,
|
|
extract::{Extension, State},
|
|
};
|
|
use serde::Serialize;
|
|
|
|
use crate::{api_response::json_success_body, request_context::RequestContext, state::AppState};
|
|
|
|
#[derive(Debug, Serialize)]
|
|
#[serde(rename_all = "camelCase")]
|
|
pub struct FrontendRuntimeConfigResponse {
|
|
pub image_editor_agent_sidebar_enabled: bool,
|
|
}
|
|
|
|
pub async fn get_frontend_runtime_config(
|
|
State(state): State<AppState>,
|
|
Extension(request_context): Extension<RequestContext>,
|
|
) -> Json<serde_json::Value> {
|
|
json_success_body(
|
|
Some(&request_context),
|
|
FrontendRuntimeConfigResponse {
|
|
image_editor_agent_sidebar_enabled: state.config.image_editor_agent_sidebar_enabled,
|
|
},
|
|
)
|
|
}
|