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:
1 parent
bd8afeb686
commit
c6b5a870c6
11 files changed
+708
-22
No files matched your search
@@ -187,6 +187,22 @@ class Client {
|
||||
];
|
||||
}
|
||||
|
||||
/// Adds [path] to OpenChamber's project list (its settings document). A
|
||||
/// project can be added before any session exists in it, so this is the
|
||||
/// way a new checkout appears in the project picker; [create] also makes
|
||||
/// the folder. Returns the server's canonical path, which may resolve a
|
||||
/// symlink or a trailing slash.
|
||||
Future<String> addProjectDirectory(String path, {bool create = false}) async {
|
||||
final r = await _json('POST', '/api/openchamber/directory', body: {
|
||||
'path': path,
|
||||
'create': create,
|
||||
});
|
||||
final resolved = r['path'];
|
||||
return resolved is String && resolved.trim().isNotEmpty
|
||||
? resolved.trim()
|
||||
: path;
|
||||
}
|
||||
|
||||
/// The server's home and chats root. Sessions filed under a chats root are
|
||||
/// the "聊天" group, not a project; the root can be relocated away from the
|
||||
/// home config directory, so it must come from the server.
|
||||
|
||||
Reference in new issue
Block a user