From fff11581935ca1205e2b05da1c32ee2a2c2acb07 Mon Sep 17 00:00:00 2001 From: ai-business-hql Date: Tue, 24 Jun 2025 20:09:15 +0800 Subject: [PATCH] feat: fix config bug --- backend/controller/conversation_api.py | 2 +- backend/service/mcp-client.py | 13 +------ backend/service/test_image_support.py | 52 -------------------------- 3 files changed, 2 insertions(+), 65 deletions(-) delete mode 100644 backend/service/test_image_support.py diff --git a/backend/controller/conversation_api.py b/backend/controller/conversation_api.py index 9d1ff57..0611690 100644 --- a/backend/controller/conversation_api.py +++ b/backend/controller/conversation_api.py @@ -32,7 +32,7 @@ except ImportError: ImageData = mcp_client_module.ImageData except Exception as e: print(f"Warning: Could not import comfyui_agent_invoke: {e}, using mock implementation") - async def comfyui_agent_invoke(prompt, images=None): + async def comfyui_agent_invoke(prompt, images=None, config=None): yield f"Mock response for: {prompt}" class ImageData: def __init__(self, filename: str, data: str, url: str = None): diff --git a/backend/service/mcp-client.py b/backend/service/mcp-client.py index 1bf201f..e25ed25 100644 --- a/backend/service/mcp-client.py +++ b/backend/service/mcp-client.py @@ -2,7 +2,7 @@ Author: ai-business-hql qingli.hql@alibaba-inc.com Date: 2025-06-16 16:50:17 LastEditors: ai-business-hql qingli.hql@alibaba-inc.com -LastEditTime: 2025-06-18 19:30:44 +LastEditTime: 2025-06-24 20:08:13 FilePath: /comfyui_copilot/backend/service/mcp-client.py Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE ''' @@ -201,14 +201,3 @@ You must adhere to the following constraints to complete the task: # Yield error as tuple to maintain consistency yield (error_message, None) - -async def test(): - test_messages = [ - {"role": "user", "content": "我需要一个推荐的工作流来创建SK波普风插画,请帮我找到合适的工作流。"} - ] - async for result in comfyui_agent_invoke(test_messages): - print(f"Test result: {result}") - - -if __name__ == "__main__": - asyncio.run(test()) \ No newline at end of file diff --git a/backend/service/test_image_support.py b/backend/service/test_image_support.py deleted file mode 100644 index cfc86ec..0000000 --- a/backend/service/test_image_support.py +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env python3 -""" -Test script for image support in mcp-client -""" -import asyncio -import base64 -import os -from mcp_client import comfyui_agent_invoke, ImageData - -async def test_image_support(): - """Test image support functionality""" - - # Create a simple test image (1x1 pixel red image as base64) - test_image_base64 = "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChAGA4RDOaQAAAABJRU5ErkJggg==" - - # Create ImageData object - test_image = ImageData( - filename="test_image.png", - data=f"data:image/png;base64,{test_image_base64}", - url=None # No URL, will use base64 data - ) - - # Test with image - print("Testing image support...") - prompt = "Please describe what you see in this image and suggest a ComfyUI workflow that could create something similar." - - try: - async for text, ext in comfyui_agent_invoke(prompt, [test_image]): - print(f"Response: {text[:100]}...") - if ext: - print(f"Extension data: {ext}") - - print("Image support test completed successfully!") - - except Exception as e: - print(f"Error testing image support: {str(e)}") - - # Test without image for comparison - print("\nTesting without image...") - try: - async for text, ext in comfyui_agent_invoke("Tell me about ComfyUI workflows for image generation.", None): - print(f"Response: {text[:100]}...") - if ext: - print(f"Extension data: {ext}") - - print("Text-only test completed successfully!") - - except Exception as e: - print(f"Error testing text-only: {str(e)}") - -if __name__ == "__main__": - asyncio.run(test_image_support()) \ No newline at end of file