Nodes/ComfyUI-dapaoAPI/⚙️API对话增强设置@炮老师的小课堂
ComfyUI Node

⚙️API对话增强设置@炮老师的小课堂

How the dapaoAI chat workbench gets its brains and its brakes

By paolaoshi·Created 10 months ago·Updated a day ago· 217
⚙️API对话增强设置@炮老师的小课堂
    • ⚙️对话设置
    📝 系统提示词
    🔢 最大历史轮数100
    📤 最大生成token4096
    🌡️ 温度0.70
    🎯 top_p0.90
    🔝 top_k20
    🔁 重复惩罚1.00
    📈 频率惩罚0.00
    📍 存在惩罚0.00
    🎲 随机种0
    🧠 输出think块false
    📐 图片最大边长2048

    DapaoAPIChatSettingsNode is the settings brick for the multi-turn chat workbench in ComfyUI-dapaoAPI - the one that decides how much history the model remembers, how hot it runs, whether you see the thinking, and how your images get squeezed before they're uploaded. It's a dumb config object with one output that plugs into DapaoAPIMultiTurnChatNode's ⚙️对话设置 input. It does no network I/O itself, so nothing to debug here - but what it sets shapes every chat call downstream.

    The inputs that matter

    • 📝 系统提示词 - your system prompt. The tooltip has a nice catch: if you connect a Skill loader, the Skill owns the system rules and this field is best left empty so the two don't fight.
    • 🔢 最大历史轮数 - how many past rounds get sent along. Default 100, clamped 1–100. This is your cost and quality lever in one: more history is more tokens and more money per call.
    • 🌡️ 温度 / 🎯 top_p / 📤 最大生成token - the usual generation controls. Temperature defaults 0.7, max tokens 4096.
    • 🔝 top_k and 🔁 重复惩罚 - with a twist the tooltip explains: at their defaults (20 and 1.0 respectively) the node simply doesn't send them. Only a model that actually supports top_k gets the value once you change it. Nice touch of relay-hygiene - most wrappers blindly post every parameter and let the API error out.
    • 🎲 随机种 - cache-only, never sent to the LLM. Same story as every node in this pack: changing it makes ComfyUI re-run, but the API result won't be pinned to it.
    • 🧠 输出think块 - toggle whether the model's reasoning/thinking block is returned alongside the answer. Handy for debugging, noisy for downstream piping.
    • 📐 图片最大边长 - the preprocessor for images in chat. Every image gets Lanczos-resized per-image so its longest side doesn't exceed this (default 2048, i.e. 2K) and is sent as PNG, right before the real request goes out. Keep it at 2K unless you're paying a per-token premium for giant inputs.

    How it works

    build_settings() assembles all of this into a DAPAO_API_CHAT_SETTINGS object - plain dict, version-tagged, zero secrets. The chat node reads it, merges it with the model config from DapaoAPILLMConfigNode, and uses the image-max-edge setting as it builds each message part. The penalty pair (📈 频率惩罚 / 📍 存在惩罚, both default 0, range −2 to 2) is sent as-is for models that accept OpenAI-style penalties.

    This is also where the two-second rule of this workbench lives: because settings are a separate node, you can A/B two settings blocks by just swapping the wire - same model config, different temperature, both sitting on the canvas. That's the reason the author split config and settings into separate nodes rather than one fat node, and it's a genuinely useful pattern for someone who's iterating on a chat pipeline.

    Where it slots in

    Full stack for a chat run: LLMConfig (model + key) → ChatSettings (how it talks) → optional SkillLoader (what it knows how to do) → optional MaterialLibrary (what it can look at) → MultiTurnChat (the actual conversation, which is an output node). This node is optional in that chain - leave the wire out and the chat node falls back to sane built-in defaults. Add it when you need history length control or image preprocessing limits, which is most real uses.

    Gotchas

    • History length multiplies token cost. A 100-round default on a long session can burn tokens faster than the images do.
    • The 2K image cap is a cap, not a target - small images get sent small. If a model benefits from higher-res input for OCR-heavy screenshots, this node is where you'd loosen it, up to 2048 max.
    • Chinese-only UI, as with the whole pack. The defaults are reasonable; if you touch nothing, you'll get a competent generic assistant.

    Install is the pack-level story: Manager → "dapaoAPI", or git clone + pip install -r requirements.txt into ComfyUI/custom_nodes/, then restart and drop a dapaoAI key in the config node upstream.

    Category🤖dapaoAPI/🍬大炮API常用工具🍬

    Inputs (12)

    NameTypeDefaultDescription
    📝 系统提示词STRING
    🔢 最大历史轮数INT1001–100
    📤 最大生成tokenINT409620–65536
    🌡️ 温度FLOAT0.700–2
    🎯 top_pFLOAT0.900–1
    🔝 top_kINT200–200默认20时不发送;修改后仅支持top_k的映射模型生效。
    🔁 重复惩罚FLOAT1.000.5–2默认1.0时不发送;修改后仅支持repeat_penalty的映射模型生效。
    📈 频率惩罚FLOAT0.00-2–2
    📍 存在惩罚FLOAT0.00-2–2
    🎲 随机种INT00–18446744073709550000控制ComfyUI缓存,不发送给LLM。
    🧠 输出think块BOOLEANfalse
    📐 图片最大边长INT2048128–2048每张图片在真实API请求边界逐张Lanczos缩放并以PNG发送;默认2K。

    Outputs (1)

    NameTypeDescription
    ⚙️对话设置DAPAO_API_CHAT_SETTINGS