Use app-server thread name method
This commit is contained in:
@@ -16,7 +16,7 @@ Keep thread titles short and useful for later resume lists.
|
|||||||
|
|
||||||
## How to Rename
|
## How to Rename
|
||||||
|
|
||||||
- If the client exposes a thread rename or `thread/setName` capability, use it with the concise title.
|
- If the client exposes a thread rename or `thread/name/set` capability, use it with the concise title.
|
||||||
- If only Telegram commands are available, tell the user the exact `/rename TITLE` command to run.
|
- If only Telegram commands are available, tell the user the exact `/rename TITLE` command to run.
|
||||||
- If no rename mechanism is available, include a short suggested title in the final answer.
|
- If no rename mechanism is available, include a short suggested title in the final answer.
|
||||||
|
|
||||||
|
|||||||
@@ -229,7 +229,7 @@ func (c *Client) SetThreadName(ctx context.Context, threadID, name string) error
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
var ignored json.RawMessage
|
var ignored json.RawMessage
|
||||||
return c.call(ctx, "thread/setName", map[string]any{
|
return c.call(ctx, "thread/name/set", map[string]any{
|
||||||
"threadId": threadID,
|
"threadId": threadID,
|
||||||
"name": name,
|
"name": name,
|
||||||
}, &ignored)
|
}, &ignored)
|
||||||
|
|||||||
@@ -91,14 +91,14 @@ func TestClientWebSocketUnixJSONRPC(t *testing.T) {
|
|||||||
serverDone <- err
|
serverDone <- err
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if setName["method"] != "thread/setName" {
|
if setName["method"] != "thread/name/set" {
|
||||||
serverDone <- unexpectedMessage("thread/setName", setName["method"])
|
serverDone <- unexpectedMessage("thread/name/set", setName["method"])
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
params := setName["params"].(map[string]any)
|
params := setName["params"].(map[string]any)
|
||||||
if params["threadId"] != "thr_1" || params["name"] != "Short title" {
|
if params["threadId"] != "thr_1" || params["name"] != "Short title" {
|
||||||
payload, _ := json.Marshal(params)
|
payload, _ := json.Marshal(params)
|
||||||
serverDone <- unexpectedMessage("thread/setName params", string(payload))
|
serverDone <- unexpectedMessage("thread/name/set params", string(payload))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if err := conn.WriteJSON(map[string]any{"id": setName["id"], "result": map[string]any{}}); err != nil {
|
if err := conn.WriteJSON(map[string]any{"id": setName["id"], "result": map[string]any{}}); err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user