Improve config lookup and OpenAI streaming decode

This commit is contained in:
2025-10-01 17:27:37 +02:00
parent dccaf8e870
commit 4271ee3d73
5 changed files with 178 additions and 32 deletions

View File

@@ -5,8 +5,10 @@ Goaichat is a terminal-based AI chat client written in Go. It connects to OpenAI
## Features
- **Config-driven startup**: Loads defaults from `config.yaml` with environment overrides.
- **Interactive chat loop**: (In progress) command-driven conversation with persistent history.
- **Extensible architecture**: Structured packages under `internal/` for config, app wiring, chat, storage, OpenAI client, UI, and telemetry.
- **Interactive chat loop**: Command-driven conversation with OpenAI-compatible models.
- **Persistent history**: Sessions and messages are stored in SQLite, allowing `/open` and `/rename` commands.
- **Session naming assistance**: The assistant suggests descriptive session names that you can adopt.
- **Extensible architecture**: Structured packages under `internal/` for configuration, chat orchestration, storage, OpenAI client integration, and CLI wiring.
## Getting Started
@@ -31,7 +33,7 @@ go build ./cmd/goaichat
### Configuration
Create `config.yaml` in the project root or pass `--config` to specify a path. A minimal configuration looks like:
Create `config.yaml` in the project root or pass `--config` to specify a path. When no path is provided, Goaichat searches the current working directory first and then `$HOME/.config/goaichat/config.yaml`. A minimal configuration looks like:
```yaml
api:
@@ -58,7 +60,24 @@ Environment variables override several fields:
go run ./cmd/goaichat --config path/to/config.yaml
```
The current build logs startup/shutdown messages while core services are implemented. Upcoming milestones include the chat loop, persistence, OpenAI integration, and Bubble Tea UI.
### Usage
After launching, type messages at the prompt. The following commands are available:
- `/help` display available commands.
- `/reset` clear the current in-memory conversation.
- `/list` list saved sessions with summaries.
- `/open <name>` load a previously saved session by name.
- `/rename <name>` assign a new name to the current session (use suggestions or provide your own).
- `/exit` quit the application.
The assistant proposes session name suggestions after the first reply in a session. Use `/rename <suggested-name>` to accept them quickly.
### Persistence
Goaichat uses SQLite for storage. On first run, the application applies migrations from `internal/storage/migrations/`. Sessions are automatically created when you begin chatting, and every message is stored for later retrieval.
By default the database is stored at `$HOME/.local/share/goaichat/goaichat.db`. You can override the location via the `storage.path` or `storage.base_dir` settings in `config.yaml`.
## Development
@@ -67,4 +86,4 @@ The current build logs startup/shutdown messages while core services are impleme
## License
TBD
This project is licensed under the [MIT License](LICENSE).