Nodes/ComfyUI-WebPrompter/2. News Script Generator
ComfyUI Node

2. News Script Generator

Turn any article into a broadcast-ready news script, one OpenAI call at a time

By Gary-yeh·Created about a year ago·Updated about a year ago· 1
2. News Script Generator
    • news_script
    original_text
    system_promptYou are a professional news script editor... (此處省略之前設計的詳細 prompt)
    model
    max_tokens500
    temperature0.2

    This is the "write" half of ComfyUI-WebPrompter, and it's the node that actually does the AI part. Feed it a chunk of raw text - normally the original_text output of 1. Content Fetcher, but any text works - and it sends it to OpenAI, asking a chat model to rewrite it into a factual, broadcast-style news script. The output is a plain string you can save, read aloud, or drop into a prompt.

    The name is the honest part: this is a thin wrapper around one OpenAI chat-completions call. At node construction it reads your OPENAI_API_KEY from the environment; at run time it builds a message pair - your system_prompt as the system message, original_text as the user message - and calls chat.completions.create with model, max_tokens, and temperature. No local model, no GPU, no tokenizers fighting over your VRAM. ComfyUI just waits (synchronously, so the queue freezes) for the API to answer.

    The inputs that matter:

    • original_text - the text to rewrite. Wire this from Content Fetcher or type anything in.
    • system_prompt - the instruction that shapes the rewrite. Here's the trap: the default shipped in the code is literally a placeholder - "You are a professional news script editor... (the detailed prompt designed before is omitted here)". It is not a real prompt. Write your own, e.g. "You are a news script editor. Rewrite the following article as a concise, factual broadcast script for a TV news anchor."
    • model - fixed to gpt-4-turbo, gpt-4o, or gpt-3.5-turbo. gpt-4o is the sensible default; gpt-3.5-turbo is aging out and will give you noticeably flatter scripts.
    • max_tokens - 500 by default, up to 4096. If your script keeps getting cut off mid-sentence, this is why - raise it.
    • temperature - 0.2 default. Keep it low for news; you want faithful fact-tight copy, not creative license.

    The single output, news_script, is the final result. The README shows the two sensible destinations: a Save Text File node (from WAS Node Suite) to write the script to disk, or a CLIP Text Encode node if you're turning the script into a text prompt for image generation.

    Install is the shared pack install: ComfyUI Manager, or git clone https://github.com/Gary-yeh/ComfyUI-WebPrompter into custom_nodes/, pip install -r requirements.txt, restart. But unlike the Content Fetcher, this node has a hard prerequisite: the OPENAI_API_KEY environment variable must exist before ComfyUI starts. On Linux/macOS, export OPENAI_API_KEY=sk-... (put it in your shell profile); on Windows, setx OPENAI_API_KEY "sk-..." and reopen the terminal. If the key is missing, the node doesn't crash - it returns "ERROR: OpenAI API key is not configured" as its output string, which then flows into whatever you're wired to.

    Two gotchas worth remembering. First, errors are returned as text, not raised - if the API call fails or you set a placeholder prompt, you'll get the problem delivered silently as your "script", so keep a Show Text node in the loop. Second, every run costs you API money and a few seconds of wall-clock; it's the least "local" node in ComfyUI by design. For quick one-offs you're often faster writing the script yourself - but for turning a daily pile of articles into anchor-ready copy, it earns its place.

    CategoryWebPrompter

    Inputs (5)

    NameTypeDefaultDescription
    original_textSTRING
    system_promptSTRINGYou are a professional news script editor... (此處省略之前設計的詳細 prompt)
    modelCOMBO3 options: gpt-4-turbo, gpt-4o, gpt-3.5-turbo
    max_tokensINT50050–4096
    temperatureFLOAT0.20–1

    Outputs (1)

    NameTypeDescription
    news_scriptSTRING