fix: minor UI enhancements.
This commit is contained in:
@@ -34,18 +34,18 @@ const AssistantMessage: React.FC<AssistantMessageProps> = ({ content, isStreamin
|
||||
const renderContent = () => {
|
||||
// Handle special abort link for streaming messages
|
||||
if (isStreaming && onAbort && content.includes('click here to abort')) {
|
||||
const hasProcessingWave = content.includes('<span class="processing-wave">Processing...</span>');
|
||||
const hasProcessingWave = content.includes('<span class="processing-wave">Thinking...</span>');
|
||||
|
||||
if (hasProcessingWave) {
|
||||
const parts = content.split('click here to abort');
|
||||
const beforeAbort = parts[0].replace(
|
||||
'<span class="processing-wave">Processing...</span>',
|
||||
'<span class="processing-wave">Thinking...</span>',
|
||||
''
|
||||
);
|
||||
|
||||
return (
|
||||
<span>
|
||||
<span className="processing-wave">Processing...</span>
|
||||
<span className="processing-wave">Thinking...</span>
|
||||
{beforeAbort}
|
||||
<button onClick={onAbort} className="abort-link">
|
||||
click here to abort
|
||||
|
||||
@@ -29,8 +29,9 @@ export const useStreamProcessor = (options: StreamProcessorOptions): StreamProce
|
||||
setAbortController(controller);
|
||||
|
||||
// Track the current streaming message ID (mutable)
|
||||
let currentStreamingId = createStreamingMessage().id;
|
||||
onMessageAdd({ id: currentStreamingId, role: 'assistant', content: '', isStreaming: true, tokenCount: 0 } as ChatMessage);
|
||||
const initialStreamingMsg = createStreamingMessage();
|
||||
let currentStreamingId = initialStreamingMsg.id;
|
||||
onMessageAdd(initialStreamingMsg);
|
||||
|
||||
try {
|
||||
const agentCore = AgentCore.instance();
|
||||
@@ -54,7 +55,7 @@ export const useStreamProcessor = (options: StreamProcessorOptions): StreamProce
|
||||
|
||||
onMessageUpdate(currentStreamingId, (msg) => ({
|
||||
...msg,
|
||||
content: `<span class="processing-wave">Processing...</span> ${tokenCount} tokens received. click here to abort.`,
|
||||
content: `<span class="processing-wave">Thinking...</span>${tokenCount > 0 ? ` ${tokenCount} tokens received.` : ''} click here to abort.`,
|
||||
tokenCount
|
||||
}));
|
||||
} else if (chunk.type === 'tool_call' && chunk.toolCall) {
|
||||
|
||||
@@ -13,7 +13,7 @@ export const createMessage = (role: 'user' | 'assistant', content: string): Chat
|
||||
};
|
||||
};
|
||||
|
||||
export const createStreamingMessage = (content: string = '<span class="processing-wave">Processing...</span> 0 tokens received. click here to abort.'): ChatMessage => {
|
||||
export const createStreamingMessage = (content: string = '<span class="processing-wave">Thinking...</span> click here to abort.'): ChatMessage => {
|
||||
return {
|
||||
id: generateMessageId(),
|
||||
role: 'assistant',
|
||||
|
||||
Reference in New Issue
Block a user