{};
for (const [, key, value] of parts) {
+ // `values` is never serialized by convertContextToInlinePrompt, so a string here is invalid.
+ if (key === "values") continue;
ctx[key] = value;
}
- if (!ctx.type) return null;
+ if (!INLINE_CONTEXT_TYPES.has(ctx.type)) return null;
return normalizeInlineContext(ctx);
}
diff --git a/web-common/src/features/chat/layouts/fullpage/ConversationSidebar.svelte b/web-common/src/features/chat/layouts/fullpage/ConversationSidebar.svelte
index 2d0d5a58914..3898352273b 100644
--- a/web-common/src/features/chat/layouts/fullpage/ConversationSidebar.svelte
+++ b/web-common/src/features/chat/layouts/fullpage/ConversationSidebar.svelte
@@ -6,8 +6,12 @@
import Spinner from "../../../entity-management/Spinner.svelte";
import { EntityStatus } from "../../../entity-management/types";
import type { ConversationManager } from "../../core/conversation-manager";
+ import type { V1Conversation } from "../../../../runtime-client";
import { m } from "@rilldata/web-common/lib/i18n/gen/messages";
import MemoryButton from "../../memory/MemoryButton.svelte";
+ import { formatConversationTitle } from "@rilldata/web-common/features/chat/core/context/conversation-title.ts";
+ import { getInlineChatContextMetadata } from "@rilldata/web-common/features/chat/core/context/metadata.ts";
+ import { useRuntimeClient } from "@rilldata/web-common/runtime-client/v2";
export let conversationManager: ConversationManager;
export let basePath: string;
@@ -22,6 +26,12 @@
$: listConversationsQuery = conversationManager.listConversationsQuery();
+ const contextMetadata = getInlineChatContextMetadata(useRuntimeClient());
+ // Reactive so that titles are re-rendered once the metadata used for reference labels loads.
+ $: getTitle = (conversation: V1Conversation) =>
+ formatConversationTitle(conversation.title ?? "", $contextMetadata) ||
+ m.chat_new_conversation();
+
$: conversations = ($listConversationsQuery.data?.conversations ?? []).filter(
(c) => c.userAgent !== "rill/report",
);
@@ -108,11 +118,11 @@
class:active={conversation.id === currentConversationDto?.id}
data-testid="conversation-item"
data-conversation-id={conversation.id}
- title={conversation.title || m.chat_new_conversation()}
+ title={getTitle(conversation)}
onclick={handleConversationItemClick}
>
- {conversation.title || m.chat_new_conversation()}
+ {getTitle(conversation)}
{/each}
diff --git a/web-common/src/features/chat/layouts/sidebar/ConversationHistoryItem.svelte b/web-common/src/features/chat/layouts/sidebar/ConversationHistoryItem.svelte
index ae897c84421..41cacf4d995 100644
--- a/web-common/src/features/chat/layouts/sidebar/ConversationHistoryItem.svelte
+++ b/web-common/src/features/chat/layouts/sidebar/ConversationHistoryItem.svelte
@@ -2,8 +2,11 @@
import * as DropdownMenu from "../../../../components/dropdown-menu";
import { getRelativeTime } from "../../../../lib/time/relative-time";
import type { V1Conversation } from "../../../../runtime-client";
+ import { formatConversationTitle } from "../../core/context/conversation-title";
+ import type { InlineContextMetadata } from "../../core/context/metadata";
export let conversation: V1Conversation;
+ export let contextMetadata: InlineContextMetadata;
export let isCurrentChat: boolean = false;
export let showRelativeTime: boolean = false;
export let onSelect: (conversation: V1Conversation) => void;
@@ -23,7 +26,8 @@
>
- {conversation.title || "New Conversation"}
+ {formatConversationTitle(conversation.title ?? "", contextMetadata) ||
+ "New Conversation"}
diff --git a/web-common/src/features/chat/layouts/sidebar/ConversationHistoryMenu.svelte b/web-common/src/features/chat/layouts/sidebar/ConversationHistoryMenu.svelte
index eba0b0fd53c..1225652b6e2 100644
--- a/web-common/src/features/chat/layouts/sidebar/ConversationHistoryMenu.svelte
+++ b/web-common/src/features/chat/layouts/sidebar/ConversationHistoryMenu.svelte
@@ -4,6 +4,7 @@
import IconButton from "../../../../components/button/IconButton.svelte";
import * as DropdownMenu from "../../../../components/dropdown-menu";
import type { V1Conversation } from "../../../../runtime-client";
+ import type { InlineContextMetadata } from "../../core/context/metadata";
import ConversationHistoryItem from "./ConversationHistoryItem.svelte";
import {
GROUP_ORDER,
@@ -13,6 +14,7 @@
export let conversations: V1Conversation[] = [];
export let currentConversationId: string | undefined = undefined;
+ export let contextMetadata: InlineContextMetadata;
export let onSelect: (conversation: V1Conversation) => void;
let currentConversationIdSnapshot: string | undefined = currentConversationId;
@@ -62,6 +64,7 @@
{#each groupedConversations[groupKey] as conv}
void;
const { adminServer } = featureFlags;
+ const contextMetadata = getInlineChatContextMetadata(useRuntimeClient());
$: organization = $page.params.organization;
$: project = $page.params.project;
@@ -41,7 +45,12 @@