凤希AI - 提示词优化 - 本地Ollama
Polish your prompts with a local Ollama model, no cloud, no key
- 图片一
- 图片二
- 图片三
- 生成的提示词
- 分段时长
FxAiPromptGenerator is the pack's local prompt-enhancer: it takes a rough idea and asks a model running in your Ollama to rewrite it into a better generation prompt. The name is a small lie - this node doesn't run any model itself. It's a client for Ollama, which you run separately, and it needs no API key, no account, no cloud. If you've got Ollama installed and a model pulled, this is a zero-cost way to put an LLM inside your graph. If you don't, the node is dead weight until you fix that.
The mechanism is a direct call to Ollama's HTTP API. When the 是否开启提示词优化 (enable optimization) toggle is on, it POSTs your 用户提示词 to POST http://127.0.0.1:11434/api/generate with the 系统提示词 you provide, the selected model, and - the nice part - up to three images (图片一/图片二/图片三) base64-encoded, so a vision model can describe or edit from pictures before rewriting. The 模型选择 dropdown is populated live from your running Ollama via the pack's /fxai/prompt/get_models endpoint - hit the refresh button in the front-end and installed models appear. 分段时长 (segment duration, a FLOAT you can pass in) gets prepended to the system prompt so the model knows how long a video segment it's writing for. When the toggle is off, it just passes your prompt straight through - that's the safety valve, and it's why the node is safe to leave in a workflow permanently.
Outputs: 生成的提示词 (STRING - the model's response, or your original prompt if optimization is off or the call fails) and 分段时长 (FLOAT, a pass-through of the input, handy for downstream frame math). There's also a 推理后释放资源 toggle that sends keep_alive: 0 to Ollama afterward, unloading the model from VRAM - nice if you're sharing the GPU with the diffusion model.
Real talk on what to expect, from the KB's llm-in-comfyui.md: the two failure modes of local prompt enhancers are dirty output (the model adds assistant: preamble or markdown that bleeds into your conditioning) and subject drift (the enhancer adding detail you never asked for). This node doesn't do token-level stopping or regex cleanup, so keep your system prompt tight - "output only the prompt, no explanation" - and don't expect miracles from a small model. This is a convenience that removes the blank-page problem, not a writer.
The main setup gotcha is that the model list is empty until you (a) actually have Ollama running and (b) click refresh - and it needs a vision model if you plan to feed images (something like qwen2.5vl or llava, pulled via ollama pull <name>). It's under 凤希AI/提示词 in the pack:
cd ComfyUI/custom_nodes
git clone https://github.com/fxai666/fxai-toolkit
or ComfyUI Manager → search "fxai-toolkit", then restart. If you already live in the local-LLM world, this is the cleanest on-ramp the pack has to offer.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| 是否开启提示词优化 | BOOLEAN | false | 当关闭时,原样输出提示词 |
| API主机地址 | STRING | http://127.0.0.1:11434 | — |
| 模型选择 | COMBO | 1 options: | |
| 推理后释放资源 | BOOLEAN | true | — |
| 系统提示词 | STRING | — | |
| 分段时长opt | FLOAT | 0.00 | — |
| 用户提示词opt | STRING | 请根据图片生成优质AI绘画提示词 | — |
| 图片一opt | IMAGE | — | |
| 图片二opt | IMAGE | — | |
| 图片三opt | IMAGE | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| 生成的提示词 | STRING | — |
| 分段时长 | FLOAT | — |