- The chat's top-right menu only repeated the per-turn menu. It now opens a files sidebar that slides in from the right, the way the official client's right panel does: browse the session directory with a breadcrumb and an up key, filter the current directory, search its subdirectories (bounded, skipping .git/node_modules/build and friends), preview text/code/Markdown/ images, edit and save text files, create files and folders, and download any file through the system save dialog. - The panel's "..." menu carries the official client's "显示被 git 忽略的文件" toggle (the listing asks the server to respect gitignore by default) and a refresh. 项目知识 and 终端 have their tabs, marked as coming later. - Thinking blocks are Markdown too (headings, lists, inline code), rendered with the shared MarkdownView at a smaller, quieter size. - The reconnect banner stayed forever: the stream loop sets it when the SSE connection drops and nothing cleared it. Any event proves the stream is back (the server greets every connection with server.connected), so it now clears the message then. - Markdown rendering moved to lib/widgets/markdown_view.dart, shared by messages, thinking, compaction summaries and file previews. Version 0.3.9 (code 309).
81 lines
4.0 KiB
Markdown
81 lines
4.0 KiB
Markdown
# OpenChamber Native
|
|
|
|
A lightweight OpenChamber client for phones, written in **Flutter** (Dart).
|
|
Android first. This branch (`flutter`) is a framework evaluation: the same
|
|
feature set as the earlier Asuka/Go and MyGo attempts, reimplemented in
|
|
Flutter to compare mobile UI maturity.
|
|
|
|
Status: 0.3.9 — servers (passwordless / password login, HTTP/HTTPS and
|
|
SOCKS5/socks5h proxy, self-signed certificates and pinning), session list with search and live
|
|
events, chat with streaming Markdown and full history paging, tool steps
|
|
grouped per turn (icon, one-line summary, foldable run) with image previews, a
|
|
context usage ring with a detail sheet, model/agent switching (Build/Plan only,
|
|
current one checked), copy / fork / revert, attachments (photos/files),
|
|
permissions. Android 7.0 (API 24)+, plus a Linux desktop target used for local
|
|
testing.
|
|
|
|
## What is here
|
|
|
|
| Path | What |
|
|
| --- | --- |
|
|
| `lib/api/` | Dart OpenChamber client: auth, sessions, messages, SSE, models/agents, permissions, prompt/interrupt/fork/revert, `/api/fs/raw`; HTTP/HTTPS proxies via `HttpClient.findProxy`, SOCKS5/socks5h via `socks5_proxy`, pinning/self-signed via `badCertificateCallback` |
|
|
| `lib/storage.dart` | Saved servers in `shared_preferences`, tokens in `flutter_secure_storage` (Android Keystore) |
|
|
| `lib/state.dart` | The app state: connections, live sessions, the open chat, and SSE event folding |
|
|
| `lib/screens/` | Servers, sessions, chat (streaming Markdown via `gpt_markdown`, composer, sheets); the message list is reversed so older pages grow above without moving the viewport |
|
|
| `lib/widgets/` | The context usage ring |
|
|
|
|
Markdown rendering reuses **`gpt_markdown`** (BSD-3), the Flutter AI-output renderer
|
|
that [dsh-Go](https://github.com/ccch1mneyyy/dsh-go) uses: streaming-friendly,
|
|
syntax-highlighted code blocks with copy, tables, LaTeX and task lists. The input
|
|
bar and the model chip follow dsh-Go's composer design (MIT, referenced rather
|
|
than copied): a rounded capsule, a leading attach key, an auto-growing borderless
|
|
field, the usage ring, and a 36px send/stop key that morphs while a turn runs.
|
|
Read-aloud (TTS) is intentionally **not** implemented (matching the original).
|
|
|
|
## Run
|
|
|
|
Flutter 3.50 (stable) lives at `~/SDK/flutter`; artifacts use the China
|
|
mirrors.
|
|
|
|
```bash
|
|
export PATH=$HOME/SDK/flutter/bin:$PATH
|
|
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
|
|
export PUB_HOSTED_URL=https://pub.flutter-io.cn
|
|
export ANDROID_HOME=$HOME/SDK/AndroidSDK
|
|
export JAVA_HOME=$HOME/SDK/jdk-21
|
|
|
|
flutter pub get
|
|
flutter test
|
|
flutter build apk --release # dist artifacts in build/app/outputs/flutter-apk
|
|
flutter build linux --debug # faster UI checks on the desktop
|
|
```
|
|
|
|
The Linux build only needs a C toolchain and GTK 3 development headers; on
|
|
this machine `clang` was extracted into `~/SDK/localbin` (from the
|
|
`clang-17` package) and the two missing `-dev` files (`libsecret-1-dev`,
|
|
`libjsoncpp-dev`) into `~/SDK/linuxdev`, so:
|
|
|
|
```bash
|
|
export PATH=$HOME/SDK/localbin:$HOME/SDK/flutter/bin:$PATH
|
|
export PKG_CONFIG_PATH=$HOME/SDK/linuxdev/usr/lib/x86_64-linux-gnu/pkgconfig
|
|
export LIBRARY_PATH=$HOME/SDK/linuxdev/usr/lib/x86_64-linux-gnu
|
|
flutter build linux --debug
|
|
DISPLAY=:99 GDK_BACKEND=x11 ./build/linux/x64/debug/bundle/openchamber
|
|
```
|
|
|
|
`tool/history_probe.dart` pages a session exactly as the chat does and reports
|
|
whether every message is reached.
|
|
|
|
`android/app/build.gradle.kts` sets the application id
|
|
`net.blumia.openchamber.flutter`, `minSdk 24`, and signs releases with
|
|
`~/SDK/test-upload.jks` (override via `OPENCHAMBER_KEYSTORE*` env). Dart's
|
|
`HttpClient` dials sockets itself, so plain `http://` LAN servers work in
|
|
release without a cleartext manifest flag, as with the Go clients. Only a
|
|
working connection is saved: a failed attempt stays in the form.
|
|
|
|
Proxies accept `http://`, `https://`, `socks5://` and `socks5h://` (the
|
|
last two resolve names at the proxy). `tool/proxy_probe.dart` checks the
|
|
client against a live server through local test proxies.
|
|
|
|
Earlier attempts: `main` (Asuka/Go, 0.2.x) and `mygo` (MyGo, 0.3.0).
|