Assistant: a new chat's name is fetched after the answer, for a bounded while
The sheet follows the reply's stream to done only, so it never saw the title frame. When done says the name is pending, the chat's name is asked for every 4 s for at most 20 s in the background (never delaying speech, never holding the stream open) and kept as the name the sheet offers the chat under next time. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
2 files changed
+34
-1
No files matched your search
@@ -32,6 +32,8 @@ data class LiveReply(
|
||||
*/
|
||||
val finished: Message? = null,
|
||||
val title: String? = null,
|
||||
/** From `done`: a model is still naming the chat, so [title] is the one made from the prompt. */
|
||||
val titlePending: Boolean = false,
|
||||
/** A queued prompt the server started when this reply ended: the next stream to follow. */
|
||||
val next: String? = null,
|
||||
val closed: Boolean = false,
|
||||
@@ -76,6 +78,7 @@ data class LiveReply(
|
||||
copy(
|
||||
finished = if (ended && row.progress == null && end != null) row.copy(progress = end) else row,
|
||||
title = done.chat.title.ifEmpty { null },
|
||||
titlePending = done.chat.titlePending,
|
||||
next = done.next,
|
||||
cards = emptyList(),
|
||||
status = "",
|
||||
@@ -84,7 +87,7 @@ data class LiveReply(
|
||||
} ?: this
|
||||
|
||||
// After `done`, when a model has named the chat: the name, and nothing else changes.
|
||||
"title" -> decode(TitleFrame.serializer(), data)?.let { named -> copy(title = named.chat.title.ifEmpty { title }) } ?: this
|
||||
"title" -> decode(TitleFrame.serializer(), data)?.let { named -> copy(title = named.chat.title.ifEmpty { title }, titlePending = false) } ?: this
|
||||
|
||||
"close" -> copy(closed = true)
|
||||
|
||||
|
||||
Reference in new issue
Block a user