Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

Prepare frontend component for AskHuman

Vasek Mlejnskyf280564525d9
diff --git a/components/Button.tsx b/components/Button.tsx
index 0123224ab..11047d1ac 100644
--- a/components/Button.tsx
+++ b/components/Button.tsx
@@ -46,10 +46,10 @@ function Button({
'items-center',
'justify-center',
'transition-all',
- 'rounded-lg',
+ 'rounded',
'border',
- 'space-x-1.5',
- 'py-1.5',
+ 'space-x-2',
+ 'py-1',
'px-3',
{
'cursor-not-allowed opacity-70': isDisabled,
diff --git a/components/Editor/RightSidebar/Logs/LogStream.tsx b/components/Editor/RightSidebar/Logs/LogStream.tsx
index 490a9aa0a..78b066e06 100644
--- a/components/Editor/RightSidebar/Logs/LogStream.tsx
+++ b/components/Editor/RightSidebar/Logs/LogStream.tsx
@@ -2,7 +2,7 @@ import { Fragment, useEffect, useRef } from 'react'
import ReactMarkdown from 'react-markdown'
import ConnectionLine from 'components/Editor/ConnectionLine'
-import { Log } from 'db/types'
+import { Log, } from 'db/types'
import LogEntry from './LogEntry'
@@ -14,6 +14,17 @@ export interface Props {
function LogStream({ logs, rawLogs }: Props) {
const ref = useRef<HTMLDivElement>(null)
+ // logs = [
+ // {
+ // id: 'id',
+ // type: LogType.Tool,
+ // created_at: new Date(),
+ // tool_name: ToolName.AskHuman,
+ // tool_input: 'What should I do?',
+ // tool_output: '',
+ // }
+ // ]
+
useEffect(function scrollLogs() {
if (!ref.current) return
ref.current.scrollIntoView({ behavior: 'smooth' })
diff --git a/components/Editor/RightSidebar/Logs/Tool/AskHuman.tsx b/components/Editor/RightSidebar/Logs/Tool/AskHuman.tsx
index a7688ab04..22563a7b8 100644
--- a/components/Editor/RightSidebar/Logs/Tool/AskHuman.tsx
+++ b/components/Editor/RightSidebar/Logs/Tool/AskHuman.tsx
@@ -1,10 +1,15 @@
import {
- ReactNode
+ ReactNode,
+ useState,
} from 'react'
import {
HelpCircle,
+ Send,
} from 'lucide-react'
+import Text from 'components/Text'
+import Input from 'components/Input'
+import Button from 'components/Button'
import { ToolName, ToolLog } from 'db/types'
import Base from './Base'
@@ -18,13 +23,42 @@ function AskHuman({
}: Props) {
if (log.tool_name !== ToolName.AskHuman) throw new Error(`'${log.tool_name}': This component supports only logs for '${ToolName.AskHuman}' tool`)
+ const [answer, setAnswer] = useState('')
+
+ function sendAnswer() {
+
+ }
+
let body: ReactNode = null
if (log.tool_input.trim()) {
body = (
<div className="
pt-2
+ flex
+ flex-col
+ items-stretch
+ space-y-2
">
- TODO
+ <Text
+ className="font-medium"
+ text={`AI: ${log.tool_input.trim()}`}
+ />
+ <div className="
+ flex
+ items-center
+ space-x-2
+ ">
+ <Input
+ placeholder="What do you think the AI should do?"
+ onChange={val => setAnswer(val)}
+ value={answer}
+ />
+ <Button
+ icon={<Send size="14px" />}
+ text="Answer"
+ onClick={sendAnswer}
+ />
+ </div>
</div>
)
}