Proxy config

This commit is contained in:
2026-07-27 02:47:00 -07:00
parent c0c3a4c405
commit f423764645
3 changed files with 13 additions and 6 deletions
+4 -4
View File
@@ -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)