Skip to content

Commit 3a770b3

Browse files
committed
mod token warning for chatbot
-mod token warning for chatbot
1 parent 1caa658 commit 3a770b3

File tree

1 file changed

+22
-21
lines changed

1 file changed

+22
-21
lines changed

projects/frontend/src/components/Chatbot/ChatbotPage.jsx

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ const ChatbotPage = () => {
361361

362362
{/* Settings Panel */}
363363
{showSettings && (
364-
<div className="mb-4 p-4 bg-gray-50 dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 max-h-96 overflow-y-auto flex-shrink-0">
364+
<div className="mb-4 p-4 bg-gray-50 dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 max-h-[600px] overflow-y-auto flex-shrink-0">
365365
<h3 className="text-sm font-semibold text-gray-700 dark:text-gray-300 mb-3">Settings</h3>
366366

367367
<div className="space-y-4">
@@ -439,26 +439,6 @@ const ChatbotPage = () => {
439439

440440
{/* Scrollable Content Area */}
441441
<div className="flex-1 overflow-y-auto space-y-4 min-h-0">
442-
{/* Token Warning */}
443-
{showTokenWarning && (
444-
<div className="p-3 bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg flex items-start space-x-2">
445-
<AlertCircle className="w-5 h-5 text-yellow-600 dark:text-yellow-400 flex-shrink-0 mt-0.5" />
446-
<div className="flex-1">
447-
<p className="text-sm text-yellow-600 dark:text-yellow-400">
448-
<strong>High token usage detected:</strong> Your conversation history is getting long (~{estimatedTokens.toLocaleString()} tokens)
449-
and consuming significant LLM resources. Consider clicking "Clear History" to reset and reduce costs.
450-
</p>
451-
</div>
452-
<button
453-
onClick={() => setShowTokenWarning(false)}
454-
className="text-yellow-600 dark:text-yellow-400 hover:text-yellow-800 dark:hover:text-yellow-200"
455-
title="Dismiss warning"
456-
>
457-
<X className="w-5 h-5" />
458-
</button>
459-
</div>
460-
)}
461-
462442
{/* Error Display */}
463443
{error && (
464444
<div className="p-3 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg flex items-start space-x-2">
@@ -483,6 +463,27 @@ const ChatbotPage = () => {
483463
isStreaming={isStreaming && idx === messages.length - 1}
484464
/>
485465
))}
466+
467+
{/* Token Warning - shown inline with messages */}
468+
{showTokenWarning && messages.length > 0 && (
469+
<div className="p-3 bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg flex items-start space-x-2">
470+
<AlertCircle className="w-5 h-5 text-yellow-600 dark:text-yellow-400 flex-shrink-0 mt-0.5" />
471+
<div className="flex-1">
472+
<p className="text-sm text-yellow-600 dark:text-yellow-400">
473+
<strong>High token usage detected:</strong> Your conversation history is getting long (~{estimatedTokens.toLocaleString()} tokens)
474+
and consuming significant LLM resources. Consider clicking "Clear History" to reset and reduce costs.
475+
</p>
476+
</div>
477+
<button
478+
onClick={() => setShowTokenWarning(false)}
479+
className="text-yellow-600 dark:text-yellow-400 hover:text-yellow-800 dark:hover:text-yellow-200"
480+
title="Dismiss warning"
481+
>
482+
<X className="w-5 h-5" />
483+
</button>
484+
</div>
485+
)}
486+
486487
<div ref={messagesEndRef} />
487488
</div>
488489
</div>

0 commit comments

Comments
 (0)