Refactoring the structure a bit

This commit is contained in:
Dave
2026-02-16 16:24:21 +00:00
parent a2188e2c7f
commit 5923165fcf
21 changed files with 522 additions and 372 deletions

View File

@@ -0,0 +1,18 @@
use crate::http::context::{AppContext, OpenApiResult, bad_request};
use crate::http::payloads::ApiKeyPayload;
use crate::llm;
use poem_openapi::payload::Json;
pub async fn get_anthropic_api_key_exists(ctx: &AppContext) -> OpenApiResult<Json<bool>> {
let exists =
llm::chat::get_anthropic_api_key_exists(ctx.store.as_ref()).map_err(bad_request)?;
Ok(Json(exists))
}
pub async fn set_anthropic_api_key(
payload: Json<ApiKeyPayload>,
ctx: &AppContext,
) -> OpenApiResult<Json<bool>> {
llm::chat::set_anthropic_api_key(ctx.store.as_ref(), payload.0.api_key).map_err(bad_request)?;
Ok(Json(true))
}