feat: send puzzle result subscribe messages

This commit is contained in:
kdletters
2026-06-08 11:49:11 +08:00
parent 49e4d085b3
commit 38d9c292ae
17 changed files with 704 additions and 33 deletions
@@ -2,6 +2,7 @@ use axum::http::{HeaderValue, StatusCode};
use platform_auth::{AuthPlatformErrorKind, WechatProviderError};
use platform_llm::{LlmError, LlmErrorKind};
use platform_oss::{OssError, OssErrorKind};
use platform_wechat::{WechatError, WechatErrorKind};
use serde_json::json;
use crate::http_error::AppError;
@@ -68,6 +69,17 @@ pub fn map_wechat_provider_error(error: WechatProviderError) -> AppError {
AppError::from_status(status).with_message(error.to_string())
}
pub fn map_wechat_error(error: WechatError) -> AppError {
let status = match error.kind() {
WechatErrorKind::InvalidConfig => StatusCode::SERVICE_UNAVAILABLE,
WechatErrorKind::RequestFailed
| WechatErrorKind::DeserializeFailed
| WechatErrorKind::Upstream => StatusCode::BAD_GATEWAY,
};
AppError::from_status(status).with_message(error.to_string())
}
pub fn attach_retry_after(error: AppError, retry_after_seconds: u64) -> AppError {
match HeaderValue::from_str(&retry_after_seconds.to_string()) {
Ok(value) => error.with_header("retry-after", value),