Proxy config
This commit is contained in:
@@ -106,7 +106,7 @@ async def handle(args: Dict[str, Any]) -> List[Dict[str, Any]]:
|
||||
res_cfg = load_toml(config.RES_PRESETS_PATH)
|
||||
|
||||
if model_name not in models_cfg:
|
||||
raise ToolError(f"Model '{model_name}' not found in presets. Available: {', '.join(models_cfg.keys())}")
|
||||
raise ToolError(f"Model '{model_name}' not found in presets. Please call get_model_info to see available models and their correct names.")
|
||||
|
||||
model_preset = models_cfg[model_name]
|
||||
|
||||
@@ -187,9 +187,9 @@ async def handle(args: Dict[str, Any]) -> List[Dict[str, Any]]:
|
||||
raise ToolError(f"Could not extract file path from SD URL: {sd_img_url}")
|
||||
|
||||
# Construct proxy URL through our MCP server
|
||||
# We strip leading slash from raw_path to avoid double slashes in the proxy URL if we want,
|
||||
# but the current endpoint handles it.
|
||||
proxy_url = f"http://localhost:{config.PORT}/file{raw_path}"
|
||||
# Use the captured request host to ensure links work across the network
|
||||
host = config.request_host.get()
|
||||
proxy_url = f"http://{host}/file{raw_path}"
|
||||
|
||||
# Download the image and convert to base64 for the AI's vision
|
||||
img_resp = await asyncio.to_thread(requests.get, sd_img_url, timeout=30)
|
||||
|
||||
Reference in New Issue
Block a user