More smoothing, as they say
This commit is contained in:
@@ -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))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user