Skip to content

Commit 404fa0f

Browse files
committed
fix: typings
1 parent f505241 commit 404fa0f

File tree

2 files changed

+3
-11
lines changed

2 files changed

+3
-11
lines changed

packages/agent-webapp/src/components/chat.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { map } from 'lit/directives/map.js';
33
import { repeat } from 'lit/directives/repeat.js';
44
import { unsafeSVG } from 'lit/directives/unsafe-svg.js';
55
import { customElement, property, state, query } from 'lit/decorators.js';
6-
import { AIChatCompletionDelta, AIChatMessage } from '@microsoft/ai-chat-protocol';
6+
import { type AIChatCompletionDelta, type AIChatMessage } from '@microsoft/ai-chat-protocol';
77
import { DebugComponent } from './debug.js';
88
import { type ChatRequestOptions, getCompletion } from '../api.service.js';
99
import { type ParsedMessage, parseMessageIntoHtml } from '../message-parser.js';
@@ -95,11 +95,6 @@ export class ChatComponent extends LitElement {
9595
await this.onSendClicked();
9696
}
9797

98-
onCitationClicked(citation: string) {
99-
const path = getCitationUrl(citation);
100-
window.open(path, '_blank');
101-
}
102-
10398
onNewChatClicked() {
10499
this.messages = [];
105100
this.sessionId = '';

packages/agent-webapp/src/message-parser.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@ import { type HTMLTemplateResult, html } from 'lit';
22
import { unsafeHTML } from 'lit/directives/unsafe-html.js';
33
import { marked } from 'marked';
44
import DOMPurify from 'dompurify';
5-
import { AIChatMessage } from '@microsoft/ai-chat-protocol';
5+
import { type AIChatMessage } from '@microsoft/ai-chat-protocol';
66

77
export type ParsedMessage = {
88
html: HTMLTemplateResult;
9-
citations: string[];
109
followupQuestions: string[];
1110
role: string;
1211
context?: object;
@@ -16,14 +15,12 @@ export function parseMessageIntoHtml(message: AIChatMessage, enableMarkdown = tr
1615
if (message.role === 'user') {
1716
return {
1817
html: html`${message.content}`,
19-
citations: [],
2018
followupQuestions: [],
2119
role: message.role,
2220
context: message.context,
2321
};
2422
}
2523

26-
const citations: string[] = [];
2724
const followupQuestions: string[] = [];
2825

2926
// Extract any follow-up questions that might be in the message
@@ -37,6 +34,7 @@ export function parseMessageIntoHtml(message: AIChatMessage, enableMarkdown = tr
3734

3835
let result;
3936
if (enableMarkdown) {
37+
// Render markdown after sanitizing
4038
const md = marked.parse(text, { async: false }) as string;
4139
const safe = DOMPurify.sanitize(md, { USE_PROFILES: { html: true } });
4240
result = html`${unsafeHTML(safe)}`;
@@ -46,7 +44,6 @@ export function parseMessageIntoHtml(message: AIChatMessage, enableMarkdown = tr
4644

4745
return {
4846
html: result,
49-
citations,
5047
followupQuestions,
5148
role: message.role,
5249
context: message.context,

0 commit comments

Comments
 (0)