Swiftor AI provides a versatile chat interface with two primary modes:
Interpreter Mode: Connects directly to a running Swiftor Virtual Machine (VM) via WebSocket. This allows you to interact with the VM's environment, execute commands, and potentially run specific tools or scripts available within the VM through an AI model.
Assistant Mode: Connects to various general-purpose Large Language Models (LLMs) for conversation, code generation, Q&A, and other AI tasks. Assistant chats are saved locally in your browser.
The interface is designed to seamlessly switch between these modes based on your selection.
Connect: Select a running VM from the Side Menu under "Interpreter" or via the VM Selector dropdown in the Input Area. A WebSocket connection will be established.
Select Model: Choose an appropriate Interpreter model (e.g., Claude 3.5 Sonnet).
Send Commands/Messages: Type natural language instructions or commands into the input area and press Enter.
View Output: The AI model interacts with the VM and streams back responses, which might include:
Console Output: Direct output from commands executed on the VM.
Code Blocks: Suggested code or scripts to run.
Status Messages: Updates from the server.
Approve Execution: If the Interpreter model suggests code to run (often presented in a code block), an "Approve" button may appear next to the last code block from the assistant. Clicking this sends a confirmation (go command) back to the interpreter to execute the suggested code on the connected VM.
Click "New Chat" in the Side Menu to start a fresh conversation.
Click an existing chat under "Assistant" in the Side Menu to load its history.
Select Model: Choose an Assistant model (e.g., Llama 3.1, Gemini Pro) using the Model Selector dropdown.
Send Messages: Type your query or prompt and press Enter.
View Response: The selected LLM will stream its response, typically formatted in Markdown, which may include text, lists, code blocks, etc.
Saving: Conversations are automatically saved to your browser's localStorage as you interact. The chat name in the side menu is automatically derived from the first user message but can be manually edited later (editing functionality not shown in provided code).