Add chat mode: use the node as a general VLM, not just a judge
New mode='chat' with system_prompt + user_prompt inputs runs your own prompt over the image(s) and returns raw text in 'analysis' — reusing the same model dropdown, quant, auto-download and backend. Makes it a one-node abliterated VLM for captioning, tagging, Q&A, prompt-from-image, etc. agent_bridge gains --mode chat / --system-prompt / --user-prompt (no receptor needed). Writes a chat report (latest.json) for the agent. Docs updated. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+10
-4
@@ -49,7 +49,7 @@ def _http_json(url: str, payload: dict | None = None, timeout: int = 30):
|
||||
|
||||
def _inject(graph: dict, prompt: str, negative: str, seed: int, run_tag: str, mode: str,
|
||||
reference_description: str = "", profile: str = "", model_select: str = "",
|
||||
model_path: str = ""):
|
||||
model_path: str = "", system_prompt: str = "", user_prompt: str = ""):
|
||||
"""Set the receptor's prompt/seed and the judge's mode/run_tag in-place.
|
||||
|
||||
compare mode needs a receptor (to inject the prompt). describe mode is the first
|
||||
@@ -76,6 +76,10 @@ def _inject(graph: dict, prompt: str, negative: str, seed: int, run_tag: str, mo
|
||||
inputs["model_select"] = model_select
|
||||
if model_path:
|
||||
inputs["model_path"] = model_path
|
||||
if system_prompt:
|
||||
inputs["system_prompt"] = system_prompt
|
||||
if user_prompt:
|
||||
inputs["user_prompt"] = user_prompt
|
||||
if mode == "compare" and not found_receptor:
|
||||
raise SystemExit(
|
||||
f"[agent_bridge] no '{RECEPTOR_CLASS}' node in the workflow — add the "
|
||||
@@ -116,8 +120,10 @@ def main(argv=None):
|
||||
ap = argparse.ArgumentParser(description="Drive one ComfyUI calibration iteration.")
|
||||
ap.add_argument("--server", default="127.0.0.1:8188")
|
||||
ap.add_argument("--workflow", required=True, help="API-format workflow JSON")
|
||||
ap.add_argument("--mode", choices=["compare", "describe"], default="compare",
|
||||
help="describe = first pass over the reference only (no prompt needed)")
|
||||
ap.add_argument("--mode", choices=["compare", "describe", "chat"], default="compare",
|
||||
help="describe = first pass over the reference; chat = general VLM with your prompts")
|
||||
ap.add_argument("--system-prompt", default="", help="chat mode: system prompt")
|
||||
ap.add_argument("--user-prompt", default="", help="chat mode: user prompt over the image(s)")
|
||||
ap.add_argument("--prompt", default="", help="generation prompt (required for compare)")
|
||||
ap.add_argument("--negative", default="")
|
||||
ap.add_argument("--seed", type=int, default=0)
|
||||
@@ -150,7 +156,7 @@ def main(argv=None):
|
||||
graph = json.load(f)
|
||||
|
||||
_inject(graph, args.prompt, args.negative, args.seed, args.run_tag, args.mode, ref_desc,
|
||||
args.profile, args.model_select, args.model_path)
|
||||
args.profile, args.model_select, args.model_path, args.system_prompt, args.user_prompt)
|
||||
|
||||
client_id = uuid.uuid4().hex
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user