feat: Enhance article generation and outline handling

- Added support for external markdown synchronization in ArticleEditorCanvas.vue.
- Implemented a new function to sync markdown from props, ensuring the editor reflects external changes.
- Introduced a removeOutlineSection function in TemplateWizardView.vue to manage outline sections dynamically.
- Updated UI components to improve user experience, including replacing a-input with a-textarea for better text handling.
- Refactored CSS styles for a cleaner layout and improved responsiveness in TemplateWizardView.vue.
- Enhanced LLM generation requests to include response format options in ark.go and client.go.
- Updated template assist logic to enforce structured outline outputs in template_assist.go.
- Added tests for outline result decoding and prompt generation to ensure robustness.
- Created migration scripts to update prompt templates with new writing requirements for top X articles.
This commit is contained in:
2026-04-02 10:58:39 +08:00
parent b31d8d0096
commit 7fa1809682
12 changed files with 605 additions and 106 deletions
@@ -36,6 +36,7 @@ type generationJob struct {
ArticleID int64
TaskID int64
ReservationID int64
TemplateKey string
TemplateName string
PromptTemplate *string
Params map[string]interface{}
@@ -192,11 +193,11 @@ func effectivePromptVisibility(record *repository.TemplateRecord, actorTenantID
}
type GenerateRequest struct {
ArticleID *int64 `json:"article_id"`
InputParams map[string]interface{} `json:"input_params" binding:"required"`
WizardState map[string]interface{} `json:"wizard_state"`
EnableWebSearch bool `json:"enable_web_search"`
WebSearchLimit *int32 `json:"web_search_limit"`
ArticleID *int64 `json:"article_id"`
InputParams map[string]interface{} `json:"input_params" binding:"required"`
WizardState map[string]interface{} `json:"wizard_state"`
EnableWebSearch bool `json:"enable_web_search"`
WebSearchLimit *int32 `json:"web_search_limit"`
}
type GenerateResponse struct {
@@ -385,6 +386,7 @@ func (s *TemplateService) Generate(ctx context.Context, templateID int64, req Ge
ArticleID: articleID,
TaskID: taskID,
ReservationID: reservationID,
TemplateKey: templateRecord.TemplateKey,
TemplateName: templateRecord.TemplateName,
PromptTemplate: templateRecord.PromptTemplate,
Params: cloneInputParams(req.InputParams),
@@ -467,7 +469,7 @@ func (s *TemplateService) executeGeneration(ctx context.Context, job generationJ
StartedAt: &now,
})
prompt := buildGenerationPrompt(job.TemplateName, job.PromptTemplate, job.Params)
prompt := buildGenerationPrompt(job.TemplateKey, job.TemplateName, job.PromptTemplate, job.Params)
generateReq := llm.GenerateRequest{
Prompt: prompt,
Timeout: s.articleTimeout,