Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
Add highlight to code in pretty logs
Vasek Mlejnsky9e3fc20bbfd2
diff --git a/components/Editor/RightSidebar/Logs/LogEntry.tsx b/components/Editor/RightSidebar/Logs/LogEntry.tsxindex e988fc88c..b6836394a 100644--- a/components/Editor/RightSidebar/Logs/LogEntry.tsx+++ b/components/Editor/RightSidebar/Logs/LogEntry.tsx@@ -1,7 +1,17 @@-import { Log } from 'db/types'-import { Code2, Package, TerminalSquare, Wrench } from 'lucide-react'+import {+ useEffect,+} from 'react'+import hljs from 'highlight.js'+import {+ Code2,+ Package,+ TerminalSquare,+ Wrench,+} from 'lucide-react'import { ReactMarkdown } from 'react-markdown/lib/react-markdown'+import { Log } from 'db/types'+function getToolIcon(toolName: string) {switch (toolName) {case 'InstallNPMDependencies':@@ -20,12 +30,16 @@ export interface Props {}function LogEntry({ log }: Props) {+ useEffect(function highlightCode() {+ if (log.type === 'tool' && log.name === 'RunJavaScriptCode') {+ hljs.highlightAll()+ }+ }, [log])return (<div className="rounded-lgp-3border- border-slate">{log.type === 'thought' &&<div className="diff --git a/components/Editor/RightSidebar/Logs/index.tsx b/components/Editor/RightSidebar/Logs/index.tsxindex 7920dc68c..c5f7713a0 100644--- a/components/Editor/RightSidebar/Logs/index.tsx+++ b/components/Editor/RightSidebar/Logs/index.tsx@@ -90,10 +90,10 @@ function Logs({p-4">{selectedTab === 0 && logs?.map((l, i, a) =>- <Fragment key={i}>+ <Fragment key={l.id}><LogEntrylog={l}- key={i}+ key={l.id}/>{i < a.length - 1 &&<div className="flex items-center flex-col">