mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-21 10:50:14 +01:00
* ✨ feat: Enhance Spinner component with customizable properties and improved animation * 🔧 fix: Replace Loader with Spinner in RunCode component and update FilePreview to use Spinner for progress indication * ✨ feat: Refactor icons in CodeProgress and CancelledIcon components; enhance animation and styling in ExecuteCode and ProgressText components * ✨ feat: Refactor attachment handling in ExecuteCode component; replace individual attachment rendering with AttachmentGroup for improved structure * ✨ feat: Refactor dialog components for improved accessibility and styling; integrate Skeleton loading state in Image component * ✨ feat: Refactor ToolCall component to use ToolCallInfo for better structure; replace ToolPopover with AttachmentGroup; enhance ProgressText with error handling and improved UI elements * 🔧 fix: Remove unnecessary whitespace in ProgressText * 🔧 fix: Remove unnecessary margin from AgentFooter and AgentPanel components; clean up SidePanel imports * ✨ feat: Enhance ToolCall and ToolCallInfo components with improved styling; update translations and add warning text color to Tailwind config * 🔧 fix: Update import statement for useLocalize in ToolCallInfo component; fix: chatform transition * ✨ feat: Refactor ToolCall and ToolCallInfo components for improved structure and styling; add optimized code block for better output display * ✨ feat: Implement OpenAI image generation component; add progress tracking and localization for user feedback * 🔧 fix: Adjust base duration values for image generation; optimize timing for quality settings * chore: remove unnecessary space * ✨ feat: Enhance OpenAI image generation with editing capabilities; update localization for progress feedback * ✨ feat: Add download functionality to images; enhance DialogImage component with download button * ✨ feat: Enhance image resizing functionality; support custom percentage and pixel dimensions in resizeImageBuffer
61 lines
1.8 KiB
TypeScript
61 lines
1.8 KiB
TypeScript
import { useState } from 'react';
|
|
import { useRecoilValue } from 'recoil';
|
|
import { useProgress, useLocalize } from '~/hooks';
|
|
import ProgressText from './ProgressText';
|
|
import MarkdownLite from './MarkdownLite';
|
|
import store from '~/store';
|
|
|
|
export default function CodeAnalyze({
|
|
initialProgress = 0.1,
|
|
code,
|
|
outputs = [],
|
|
}: {
|
|
initialProgress: number;
|
|
code: string;
|
|
outputs: Record<string, unknown>[];
|
|
}) {
|
|
const localize = useLocalize();
|
|
const progress = useProgress(initialProgress);
|
|
const showAnalysisCode = useRecoilValue(store.showCode);
|
|
const [showCode, setShowCode] = useState(showAnalysisCode);
|
|
|
|
const logs = outputs.reduce((acc, output) => {
|
|
if (output['logs']) {
|
|
return acc + output['logs'] + '\n';
|
|
}
|
|
return acc;
|
|
}, '');
|
|
|
|
return (
|
|
<>
|
|
<div className="my-2.5 flex items-center gap-2.5">
|
|
<ProgressText
|
|
progress={progress}
|
|
onClick={() => setShowCode((prev) => !prev)}
|
|
inProgressText={localize('com_ui_analyzing')}
|
|
finishedText={localize('com_ui_analyzing_finished')}
|
|
hasInput={!!code.length}
|
|
isExpanded={showCode}
|
|
/>
|
|
</div>
|
|
{showCode && (
|
|
<div className="code-analyze-block mb-3 mt-0.5 overflow-hidden rounded-xl bg-black">
|
|
<MarkdownLite content={code ? `\`\`\`python\n${code}\n\`\`\`` : ''} />
|
|
{logs && (
|
|
<div className="bg-gray-700 p-4 text-xs">
|
|
<div className="mb-1 text-gray-400">{localize('com_ui_result')}</div>
|
|
<div
|
|
className="prose flex flex-col-reverse text-white"
|
|
style={{
|
|
color: 'white',
|
|
}}
|
|
>
|
|
<pre className="shrink-0">{logs}</pre>
|
|
</div>
|
|
</div>
|
|
)}
|
|
</div>
|
|
)}
|
|
</>
|
|
);
|
|
}
|