vzcode 2.16.0 → 2.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,77 +0,0 @@
1
- import React, { useMemo } from 'react';
2
- import { timestampToDate } from '@vizhub/viz-utils';
3
- import Markdown from 'react-markdown';
4
- import remarkGfm from 'remark-gfm';
5
- import { StreamingEvent } from '../../../types.js';
6
- import { IndividualFileDiff } from './IndividualFileDiff';
7
-
8
- const DEBUG = false;
9
-
10
- interface StreamingMessageProps {
11
- timestamp: number;
12
- events: StreamingEvent[];
13
- isActive?: boolean; // Is this the currently streaming message?
14
- children?: React.ReactNode;
15
- }
16
-
17
- export const StreamingMessage: React.FC<
18
- StreamingMessageProps
19
- > = ({ timestamp, events, isActive, children }) => {
20
- DEBUG &&
21
- console.log(
22
- 'StreamingMessage: Rendered with events:',
23
- events,
24
- );
25
-
26
- // Memoize date formatting to avoid repeated computation
27
- const formattedTime = useMemo(() => {
28
- return timestampToDate(timestamp).toLocaleTimeString(
29
- [],
30
- {
31
- hour: '2-digit',
32
- minute: '2-digit',
33
- },
34
- );
35
- }, [timestamp]);
36
-
37
- return (
38
- <div className="ai-chat-message assistant streaming">
39
- <div className="ai-chat-message-content">
40
- {/* Render events in order */}
41
- {events.map((event, index) => {
42
- switch (event.type) {
43
- case 'text_chunk':
44
- return (
45
- <div
46
- key={`text-${index}`}
47
- className="text-chunk"
48
- >
49
- <Markdown remarkPlugins={[remarkGfm]}>
50
- {event.content}
51
- </Markdown>
52
- </div>
53
- );
54
- case 'file_complete':
55
- return (
56
- <IndividualFileDiff
57
- key={`file-${event.fileName}-${index}`}
58
- fileName={event.fileName}
59
- beforeContent={event.beforeContent || ''}
60
- afterContent={event.afterContent || ''}
61
- />
62
- );
63
- case 'file_start':
64
- // File start events are now handled by centralized status logic in MessageList
65
- return null;
66
- default:
67
- return null;
68
- }
69
- })}
70
- {isActive && children}
71
- </div>
72
- <div className="ai-chat-message-time">
73
- {formattedTime}
74
- </div>
75
- </div>
76
- );
77
- };