feat: add a project from the picker, and keep the context ring

- the project picker has an "Add project" action: a folder browser starts
  at the server user's home, navigates (typed path, up, new folder) and
  adds the chosen folder through POST /api/openchamber/directory; the new
  project becomes the draft's target at once
- refreshProjects merges settings-only projects (newest added first), so a
  project added before its first session still appears in the picker; the
  first session moves it into /api/project as usual
- usageReading no longer hides the composer's context ring when the
  session's model has left the server catalog: a 200K window is assumed,
  the percentage is prefixed with "~", and the usage sheet says the window
  is estimated. A failed model fetch at connect is retried when a chat
  opens, so a normal session shows the real percentage
- tests: the add-project browser flow, settings-only projects, and the
  estimated/known context readings
This commit is contained in:
blumia committed 2026-11-27 09:26:14 +08:00
1 parent bd8afeb686
commit c6b5a870c6
11 files changed
+708 -22

No files matched your search

+12 -3
View File
@@ -2078,7 +2078,10 @@ class _ChatScreenState extends State<ChatScreen> {
size: 16,
accent: scheme.primary),
const SizedBox(width: 3),
AppText('${usage.$4.round()}%',
AppText(
usage.$6
? '~${usage.$4.round()}%'
: '${usage.$4.round()}%',
style: TextStyle(
fontSize: 12,
color: scheme.onSurfaceVariant)),
@@ -2395,8 +2398,14 @@ class _ChatScreenState extends State<ChatScreen> {
],
if (chat.turnCost > 0) _usageRow('Turn cost', '\$${chat.turnCost.toStringAsFixed(4)}'),
const SizedBox(height: 8),
const AppText('Reserved output assumes at most 32K tokens, matching the official client.',
style: TextStyle(color: Colors.grey, fontSize: 12)),
if (r.$6)
const AppText(
'The model is not in the catalog; the context window is estimated.',
style: TextStyle(color: Colors.grey, fontSize: 12))
else
const AppText(
'Reserved output assumes at most 32K tokens, matching the official client.',
style: TextStyle(color: Colors.grey, fontSize: 12)),
],
),
),