Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
commit
Vasek Mlejnsky5ab806782661
diff --git a/api-service/app.py b/api-service/app.pyindex 215818fee..080639383 100644--- a/api-service/app.py+++ b/api-service/app.py@@ -1,6 +1,7 @@import osimport uuid+from pprint import pprintfrom dotenv import load_dotenvfrom typing import Listfrom playground_client.exceptions import NotFoundException@@ -53,13 +54,16 @@ async def generate():method = body["method"]route = body["route"]+ pprint(blocks)+ return {}+await db.create_deployment(run_id=run_id, project_id=project_id, route_id=route_id)playground = Nonetry:# Create playground for the LLMplayground_tools, playground = create_playground_tools(- get_envs=lambda:db.get_env_vars(project_id),+ get_envs=lambda: db.get_env_vars(project_id),route=route,method=method,request_body_template=get_request_body_template(blocks),@@ -98,5 +102,6 @@ async def generate():if playground is not None:playground.close()+if __name__ == "__main__":- app.run(debug=True, use_reloader=True)\ No newline at end of file+ app.run(debug=True, use_reloader=True)diff --git a/components/Editor/RouteEditor/index.tsx b/components/Editor/RouteEditor/index.tsxindex be41627ab..00f81ee4f 100644--- a/components/Editor/RouteEditor/index.tsx+++ b/components/Editor/RouteEditor/index.tsx@@ -10,8 +10,8 @@ export interface Props {function RouteEditor({ route }: Props) {const [requestBodyBlock, updateRequestBodyBlock] = useBlock('RequestBody', 1, route)- const [descriptionBlock, updateDescriptionBlock] = useBlock('StructuredProse', 1, route)- const [instructionsBlock, updateInstructionsBlock] = useBlock('StructuredProse', 2, route)+ const [descriptionBlock, updateDescriptionBlock] = useBlock('Description', 1, route)+ const [instructionsBlock, updateInstructionsBlock] = useBlock('Instructions', 1, route)return (<div className="@@ -41,7 +41,7 @@ function RouteEditor({ route }: Props) {">{descriptionBlock &&<PromptEditor- title="What will this route do?"+ title="What should this route do?"placeholder="This is an API endpoint that ..."block={descriptionBlock}onChange={updateDescriptionBlock}diff --git a/components/Editor/Sidebar/index.tsx b/components/Editor/Sidebar/index.tsxindex 36315265b..abc9fc2e0 100644--- a/components/Editor/Sidebar/index.tsx+++ b/components/Editor/Sidebar/index.tsx@@ -5,7 +5,7 @@ import clsx from 'clsx'import useSWRMutation from 'swr/mutation'import Text from 'components/Text'-import { Route } from 'state/store'+import { Route, Block } from 'state/store'import { useLatestDeployment } from 'hooks/useLatestDeployment'import { useStateStore } from 'state/StoreProvider'import { html2markdown } from 'hooks/useDocEditor'@@ -30,39 +30,33 @@ async function handlePostGenerate(url: string, { arg }: {envs: { key: string, value: string }[],}}) {- arg.route.blocks.forEach(b => {- console.log(b)- if (b.type === 'StructuredProse') {- html2markdown(b.content)- }- })-- // return await fetch(url, {- // method: 'POST',- // body: JSON.stringify({- // projectID: arg.projectID,- // routeID: arg.route.id,- // // Transform block with structured prose into block with plain prompt text.- // blocks: arg.route.blocks.map(b => {- // switch (b.type) {- // case 'StructuredProse':- // const block: Block = {- // ...b,- // content: html2markdown(b.content),- // }- // return block- // default:- // return b- // }- // }),- // method: arg.route.method.toLowerCase(),- // route: arg.route.route,- // envs: arg.envs,- // }),- // headers: {- // 'Content-Type': 'application/json',- // },- // }).then(r => r.json())+ return await fetch(url, {+ method: 'POST',+ body: JSON.stringify({+ projectID: arg.projectID,+ routeID: arg.route.id,+ // Transform block with structured prose into block with plain prompt text.+ blocks: arg.route.blocks.map(b => {+ switch (b.type) {+ case 'Description':+ case 'Instructions':+ const block: Block = {+ ...b,+ content: html2markdown(b.content),+ }+ return block+ default:+ return b+ }+ }),+ method: arg.route.method.toLowerCase(),+ route: arg.route.route,+ envs: arg.envs,+ }),+ headers: {+ 'Content-Type': 'application/json',+ },+ }).then(r => r.json())}function Sidebar({diff --git a/hooks/useDocEditor.ts b/hooks/useDocEditor.tsindex 7287135e8..e9249f2ab 100644--- a/hooks/useDocEditor.ts+++ b/hooks/useDocEditor.ts@@ -53,7 +53,6 @@ const serializer = new MarkdownSerializer({export function html2markdown(html: string) {const node = createDocument(html, schema)const markdown = serializer.serialize(node)- console.log(markdown)return markdown}diff --git a/state/store.ts b/state/store.tsindex 8d027de82..afa1c470a 100644--- a/state/store.ts+++ b/state/store.ts@@ -13,13 +13,13 @@ export type BlockType ='Basic' |// Code that looks like TypeScript interface definition without the outer parenthesses.'RequestBody' |- // ProseMirror HTML- 'StructuredProse'+ 'Description' |+ 'Instructions'export interface Block {id: stringtype: BlockType- // `content` is HTML when `type` is `StructuredProse`+ // `content` must be valid HTML when `type` is `Description` or `Instructions`content: string}@@ -69,8 +69,8 @@ function getDefaultRoute(): Route {return {blocks: [createBlock('RequestBody'),- createBlock('StructuredProse'),- createBlock('StructuredProse'),+ createBlock('Description'),+ createBlock('Instructions'),],method: Method.POST,route: '/',