feat: add generation_mode to RecentArticle and related components

- Updated RecentArticle interface to include generation_mode.
- Modified workspace_service to map generation_mode from database.
- Adjusted domain model for RecentArticle to accommodate generation_mode.
- Enhanced SQL queries to retrieve generation_mode from generation_tasks.
- Created ArticleActionGroup component for article action buttons.
- Implemented ArticleGenerateStatus component to display generation status.
- Developed ArticlePublishStatus component to show publish status and related platforms.
- Introduced ArticleSourceMeta component to display article source information.
- Added utility functions for article actions and clipboard content generation.
This commit is contained in:
2026-04-07 16:07:21 +08:00
parent 9f721f6088
commit 98ebb12fa1
19 changed files with 1350 additions and 385 deletions
@@ -95,10 +95,21 @@ func (q *Queries) GetQuotaSummary(ctx context.Context, tenantID int64) (int32, e
const getRecentArticles = `-- name: GetRecentArticles :many
SELECT a.id, a.generate_status, a.publish_status, a.source_type, a.created_at,
av.title, av.markdown_content, av.word_count, av.source_label,
t.template_name
t.template_name,
COALESCE(
NULLIF(gt.input_params_json ->> 'generation_mode', ''),
CASE WHEN a.source_type = 'custom_generation' THEN 'instant' ELSE NULL END
) AS generation_mode
FROM articles a
LEFT JOIN article_versions av ON av.id = a.current_version_id
LEFT JOIN article_templates t ON t.id = a.template_id
LEFT JOIN LATERAL (
SELECT input_params_json
FROM generation_tasks
WHERE article_id = a.id
ORDER BY created_at DESC
LIMIT 1
) gt ON true
WHERE a.tenant_id = $1 AND a.deleted_at IS NULL
ORDER BY a.created_at DESC
LIMIT 10
@@ -115,6 +126,7 @@ type GetRecentArticlesRow struct {
WordCount pgtype.Int4 `json:"word_count"`
SourceLabel pgtype.Text `json:"source_label"`
TemplateName pgtype.Text `json:"template_name"`
GenerationMode pgtype.Text `json:"generation_mode"`
}
func (q *Queries) GetRecentArticles(ctx context.Context, tenantID int64) ([]GetRecentArticlesRow, error) {
@@ -137,6 +149,7 @@ func (q *Queries) GetRecentArticles(ctx context.Context, tenantID int64) ([]GetR
&i.WordCount,
&i.SourceLabel,
&i.TemplateName,
&i.GenerationMode,
); err != nil {
return nil, err
}