Files
storkit/server/src/http/chat.rs

18 lines
446 B
Rust
Raw Normal View History

2026-02-16 16:24:21 +00:00
use crate::http::context::{AppContext, OpenApiResult, bad_request};
use crate::llm::chat;
2026-02-16 16:35:25 +00:00
use poem_openapi::{OpenApi, payload::Json};
use std::sync::Arc;
2026-02-16 16:24:21 +00:00
2026-02-16 16:35:25 +00:00
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))
}
2026-02-16 16:24:21 +00:00
}