More bugfixes

This commit is contained in:
2026-01-07 11:09:13 +01:00
parent 2c9f33868e
commit c305d5cf49

18
oai.py
View File

@@ -313,14 +313,14 @@ Use /help mcp for comprehensive guide with examples.'''
'notes': 'Without arguments, shows info for the currently selected model. Displays pricing per million tokens, supported modalities (text, image, etc.), and parameter support.' 'notes': 'Without arguments, shows info for the currently selected model. Displays pricing per million tokens, supported modalities (text, image, etc.), and parameter support.'
}, },
'/model': { '/model': {
'description': 'Select or change the AI model for the current session. Shows image and online capabilities.', 'description': 'Select or change the AI model for the current session. Shows image, online, and tool capabilities.',
'usage': '/model [search_term]', 'usage': '/model [search_term]',
'examples': [ 'examples': [
('List all models', '/model'), ('List all models', '/model'),
('Search for GPT models', '/model gpt'), ('Search for GPT models', '/model gpt'),
('Search for Claude models', '/model claude'), ('Search for Claude models', '/model claude'),
], ],
'notes': 'Models are numbered for easy selection. The table shows Image (✓ if model accepts images) and Online (✓ if model supports web search) columns.' 'notes': 'Models are numbered for easy selection. The table shows Image (✓ if model accepts images), Online (✓ if model supports web search), and Tools (✓ if model supports function calling for MCP).'
}, },
'/config': { '/config': {
'description': 'View or modify application configuration settings.', 'description': 'View or modify application configuration settings.',
@@ -2586,6 +2586,10 @@ def supports_function_calling(model: Dict[str, Any]) -> bool:
supported_params = model.get("supported_parameters", []) supported_params = model.get("supported_parameters", [])
return "tools" in supported_params or "functions" in supported_params return "tools" in supported_params or "functions" in supported_params
def supports_tools(model: Dict[str, Any]) -> bool:
"""Check if model supports tools/function calling (same as supports_function_calling)."""
return supports_function_calling(model)
def check_for_updates(current_version: str) -> str: def check_for_updates(current_version: str) -> str:
"""Check for updates.""" """Check for updates."""
try: try:
@@ -4008,11 +4012,12 @@ def chat():
console.print(f"[bold red]No models match '{search_term}'. Try '/model'.[/]") console.print(f"[bold red]No models match '{search_term}'. Try '/model'.[/]")
continue continue
table = Table("No.", "Name", "ID", "Image", "Online", show_header=True, header_style="bold magenta") table = Table("No.", "Name", "ID", "Image", "Online", "Tools", show_header=True, header_style="bold magenta")
for i, model in enumerate(filtered_models, 1): for i, model in enumerate(filtered_models, 1):
image_support = "[green]✓[/green]" if has_image_capability(model) else "[red]✗[/red]" image_support = "[green]✓[/green]" if has_image_capability(model) else "[red]✗[/red]"
online_support = "[green]✓[/green]" if supports_online_mode(model) else "[red]✗[/red]" online_support = "[green]✓[/green]" if supports_online_mode(model) else "[red]✗[/red]"
table.add_row(str(i), model["name"], model["id"], image_support, online_support) tools_support = "[green]✓[/green]" if supports_function_calling(model) else "[red]✗[/red]"
table.add_row(str(i), model["name"], model["id"], image_support, online_support, tools_support)
title = f"[bold green]Available Models ({'All' if not search_term else f'Search: {search_term}'})[/]" title = f"[bold green]Available Models ({'All' if not search_term else f'Search: {search_term}'})[/]"
display_paginated_table(table, title) display_paginated_table(table, title)
@@ -4215,11 +4220,12 @@ def chat():
console.print(f"[bold red]No models match '{search_term}'. Try without search.[/]") console.print(f"[bold red]No models match '{search_term}'. Try without search.[/]")
continue continue
table = Table("No.", "Name", "ID", "Image", "Online", show_header=True, header_style="bold magenta") table = Table("No.", "Name", "ID", "Image", "Online", "Tools", show_header=True, header_style="bold magenta")
for i, model in enumerate(filtered_models, 1): for i, model in enumerate(filtered_models, 1):
image_support = "[green]✓[/green]" if has_image_capability(model) else "[red]✗[/red]" image_support = "[green]✓[/green]" if has_image_capability(model) else "[red]✗[/red]"
online_support = "[green]✓[/green]" if supports_online_mode(model) else "[red]✗[/red]" online_support = "[green]✓[/green]" if supports_online_mode(model) else "[red]✗[/red]"
table.add_row(str(i), model["name"], model["id"], image_support, online_support) tools_support = "[green]✓[/green]" if supports_function_calling(model) else "[red]✗[/red]"
table.add_row(str(i), model["name"], model["id"], image_support, online_support, tools_support)
title = f"[bold green]Available Models for Default ({'All' if not search_term else f'Search: {search_term}'})[/]" title = f"[bold green]Available Models for Default ({'All' if not search_term else f'Search: {search_term}'})[/]"
display_paginated_table(table, title) display_paginated_table(table, title)