diff --git a/src/ai_client.py b/src/ai_client.py index e72bcc8e..efc85193 100644 --- a/src/ai_client.py +++ b/src/ai_client.py @@ -49,7 +49,7 @@ from src.vendor_capabilities import VendorCapabilities, get_capabilities # TODO(Ed): Eliminate these? from src.events import EventEmitter from src.gemini_cli_adapter import GeminiCliAdapter -from src.models import ToolPreset, BiasProfile, Tool +from src.models import FileItem, ToolPreset, BiasProfile, Tool from src.paths import get_credentials_path from src.tool_bias import ToolBiasEngine from src.tool_presets import ToolPresetManager @@ -2562,7 +2562,8 @@ def _send_grok(md_content: str, user_message: str, base_dir: str, if file_items: for fi in file_items: if fi.get("is_image") and fi.get("base64_data"): - user_content = f"[IMAGE: {fi.get('path', 'attachment')}]\n{user_content}" + fi_item = fi if hasattr(fi, 'path') else models.FileItem(path=fi.get('path', 'attachment')) + user_content = f"[IMAGE: {fi_item.path or 'attachment'}]\n{user_content}" if discussion_history and not history: history.append({"role": "user", "content": f"[DISCUSSION HISTORY]\n\n{discussion_history}\n\n---\n\n{user_message}"}) else: @@ -2804,7 +2805,8 @@ def _send_qwen(md_content: str, user_message: str, base_dir: str, if file_items: for fi in file_items: if fi.get("is_image") and fi.get("base64_data"): - user_content = f"[IMAGE: {fi.get('path', 'attachment')}]\n{user_content}" + fi_item = fi if hasattr(fi, 'path') else models.FileItem(path=fi.get('path', 'attachment')) + user_content = f"[IMAGE: {fi_item.path or 'attachment'}]\n{user_content}" if discussion_history and not history: history.append({"role": "user", "content": f"[DISCUSSION HISTORY]\n\n{discussion_history}\n\n---\n\n{user_message}"}) else: @@ -2895,7 +2897,8 @@ def _send_llama(md_content: str, user_message: str, base_dir: str, if file_items: for fi in file_items: if fi.get("is_image") and fi.get("base64_data"): - user_content = f"[IMAGE: {fi.get('path', 'attachment')}]\n{user_content}" + fi_item = fi if hasattr(fi, 'path') else models.FileItem(path=fi.get('path', 'attachment')) + user_content = f"[IMAGE: {fi_item.path or 'attachment'}]\n{user_content}" if discussion_history and not history: history.append({"role": "user", "content": f"[DISCUSSION HISTORY]\n\n{discussion_history}\n\n---\n\n{user_message}"}) else: diff --git a/src/app_controller.py b/src/app_controller.py index 4599391d..8a33c2fc 100644 --- a/src/app_controller.py +++ b/src/app_controller.py @@ -3507,7 +3507,7 @@ class AppController: `self._last_request_errors` for sub-track 4 GUI display.""" try: symbols = parse_symbols(user_msg) - file_paths = [f['path'] for f in file_items] + file_paths = [f.path if hasattr(f, 'path') else f for f in file_items] for symbol in symbols: res = get_symbol_definition(symbol, file_paths) if res: