feat: show a model, agent and duration footer after each turn
Match the first-party chat footer on touch screens: after a turn ends, its last assistant message gets a row with the model name (resolved from /api/model with the id as fallback), the agent and how long the turn took, plus a "more" menu. The menu shows the completion timestamp and offers copy answer and fork from here; forking copies history before the next prompt (or the whole history at the end) and opens the new session. Bump version to 0.1.7 (build 8).
This commit is contained in:
1 parent
56cf889ee9
commit
8268bdecc2
6 files changed
+308
-8
No files matched your search
@@ -172,6 +172,27 @@ func (c *Client) Models(ctx context.Context, directory string) ([]ModelInfo, err
|
||||
return payload.Data, nil
|
||||
}
|
||||
|
||||
// ProviderInfo is one provider the server offers, with its display name.
|
||||
type ProviderInfo struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
// Providers lists the providers available for a directory.
|
||||
func (c *Client) Providers(ctx context.Context, directory string) ([]ProviderInfo, error) {
|
||||
q := url.Values{}
|
||||
if directory != "" {
|
||||
q.Set("location[directory]", directory)
|
||||
}
|
||||
var payload struct {
|
||||
Data []ProviderInfo `json:"data"`
|
||||
}
|
||||
if err := c.do(ctx, http.MethodGet, "/api/provider", requestOptions{query: q}, nil, &payload); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return payload.Data, nil
|
||||
}
|
||||
|
||||
// ServerLocation is the server's default working directory.
|
||||
type ServerLocation struct {
|
||||
Directory string `json:"directory"`
|
||||
|
||||
@@ -26,6 +26,21 @@ func (c *Client) Prompt(ctx context.Context, sessionID string, o PromptOptions)
|
||||
return c.do(ctx, http.MethodPost, path, requestOptions{directory: o.Directory}, body, nil)
|
||||
}
|
||||
|
||||
// ForkSession copies the session's history before a message into a new
|
||||
// session. An empty before copies the whole history.
|
||||
func (c *Client) ForkSession(ctx context.Context, sessionID, directory, before string) (Session, error) {
|
||||
body := map[string]any{}
|
||||
if before != "" {
|
||||
body["before"] = before
|
||||
}
|
||||
var payload struct {
|
||||
Data Session `json:"data"`
|
||||
}
|
||||
path := "/api/session/" + url.PathEscape(sessionID) + "/fork"
|
||||
err := c.do(ctx, http.MethodPost, path, requestOptions{directory: directory}, body, &payload)
|
||||
return payload.Data, err
|
||||
}
|
||||
|
||||
// Interrupt stops the turn the session is running.
|
||||
func (c *Client) Interrupt(ctx context.Context, sessionID, directory string) (bool, error) {
|
||||
var payload struct {
|
||||
|
||||
Reference in new issue
Block a user