feat: fix config bug
This commit is contained in:
@@ -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):
|
||||
|
||||
@@ -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())
|
||||
@@ -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())
|
||||
Reference in New Issue
Block a user