Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

🔎 fix: Render Image and Video Web Search Citations (#17438)

Marco Beretta7e036380f2d3
diff --git a/client/src/components/Web/Context.tsx b/client/src/components/Web/Context.tsx
index 9508936cf9..c5b421ec33 100644
--- a/client/src/components/Web/Context.tsx
+++ b/client/src/components/Web/Context.tsx
@@ -24,6 +24,8 @@ const refTypeMap: Record<string | SearchRefType, string> = {
ref: 'references',
news: 'topStories',
file: 'references',
+ image: 'images',
+ video: 'videos',
};
export function useCitation({
diff --git a/client/src/components/Web/__tests__/Citation.test.tsx b/client/src/components/Web/__tests__/Citation.test.tsx
index ba5e383440..8b97775bf1 100644
--- a/client/src/components/Web/__tests__/Citation.test.tsx
+++ b/client/src/components/Web/__tests__/Citation.test.tsx
@@ -134,6 +134,47 @@ describe('Citation', () => {
expect(screen.getByTestId('file-preview-dialog')).toHaveAttribute('data-file-source', 'text');
});
+ it.each([
+ { refType: 'image', collection: 'images', composite: false },
+ { refType: 'video', collection: 'videos', composite: false },
+ { refType: 'image', collection: 'images', composite: true },
+ { refType: 'video', collection: 'videos', composite: true },
+ ] as const)(
+ 'links $refType citations to the source page (composite: $composite)',
+ ({ refType, collection, composite }) => {
+ const title = `${refType} source`;
+ const link = `https://example.com/${refType}`;
+ const searchResults: Record<string, SearchResultData> = {
+ '0': {
+ [collection]: [
+ {
+ title,
+ link,
+ imageUrl: 'https://example.com/media.jpg',
+ },
+ ],
+ },
+ };
+ const citation = { turn: 0, refType, index: 0 };
+ const citationId = `cite-${refType}`;
+
+ renderWithProviders(
+ composite ? (
+ <CompositeCitation node={{ properties: { citationId, citations: [citation] } }} />
+ ) : (
+ <Citation
+ citationId={citationId}
+ citationType="standalone"
+ node={{ properties: { citationId, citation } }}
+ />
+ ),
+ searchResults,
+ );
+
+ expect(screen.getByRole('link', { name: title })).toHaveAttribute('href', link);
+ },
+ );
+
it('keeps standalone web citations as links', () => {
const searchResults = {
'0': {