Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
Fix deploy import; Improve logs [WIP]
Tomas Valenta459f163d46f1
diff --git a/api-service/playground/src/deployments/packaging.ts b/api-service/playground/src/deployments/packaging.tsindex ceab439c9..a2504eb07 100644--- a/api-service/playground/src/deployments/packaging.ts+++ b/api-service/playground/src/deployments/packaging.ts@@ -40,7 +40,7 @@ function addAWSLambdaHandlers(code: string) {const isECMA = !code.includes('require')if (isECMA) {- code = 'import serverless from "serverless-http;"\n' + code+ code = 'import serverless from "serverless-http";\n' + codecode = code + "\nexport const handler = serverless(app);"} else {code = "const serverless = require('serverless-http');\n" + codediff --git a/components/Editor/ConnectionLine.tsx b/components/Editor/ConnectionLine.tsxindex 302e80a74..7f3545c92 100644--- a/components/Editor/ConnectionLine.tsx+++ b/components/Editor/ConnectionLine.tsx@@ -4,7 +4,7 @@ export interface Props {function ConnectionLine({ className }: Props) {return (- <div className={`${className} border-l my-2 rounded border-slate-200`} />+ <div className={`${className} border-l my-2 border-slate-200`} />)}diff --git a/components/Editor/RightSidebar/Logs/LogEntry.tsx b/components/Editor/RightSidebar/Logs/LogEntry.tsxnew file mode 100644index 000000000..e988fc88c--- /dev/null+++ b/components/Editor/RightSidebar/Logs/LogEntry.tsx@@ -0,0 +1,82 @@+import { Log } from 'db/types'+import { Code2, Package, TerminalSquare, Wrench } from 'lucide-react'+import { ReactMarkdown } from 'react-markdown/lib/react-markdown'++function getToolIcon(toolName: string) {+ switch (toolName) {+ case 'InstallNPMDependencies':+ return <Package size="16px" />+ case 'RunJavaScriptCode':+ return <Code2 size="16px" />+ case 'CurlJavaScriptServer':+ return <TerminalSquare size="16px" />+ default:+ return <Wrench size="16px" />+ }+}++export interface Props {+ log: Log+}++function LogEntry({ log }: Props) {+ return (+ <div className="+ rounded-lg+ p-3+ border+ border-slate+ ">+ {log.type === 'thought' &&+ <div className="+ italic+ text-slate-400+ ">+ <ReactMarkdown>+ {log.content}+ </ReactMarkdown>+ </div>+ }+ {log.type === 'tool' &&+ <>+ <div className="+ flex+ items-center+ space-x-2+ ">+ {getToolIcon(log.name)}+ <div className="font-medium">+ {log.name}+ </div>+ </div>+ {log.input.trim() &&+ <div className="+ border-t+ mt-2+ pt-2+ "+ >+ <ReactMarkdown>+ {'```' + log.input + '```'}+ </ReactMarkdown>+ </div>+ }+ {log.output?.trim() &&+ <div className="+ border-t+ mt-2+ pt-2+ "+ >+ <ReactMarkdown>+ {log.output}+ </ReactMarkdown>+ </div>+ }+ </>+ }+ </div>+ )+}++export default LogEntrydiff --git a/components/Editor/RightSidebar/Logs.tsx b/components/Editor/RightSidebar/Logs/index.tsxsimilarity index 79%rename from components/Editor/RightSidebar/Logs.tsxrename to components/Editor/RightSidebar/Logs/index.tsxindex dc0a636bc..7920dc68c 100644--- a/components/Editor/RightSidebar/Logs.tsx+++ b/components/Editor/RightSidebar/Logs/index.tsx@@ -1,4 +1,5 @@import {+ Fragment,useEffect,useState,} from 'react'@@ -9,6 +10,8 @@ import Text from 'components/Text'import { useTabs } from 'components/Tabs/useTabs'import Tabs from 'components/Tabs'import { Log } from 'db/types'+import LogEntry from './LogEntry'+import ConnectionLine from 'components/Editor/ConnectionLine'export interface Props {logs?: Log[]@@ -54,6 +57,7 @@ function Logs({justify-betweenborder-bpy-2+ pr-4"><Texttext="Logs"@@ -83,19 +87,20 @@ function Logs({tracking-widefont-sanswhitespace-pre-wrap- space-y-4p-4">- {selectedTab === 0 && (- <>- {logs?.map((l, i) =>- <>- {l.type === 'thought' && <div key={l.id}>{l.content}</div>}- {l.type === 'tool' && !l.output && <div key={l.id}>{l.name}</div>}- {l.type === 'tool' && l.output && <div key={l.id}>{l.name}{': '}{l.output}</div>}- </>- )}- </>+ {selectedTab === 0 && logs?.map((l, i, a) =>+ <Fragment key={i}>+ <LogEntry+ log={l}+ key={i}+ />+ {i < a.length - 1 &&+ <div className="flex items-center flex-col">+ <ConnectionLine className="h-4" />+ </div>+ }+ </Fragment>)}{selectedTab === 1 && (<>diff --git a/components/Tabs/index.tsx b/components/Tabs/index.tsxindex 70a730894..1c1b18595 100644--- a/components/Tabs/index.tsx+++ b/components/Tabs/index.tsx@@ -108,8 +108,7 @@ function Tab({<buttonkey={i}className={clsx(- `text-sm- relative+ `relativerounded-mdflexitems-center