Skip to content

armgit / E2B

Public Imported from GitHub
0

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

commit

Vasek Mlejnskyf1aa2bca5234
diff --git a/components/Editor/RouteEditor/index.tsx b/components/Editor/RouteEditor/index.tsx
index d11140dfc..be41627ab 100644
--- a/components/Editor/RouteEditor/index.tsx
+++ b/components/Editor/RouteEditor/index.tsx
@@ -10,9 +10,8 @@ export interface Props {
function RouteEditor({ route }: Props) {
const [requestBodyBlock, updateRequestBodyBlock] = useBlock('RequestBody', 1, route)
- const [promptBlock1, updatePromptBlock1] = useBlock('StructuredProse', 1, route)
- const [promptBlock2, updatePromptBlock2] = useBlock('StructuredProse', 2, route)
- const [promptBlock3, updatePromptBlock3] = useBlock('StructuredProse', 3, route)
+ const [descriptionBlock, updateDescriptionBlock] = useBlock('StructuredProse', 1, route)
+ const [instructionsBlock, updateInstructionsBlock] = useBlock('StructuredProse', 2, route)
return (
<div className="
@@ -40,12 +39,12 @@ function RouteEditor({ route }: Props) {
items-start
space-y-8
">
- {promptBlock1 &&
+ {descriptionBlock &&
<PromptEditor
title="What will this route do?"
placeholder="This is an API endpoint that ..."
- block={promptBlock1}
- onChange={updatePromptBlock1}
+ block={descriptionBlock}
+ onChange={updateDescriptionBlock}
/>
}
{requestBodyBlock &&
@@ -54,12 +53,12 @@ function RouteEditor({ route }: Props) {
onChange={updateRequestBodyBlock}
/>
}
- {promptBlock2 &&
+ {instructionsBlock &&
<PromptEditor
- title="Step-by-step implementation"
+ title="Step-by-step instructions"
placeholder="1. Check if the incoming `email` is not empty ..."
- block={promptBlock2}
- onChange={updatePromptBlock2}
+ block={instructionsBlock}
+ onChange={updateInstructionsBlock}
/>
}
</div>
diff --git a/components/Editor/Sidebar/index.tsx b/components/Editor/Sidebar/index.tsx
index 0d39db2c0..844df1537 100644
--- a/components/Editor/Sidebar/index.tsx
+++ b/components/Editor/Sidebar/index.tsx
@@ -8,11 +8,11 @@ import Text from 'components/Text'
import { Route, Block } from 'state/store'
import { useLatestDeployment } from 'hooks/useLatestDeployment'
import { useStateStore } from 'state/StoreProvider'
+import { getPromptText } from 'hooks/useDocEditor'
import DeployButton from './DeployButton'
import Logs from './Logs'
import Envs from './Envs'
-import { getPromptText } from 'hooks/useDocEditor'
export interface Props {
project: projects
@@ -30,6 +30,7 @@ async function handlePostGenerate(url: string, { arg }: {
envs: { key: string, value: string }[],
}
}) {
+ console.log(arg.route.blocks)
return await fetch(url, {
method: 'POST',
body: JSON.stringify({
diff --git a/hooks/useBlock.ts b/hooks/useBlock.ts
index ffe9e07f0..57ad6706f 100644
--- a/hooks/useBlock.ts
+++ b/hooks/useBlock.ts
@@ -27,6 +27,7 @@ function useBlock(blockType: BlockType, position: number, route?: Route): [Block
: undefined
const setBlock = useCallback((prompt: string) => {
+ console.log('SET BLOCK', prompt)
if (route?.id && blockIdx !== undefined && blockIdx !== -1) {
changeBlock(route.id, blockIdx, { prompt })
}
diff --git a/hooks/useDocEditor.ts b/hooks/useDocEditor.ts
index dc072c535..d16e95f75 100644
--- a/hooks/useDocEditor.ts
+++ b/hooks/useDocEditor.ts
@@ -15,8 +15,8 @@ const extensions = [
blockquote: false,
bold: false,
bulletList: false,
- code: false,
- codeBlock: false,
+ // code: false,
+ // codeBlock: false,
dropcursor: false,
hardBreak: false,
// heading: false,
@@ -91,7 +91,8 @@ function useDocEditor({
instance.on('transaction', t => {
if (t.transaction.docChanged) {
- onContentChange(t.transaction.doc.toJSON())
+ // onContentChange(t.transaction.doc.toJSON())
+ onContentChange(t.editor.getHTML())
}
// requestAnimationFrame(() => {