More smoothing, as they say

This commit is contained in:
Dave
2026-02-16 16:35:25 +00:00
parent 5923165fcf
commit f76376b203
10 changed files with 256 additions and 265 deletions

View File

@@ -1,8 +1,17 @@
use crate::http::context::{AppContext, OpenApiResult, bad_request};
use crate::llm::chat;
use poem_openapi::payload::Json;
use poem_openapi::{OpenApi, payload::Json};
use std::sync::Arc;
pub async fn cancel_chat(ctx: &AppContext) -> OpenApiResult<Json<bool>> {
chat::cancel_chat(&ctx.state).map_err(bad_request)?;
Ok(Json(true))
pub struct ChatApi {
pub ctx: Arc<AppContext>,
}
#[OpenApi]
impl ChatApi {
#[oai(path = "/chat/cancel", method = "post")]
async fn cancel_chat(&self) -> OpenApiResult<Json<bool>> {
chat::cancel_chat(&self.ctx.state).map_err(bad_request)?;
Ok(Json(true))
}
}