fab9f21aa7
新增图片画布任务侧栏页签、滚轮隔离、完成时间、后端计时和运行中状态展示。
限制外部生成任务只显示当前项目,并让任务点击聚焦画布内容和快速编辑源图。
接入外部生成任务列表查询状态过滤、提示词摘要和后端任务映射。
补充 BiRefNet 抠图请求日志、任务耗时提示和相关文档。
补充侧栏、画布聚焦、外部任务契约和 api-server 定向测试。
(cherry picked from commit 12ef866b66)
87 lines
2.6 KiB
Rust
87 lines
2.6 KiB
Rust
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
#[serde(rename_all = "kebab-case")]
|
|
pub enum ExternalGenerationJobStatus {
|
|
Queued,
|
|
Running,
|
|
Completed,
|
|
Failed,
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
#[serde(rename_all = "camelCase")]
|
|
pub struct ExternalGenerationQueueOverview {
|
|
pub pending_count: u32,
|
|
pub running_count: u32,
|
|
pub unacknowledged_terminal_count: u32,
|
|
pub updated_at_micros: i64,
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
#[serde(rename_all = "camelCase")]
|
|
pub struct ExternalGenerationQueueOverviewResponse {
|
|
pub overview: ExternalGenerationQueueOverview,
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
#[serde(rename_all = "camelCase")]
|
|
pub struct ExternalGenerationJobStatusRecord {
|
|
pub operation_id: String,
|
|
pub status: ExternalGenerationJobStatus,
|
|
pub phase_label: String,
|
|
pub phase_detail: String,
|
|
pub progress: u8,
|
|
pub error: Option<String>,
|
|
pub updated_at_micros: i64,
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
#[serde(rename_all = "camelCase")]
|
|
pub struct ExternalGenerationJobStatusResponse {
|
|
pub job: ExternalGenerationJobStatusRecord,
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
#[serde(rename_all = "camelCase")]
|
|
pub struct ExternalGenerationTaskRecord {
|
|
pub job_id: String,
|
|
pub job_kind: String,
|
|
pub source_module: String,
|
|
pub source_entity_id: String,
|
|
pub request_label: String,
|
|
pub request_prompt: Option<String>,
|
|
pub status: ExternalGenerationJobStatus,
|
|
pub phase_label: String,
|
|
pub phase_detail: String,
|
|
pub progress: u8,
|
|
pub error: Option<String>,
|
|
pub price_mud_points: u64,
|
|
pub refund_ledger_id: Option<String>,
|
|
pub notification_acknowledged_at: Option<String>,
|
|
pub created_at: String,
|
|
pub started_at: Option<String>,
|
|
pub completed_at: Option<String>,
|
|
pub updated_at: String,
|
|
pub updated_at_micros: i64,
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
#[serde(rename_all = "camelCase")]
|
|
pub struct ExternalGenerationTaskListResponse {
|
|
pub tasks: Vec<ExternalGenerationTaskRecord>,
|
|
pub overview: ExternalGenerationQueueOverview,
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
#[serde(rename_all = "camelCase")]
|
|
pub struct ExternalGenerationTaskAcknowledgeRequest {
|
|
pub job_ids: Vec<String>,
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
#[serde(rename_all = "camelCase")]
|
|
pub struct ExternalGenerationTaskAcknowledgeResponse {
|
|
pub acknowledged_tasks: Vec<ExternalGenerationTaskRecord>,
|
|
}
|