Skip to content

Commit 4c82dc2

Browse files
committed
add detail view
1 parent 270c1be commit 4c82dc2

File tree

1 file changed

+4
-18
lines changed

1 file changed

+4
-18
lines changed

dashboard/ai-analytics/src/app/components/DataTable.tsx

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ function DetailView({ message, onClose }: { message: LLMMessage, onClose: () =>
9393
if (typeof msg.response_choices === 'string') {
9494
try {
9595
return JSON.parse(msg.response_choices);
96-
} catch (e) {
96+
} catch {
9797
try {
9898
// Handle case where response_choices is an array of JSON strings
9999
return (msg.response_choices as unknown as string[]).map(choice => JSON.parse(choice));
@@ -176,7 +176,7 @@ function DetailView({ message, onClose }: { message: LLMMessage, onClose: () =>
176176
if (messages && messages.length > 0) {
177177
return (
178178
<div key={idx} className="space-y-2">
179-
{messages.map((chatMsg: any, msgIdx: number) => (
179+
{messages.map((chatMsg: { role: string; content: string }, msgIdx: number) => (
180180
<div key={`${idx}-${msgIdx}`} className={`rounded-lg p-3 text-white ${
181181
chatMsg.role === 'user' ? 'bg-gray-700' :
182182
chatMsg.role === 'assistant' ? 'bg-blue-900' :
@@ -194,7 +194,7 @@ function DetailView({ message, onClose }: { message: LLMMessage, onClose: () =>
194194
<div className="mt-4">
195195
<div className="text-sm text-gray-400 mb-2">Alternative Responses:</div>
196196
<div className="space-y-2">
197-
{parseResponseChoices(msg).slice(1).map((choice: any, choiceIdx: number) => (
197+
{parseResponseChoices(msg).slice(1).map((choice: { message?: { content: string }; content?: string }, choiceIdx: number) => (
198198
<div key={`choice-${choiceIdx}`} className="bg-gray-700 rounded-lg p-3 text-white opacity-75">
199199
<div className="text-xs text-gray-400 mb-1">Alternative {choiceIdx + 1}</div>
200200
<div className="whitespace-pre-wrap">
@@ -211,23 +211,9 @@ function DetailView({ message, onClose }: { message: LLMMessage, onClose: () =>
211211
);
212212
}
213213

214-
// Fallback to prompt/response if no structured messages
214+
// Fallback
215215
return (
216216
<div key={idx} className="space-y-2">
217-
{msg.prompt && (
218-
<div className="bg-gray-700 rounded-lg p-3 text-white">
219-
<div className="text-xs text-gray-400 mb-1">User</div>
220-
<div className="whitespace-pre-wrap">{msg.prompt}</div>
221-
</div>
222-
)}
223-
224-
{msg.response && (
225-
<div className="bg-blue-900 rounded-lg p-3 text-white">
226-
<div className="text-xs text-gray-400 mb-1">Assistant</div>
227-
<div className="whitespace-pre-wrap">{msg.response}</div>
228-
</div>
229-
)}
230-
231217
{msg.response_status !== 'success' && msg.exception && (
232218
<div className="bg-red-900 rounded-lg p-3 text-white">
233219
<div className="text-xs text-gray-400 mb-1">Error</div>

0 commit comments

Comments
 (0)