mirror of
https://github.com/mudler/LocalAI.git
synced 2026-06-11 18:27:32 -04:00
Add an opt-in `local-ai chat` command for testing chat models directly from the terminal without manually sending curl requests. The command connects to a running LocalAI server, lists available models through the existing OpenAI-compatible API, streams chat completions, and supports interactive commands such as `/models`, `/model`, `/clear`, and `/exit`. Keep `local-ai run` focused on the server lifecycle so the web UI, API clients, and multiple chat terminals can coexist against the same server. Document the new command and terminal workflow in the README and CLI docs. Tests: - go test -count=1 ./core/cli/chat - go test -count=1 ./core/cli Assisted-by: Codex:GPT-5 Signed-off-by: Ching Kao <0980124jim@gmail.com>
28 lines
1.9 KiB
Go
28 lines
1.9 KiB
Go
package cli
|
|
|
|
import (
|
|
cliContext "github.com/mudler/LocalAI/core/cli/context"
|
|
"github.com/mudler/LocalAI/core/cli/worker"
|
|
)
|
|
|
|
var CLI struct {
|
|
cliContext.Context `embed:""`
|
|
|
|
Run RunCMD `cmd:"" help:"Run LocalAI, this the default command if no other command is specified. Run 'local-ai run --help' for more information" default:"withargs"`
|
|
Chat ChatCMD `cmd:"" help:"Open an interactive chat session against a running LocalAI server"`
|
|
Federated FederatedCLI `cmd:"" help:"Run LocalAI in federated mode"`
|
|
Models ModelsCMD `cmd:"" help:"Manage LocalAI models and definitions"`
|
|
Backends BackendsCMD `cmd:"" help:"Manage LocalAI backends and definitions"`
|
|
TTS TTSCMD `cmd:"" help:"Convert text to speech"`
|
|
SoundGeneration SoundGenerationCMD `cmd:"" help:"Generates audio files from text or audio"`
|
|
Transcript TranscriptCMD `cmd:"" help:"Convert audio to text"`
|
|
P2PWorker worker.Worker `cmd:"" name:"p2p-worker" help:"Run workers to distribute workload via p2p (llama.cpp-only)"`
|
|
Worker WorkerCMD `cmd:"" help:"Start a worker for distributed mode (generic, backend-agnostic)"`
|
|
AgentWorker AgentWorkerCMD `cmd:"" name:"agent-worker" help:"Start an agent worker for distributed mode (executes agent chats via NATS)"`
|
|
Util UtilCMD `cmd:"" help:"Utility commands"`
|
|
Agent AgentCMD `cmd:"" help:"Run agents standalone without the full LocalAI server"`
|
|
MCPServer MCPServerCMD `cmd:"" name:"mcp-server" help:"Run the LocalAI admin tool surface as a stdio MCP server (controls a remote LocalAI instance over HTTP)"`
|
|
Explorer ExplorerCMD `cmd:"" help:"Run p2p explorer"`
|
|
Completion CompletionCMD `cmd:"" help:"Generate shell completion scripts for bash, zsh, or fish"`
|
|
}
|