The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.
feat(api-nodes): add copy button to Gemini Chat node (#9440)
Alexander Piskun050c67323c33
diff --git a/comfy_api_nodes/nodes_gemini.py b/comfy_api_nodes/nodes_gemini.pyindex ba4167a50..78c402a7a 100644--- a/comfy_api_nodes/nodes_gemini.py+++ b/comfy_api_nodes/nodes_gemini.py@@ -5,7 +5,10 @@ See: https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/inferfrom __future__ import annotations+import json+import timeimport os+import uuidfrom enum import Enumfrom typing import Optional, Literal@@ -350,7 +353,27 @@ class GeminiNode(ComfyNodeABC):# Get result outputoutput_text = self.get_text_from_response(response)if unique_id and output_text:- PromptServer.instance.send_progress_text(output_text, node_id=unique_id)+ # Not a true chat history like the OpenAI Chat node. It is emulated so the frontend can show a copy button.+ render_spec = {+ "node_id": unique_id,+ "component": "ChatHistoryWidget",+ "props": {+ "history": json.dumps(+ [+ {+ "prompt": prompt,+ "response": output_text,+ "response_id": str(uuid.uuid4()),+ "timestamp": time.time(),+ }+ ]+ ),+ },+ }+ PromptServer.instance.send_sync(+ "display_component",+ render_spec,+ )return (output_text or "Empty response from Gemini model...",)