Commit a5a52504 authored by Your Name's avatar Your Name

Fix global_args not being passed to images module

- Added set_global_args call for images module in main.py
- Each API module has its own global_args, so it needs to be set separately
- Added debug logging to trace global_args in images.py
parent a28c6863
...@@ -98,6 +98,7 @@ def save_image_response(img, request_format="base64", http_request=None): ...@@ -98,6 +98,7 @@ def save_image_response(img, request_format="base64", http_request=None):
# Add URL to response # Add URL to response
# Determine base URL based on --url argument # Determine base URL based on --url argument
url_setting = getattr(global_args, 'url', 'auto') if global_args else 'auto' url_setting = getattr(global_args, 'url', 'auto') if global_args else 'auto'
print(f"DEBUG: global_args={global_args}, url_setting={url_setting}")
if url_setting == 'auto': if url_setting == 'auto':
# Use server host from request headers (what client used to connect) # Use server host from request headers (what client used to connect)
if http_request: if http_request:
......
...@@ -94,6 +94,10 @@ def main(): ...@@ -94,6 +94,10 @@ def main():
from codai.api.images import set_global_file_path as set_images_file_path from codai.api.images import set_global_file_path as set_images_file_path
set_images_file_path(global_file_path) set_images_file_path(global_file_path)
# Also set global args for images module (it has its own global_args)
from codai.api.images import set_global_args as set_images_global_args
set_images_global_args(args)
# Also set file path for app.py (needed for /v1/files endpoint) # Also set file path for app.py (needed for /v1/files endpoint)
from codai.api.app import set_global_file_path_wrapper from codai.api.app import set_global_file_path_wrapper
set_global_file_path_wrapper(global_file_path) set_global_file_path_wrapper(global_file_path)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment