diff --git a/ui/src/chat/ChatComposer.vue b/ui/src/chat/ChatComposer.vue
index 4bc20724c..d3f043888 100644
--- a/ui/src/chat/ChatComposer.vue
+++ b/ui/src/chat/ChatComposer.vue
@@ -15,6 +15,8 @@ import {
commandSelection,
commandSpecs,
addTaskTag,
+ clearPageTag,
+ pageTag,
composerText,
editQueued,
menuTrigger,
@@ -219,7 +221,16 @@ function onKeydown(event: KeyboardEvent): void {
-
+
+ -
+ {{ pageTag.label }}
+
+
- {
+ clearedPage.value = "";
+});
+
+/** What the next message is about, named for the tag above the composer. */
+export const pageTag = computed(() => {
+ const page = currentPage();
+ if (page === clearedPage.value) return null;
+ const route = router.currentRoute.value;
+ const label =
+ route.name === "task-detail"
+ ? `Task #${route.params.id}`
+ : typeof route.meta.label === "string"
+ ? route.meta.label
+ : page;
+ return { page, label };
+});
+
+export function clearPageTag(): void {
+ clearedPage.value = currentPage();
+}
+
+/** The page sent with a message: the tag's page, or none once it is cleared. */
+function sentPage(): string | undefined {
+ return pageTag.value?.page;
}
export async function sendMessage(retryOpts?: RetryOptions): Promise {
@@ -731,7 +762,7 @@ export async function sendMessage(retryOpts?: RetryOptions): Promise {
channel_id: channelID(),
source_id: turn.sourceID,
text: turn.text,
- page: currentPage(),
+ page: sentPage(),
voice: turn.voice,
},
{ signal: ctrl.signal },