update
Some checks failed
Rust CI / Build Release (push) Has been cancelled
Rust CI / Cargo Check (push) Has been cancelled

This commit is contained in:
lychang
2026-07-19 15:04:22 +08:00
parent b915e69222
commit 82653c1a6c
40 changed files with 7778 additions and 1 deletions

46
src/models/recommend.rs Normal file
View File

@@ -0,0 +1,46 @@
use serde::{Deserialize, Serialize};
/// 推荐请求
#[derive(Debug, Deserialize)]
pub struct RecommendQuery {
pub q: Option<String>,
pub limit: Option<usize>,
pub context: Option<String>, // 上下文标签(用于共现推荐)
}
/// 推荐条目(通用)
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct RecommendItem {
pub value: String,
pub label: String,
pub score: f64,
pub count: Option<i64>,
pub source: String, // "tag" | "person" | "co-occurrence" | "popular"
}
/// 推荐响应
#[derive(Debug, Serialize, Deserialize)]
pub struct RecommendResponse {
pub items: Vec<RecommendItem>,
pub total: usize,
pub category: String, // "tags" | "persons" | "related"
}
/// 标签推荐(带上下文)
#[derive(Debug, Serialize, Deserialize)]
pub struct TagRecommendation {
pub tag: String,
pub related_tags: Vec<RecommendItem>,
pub similar_persons: Vec<RecommendItem>,
}
/// 热门人物
#[derive(Debug, Serialize, Deserialize)]
pub struct PopularPerson {
pub name: String,
pub display_name: Option<String>,
pub total_albums: i64,
pub total_images: i64,
pub top_tags: Vec<String>,
pub aliases: Vec<String>,
}