llama.vscode/ui
igardev c1edca02c4
Predefined lists and refactoring (#118)
- File menu.ts refactored
- Predefined lists added for completion models, chat models, embeddings models, tools models and for envs
- Bugfixes
- If chat model is not selected, but a tools model is selected, it is used for generating commit messages, editing code with AI and in search_source tool
2025-09-30 19:32:06 +03:00
..
src Predefined lists and refactoring (#118) 2025-09-30 19:32:06 +03:00
package-lock.json Improve llama agent (#93) 2025-08-14 17:11:56 +03:00
package.json Improve llama agent (#93) 2025-08-14 17:11:56 +03:00
README.md Environment UI (#106) 2025-09-05 00:59:21 +03:00
tsconfig.json Agent support added (#79) 2025-08-01 15:59:16 +03:00
webpack.config.js Agent support added (#79) 2025-08-01 15:59:16 +03:00

Llama VSCode UI

This is the React UI for the Llama VSCode extension. The application has been refactored to use separate components for different pages instead of having everything in a single App.tsx file.

Component Structure

Main Components

  • App.tsx - Main application component that handles view switching and global state
  • AgentView.tsx - Main chat interface with AI agent functionality
  • AIRunnerView.tsx - Local AI runner interface for model management
  • AddEnvView.tsx - Environment configuration interface

Shared Types

  • types/vscode.ts - Shared VSCode API declarations and utilities

Architecture

State Management

The application uses React's useState and useEffect hooks for state management. Global state is persisted to VSCode's extension state and restored on application startup.

View Switching

The application uses a simple string-based view system:

  • agent - Default view showing the main chat interface
  • airunner - Local AI runner interface
  • addenv - Environment configuration interface

Component Communication

Components communicate with the VSCode extension through the vscode.postMessage() API and receive messages through the window.addEventListener('message') event listener.

Development

Building

npm run build

Development Server

npm start

File Structure

ui/src/
├── components/
│   ├── AgentView.tsx
│   ├── AIRunnerView.tsx
│   ├── AddEnvView.tsx
│   └── index.ts
├── types/
│   └── vscode.ts
├── App.tsx
├── index.tsx
├── styles.css
└── index.html

Refactoring Notes

The original App.tsx file contained all the UI logic for three different views. This has been refactored into:

  1. App.tsx - Now serves as a simple view switcher and state manager
  2. AgentView.tsx - Contains all the chat interface logic including:
    • File selection dialog
    • Markdown rendering
    • Context file management
    • Input handling
  3. AIRunnerView.tsx - Contains the local AI runner interface
  4. AddEnvView.tsx - Contains the environment configuration interface

All functionality has been preserved and the user experience remains exactly the same.