Engineering an AI Assistant Plugin Workbench: From Topic Selection to Publishing
This article explores the engineering practices of building a plugin-based workbench to manage the full lifecycle of AI-driven content production. It covers the core architecture, the finite state machine for manuscript status management, style parameterization, and best practices for integrating external image generation services.
1. Why a Plugin-Based Content Workbench is Needed
General-purpose conversational models excel at text generation, but content production is a complete pipeline that includes topic selection, drafting, revising, scheduling, publishing, and post-publication review. If all these steps remain within a single conversation, the final artifacts get mixed with process information, making it difficult for teams to reuse and for individuals to trace back. The value of plugin-based extensions lies in stripping domain-specific processes and data structures away from the conversation and handing them over to independent interface modules for management.
From an engineering perspective, this type of plugin typically consists of three layers: the interface layer, responsible for display and interaction; the data layer, responsible for persisting manuscripts, inspirations, and metrics; and the capability layer, responsible for invoking models to complete tasks like generation, rewriting, and storyboarding. With these three layers separated, each can be independently replaced and tested.
2. Core Problems with Conversational Production
In multi-turn conversations, a single manuscript often undergoes dozens of rounds of revisions. Drafts, feedback, and storyboards alternate, and retrieving a specific version requires scrolling through the history line by line. This structure has three typical problems:
- Untraceable versions: It is impossible to quickly confirm which version is the final draft.
- Invisible status: It is impossible to distinguish between drafts, scheduled, and published content.
- Hard to accumulate experience: Revision feedback is scattered throughout the conversation and cannot be transformed into reusable rules.
The solution is to elevate the “artifact” to a first-class entity. Every piece of inspiration, every manuscript, and every storyboard should have an independent ID, status, and timestamp, along with a reference relationship to the original conversation.
3. The Four Core Modules of the Workbench
3.1 Inspiration Collection
Inspiration is the starting point of content production. The system should support three types of inputs: text, links, and images, storing them uniformly as topic cards. The cards need to record the source, creation time, and tags to facilitate subsequent filtering by topic. The display can adopt two views: a card wall or a timeline. The former is suitable for browsing, while the latter is better for reviewing.
3.2 Manuscript Status Management
Manuscript status is best modeled using a finite state machine (FSM). Legal transition paths should be explicitly defined to avoid inconsistent data, such as a manuscript being marked as “published” while still in the “draft” state. An example is as follows:
from enum import Enumclass Status(Enum):IDEA = "Idea"DRAFT = "Draft"SCHEDULED = "Scheduled"PUBLISHED = "Published"ALLOWED = {Status.IDEA: {Status.DRAFT},Status.DRAFT: {Status.SCHEDULED, Status.IDEA},Status.SCHEDULED: {Status.PUBLISHED, Status.DRAFT},Status.PUBLISHED: set(), # Published content is read-only}def transition(current: Status, target: Status) -> Status:if target not in ALLOWED[current]:raise ValueError(f"Transition from {current.value} to {target.value} is not allowed")return target
Setting the published status to read-only prevents the accidental modification of review data. If revisions are indeed necessary, a new version should be created rather than overwriting the original draft.
3.3 Publishing Schedule
The scheduling module uses a calendar as its primary view. Dragging a manuscript to a specific day completes the time binding. The system needs to check if there is already a manuscript scheduled for the same time slot on the same publishing channel and provide a conflict warning. Time should be stored uniformly in UTC and converted to the user’s local timezone upon display, avoiding misalignment when used across different time zones.
3.4 Data Review
The review module is responsible for entering performance data of published content, such as views, completion rate, and interactions. The key is to transform this data into rules. For example, “manuscripts with specific numbers in the title have a higher click-through rate” can be written as a rule into the style configuration for reference during subsequent generation. Rules should be accompanied by sample size and statistical time range to prevent small-sample conclusions from being overgeneralized. Review results can be exported as structured documents for easy team sharing.
4. Parameterization and Refinement of Style
Style is difficult to describe in a single sentence, but it can be broken down into several measurable dimensions:
- Title patterns: The proportion of question-based, numeric, and declarative titles.
- Paragraph density: Average paragraph length and the frequency of list usage.
- Glossary: Preferred professional terms and colloquial expressions to avoid.
- Storyboard format: The correspondence between shot duration, visual descriptions, and voiceovers.
When extracting style from old manuscripts, you can first calculate the above metrics, then have the model summarize them into a text description, and finally have the author manually confirm it. A sample configuration is as follows:
style_card:name: Technical Insightstitle_patterns: [numeric, question-based]avg_paragraph_chars: 120glossary:prefer: [attention mechanism, context window]avoid: [buzzwords, disruptive]storyboard:shot_seconds: [3, 6]caption_required: true
The benefit of configuration is that it can be version-controlled and switched between different accounts without repeatedly modifying the prompts.
5. Integrating External Image Generation Services
Content plugins often need to invoke external capabilities, such as generating cover images or storyboards. This type of integration should follow these principles:
- API keys should be entered by the user in the settings, not written into the code or configuration files. At runtime, they should be read from environment variables or a secret management service.
- Isolate protocol details through an adapter layer. Business code should only depend on a unified interface and not directly couple with the specific parameters of a particular service.
- Set timeouts, retries, and failure fallbacks. If generation fails, retain the draft to prevent the entire workflow from being interrupted.
A sample adapter layer is shown below. The actual request path and parameters depend on the documentation of the selected service:
import jsonimport osimport timeimport urllib.requestclass ImageClient:def __init__(self, base_url: str, timeout: int = 30):self.base_url = base_url.rstrip("/")self.api_key = os.environ["IMAGE_API_KEY"]self.timeout = timeoutdef generate(self, prompt: str, retries: int = 2) -> bytes:body = json.dumps({"prompt": prompt}).encode("utf-8")req = urllib.request.Request(f"{self.base_url}/generate",
