mud_server.admin_gradio.tabs.ollama_tab ======================================= .. py:module:: mud_server.admin_gradio.tabs.ollama_tab .. autoapi-nested-parse:: Ollama Tab for MUD Client. This module provides the Ollama management interface for controlling AI models. Visible only for admin and superuser roles. Migration Notes: - Migrated from old api_client.py to new modular structure - Uses OllamaAPIClient for Ollama command execution and context management - Wrapper functions extract session_id and role from session_state - Returns message string for Gradio display - Parameter order changed: session_id and role now come first Functions --------- .. autoapisummary:: mud_server.admin_gradio.tabs.ollama_tab.execute_ollama_command mud_server.admin_gradio.tabs.ollama_tab.clear_ollama_context mud_server.admin_gradio.tabs.ollama_tab.create Module Contents --------------- .. py:function:: execute_ollama_command(server_url, command, session_state) Execute an Ollama command on the specified server (Admin/Superuser only). Sends request to backend via OllamaAPIClient and returns command output. This function wraps the new OllamaAPIClient.execute_command() method to maintain compatibility with the Gradio interface while using the new modular API. Note: Parameter order is maintained from old API (server_url, command, session_state) for compatibility with existing Gradio event handlers. :param server_url: URL of the Ollama server :param command: Ollama command to execute :param session_state: User's session state dictionary containing session_id and role :returns: Command output string or error message .. admonition:: Examples >>> session = {"session_id": "admin123", "role": "admin", "logged_in": True} >>> result = execute_ollama_command("http://localhost:11434", "list", session) >>> isinstance(result, str) True .. py:function:: clear_ollama_context(session_state) Clear Ollama conversation context for the current session (Admin/Superuser only). Sends request to backend via OllamaAPIClient and returns confirmation message. This function wraps the new OllamaAPIClient.clear_context() method to maintain compatibility with the Gradio interface while using the new modular API. :param session_state: User's session state dictionary containing session_id and role :returns: Confirmation message string or error message .. admonition:: Examples >>> session = {"session_id": "admin123", "role": "admin", "logged_in": True} >>> result = clear_ollama_context(session) >>> isinstance(result, str) True .. py:function:: create(session_state) Create the Ollama tab with model management interface. :param session_state: Gradio State component for session tracking :returns: Configured Ollama tab component :rtype: gr.Tab