Skip to content

armgit / E2B

Public Imported from GitHub
0

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

Add HF Infererence Endpoints; Add prompt model label; Cleanup

Tomas Valenta9922e7b36713
diff --git a/README.md b/README.md
index 08862e240..e04446bad 100644
--- a/README.md
+++ b/README.md
@@ -66,10 +66,10 @@ While e2b will offer the "batteries-included" solution, our goal is to let users
- [x] [Anthropic](https://anthropic.com/)
- [x] Claude v1.3
- [x] Claude Instant v1
-- [x] [Replicate](https://replicate.com/) 🚧
-- [ ] [HuggingFace](https://huggingface.co/) 🚧
+- [x] [Replicate](https://replicate.com/)
+- [x] [HuggingFace](https://huggingface.co/)
- [x] Inference API
- - [ ] Inference Endpoints
+ - [x] Inference Endpoints
- [ ] [Banana](https://www.banana.dev/) 🚧
### **Model or model hosting provider you like isn't supported?**
@@ -99,7 +99,7 @@ We welcome any contributions! If you want to contribute to the project check out
- Model hosting providers:
- βœ… ~~Replicate~~
- βœ… ~~Hugging Face Inference API~~
- - Hugging Face Hub
+ - βœ… ~~Hugging Face Inference Endpoints~~
- Banana
- Paperspace
1. Improve agent's reliability and quality of output.
diff --git a/api-service/app.py b/api-service/app.py
index 0fba048d1..97b8ba397 100644
--- a/api-service/app.py
+++ b/api-service/app.py
@@ -50,11 +50,10 @@ async def generate():
run_id = str(uuid.uuid4())
project_id = body["projectID"]
- route_id = body["routeID"]
model_config = body["modelConfig"]
prompt = body["prompt"]
- await db.create_deployment(run_id=run_id, project_id=project_id, route_id=route_id)
+ await db.create_deployment(run_id=run_id, project_id=project_id)
playground = None
try:
diff --git a/api-service/database/database.py b/api-service/database/database.py
index eeb3d19d2..5338d6e58 100644
--- a/api-service/database/database.py
+++ b/api-service/database/database.py
@@ -16,18 +16,20 @@ class DeploymentState(Enum):
TABLE_DEPLOYMENTS = "deployments"
TABLE_PROJECTS = "projects"
+
class Database:
def __init__(self, supabase_url: str, supabase_key: str) -> None:
self.client = Client(supabase_url=supabase_url, supabase_key=supabase_key)
async def create_deployment(
- self, run_id: str, project_id: str, route_id: str
+ self,
+ run_id: str,
+ project_id: str,
) -> None:
await self.client.table(TABLE_DEPLOYMENTS).insert(
{
"id": run_id,
"project_id": project_id,
- "route_id": route_id,
"state": DeploymentState.Generating.value,
},
).execute()
diff --git a/api-service/models/base.py b/api-service/models/base.py
index 704119387..7d2f4b8c9 100644
--- a/api-service/models/base.py
+++ b/api-service/models/base.py
@@ -6,7 +6,7 @@ from langchain.schema import BaseLanguageModel
from langchain.callbacks.base import BaseCallbackManager
from .providers.replicate import ReplicateFix
-from .providers.hugging_face import HuggingFaceHubFix
+from .providers.hugging_face import HuggingFaceHubFix, HuggingFaceEndpointFix
class ModelProvider(Enum):
@@ -52,10 +52,17 @@ def get_model(
)
case ModelProvider.HuggingFace.value:
if config["args"].get("endpoint_url"):
- return HuggingFaceEndpoint(
- **config["args"],
+ return HuggingFaceEndpointFix(
+ huggingfacehub_api_token=config["args"]["huggingfacehub_api_token"],
+ endpoint_url=config["args"]["endpoint_url"],
verbose=True,
+ model_kwargs={
+ **config["args"],
+ "huggingfacehub_api_token": None,
+ "endpoint_url": None,
+ },
callback_manager=callback_manager,
+ task="text-generation",
)
elif config["args"].get("repo_id"):
return HuggingFaceHubFix(
diff --git a/components/Button.tsx b/components/Button.tsx
index 08291db3a..95ded837c 100644
--- a/components/Button.tsx
+++ b/components/Button.tsx
@@ -52,7 +52,7 @@ function Button({
'py-1',
'px-3',
{
- 'cursor-not-allowed opacity-70': isDisabled,
+ 'cursor-not-allowed opacity-50': isDisabled,
'bg-green-800/90 text-white border-transparent hover:bg-green-800 font-semibold':
variant === Variant.Full,
'border-slate-200 hover:border-green-800 hover:text-green-800':
diff --git a/components/Editor/Sidebar/Model/index.tsx b/components/Editor/Sidebar/Model/index.tsx
index b8f1fef01..adcf7f474 100644
--- a/components/Editor/Sidebar/Model/index.tsx
+++ b/components/Editor/Sidebar/Model/index.tsx
@@ -59,7 +59,8 @@ function Model({ }: Props) {
scroller
"
>
- {Object.entries(modelTemplates)
+ {Object
+ .entries(modelTemplates)
.slice()
.sort(modelProviderOrder)
.map(([provider, template], i, a) =>
diff --git a/components/Editor/Sidebar/Prompt/Editor.tsx b/components/Editor/Sidebar/Prompt/PromptEditor.tsx
similarity index 100%
rename from components/Editor/Sidebar/Prompt/Editor.tsx
rename to components/Editor/Sidebar/Prompt/PromptEditor.tsx
diff --git a/components/Editor/Sidebar/Prompt/index.tsx b/components/Editor/Sidebar/Prompt/index.tsx
index 05b27f85b..30f38fda4 100644
--- a/components/Editor/Sidebar/Prompt/index.tsx
+++ b/components/Editor/Sidebar/Prompt/index.tsx
@@ -3,7 +3,8 @@ import { useStateStore } from 'state/StoreProvider'
import { defaultPromptTemplate, getDescription } from 'state/prompt'
import { defaultTemplateID } from 'state/store'
-import Editor from './Editor'
+import Editor from './PromptEditor'
+import { providerIcons } from 'components/icons/ProviderIcon'
function Prompt() {
const [selectors] = useStateStore()
@@ -26,10 +27,10 @@ function Prompt() {
flex
bg-slate-50
items-center
- justify-between
border-b
py-3.5
- pr-4
+ px-4
+ space-x-4
">
<Text
text="Prompt"
@@ -38,21 +39,50 @@ function Prompt() {
uppercase
text-slate-400
font-semibold
- px-4
"
/>
</div>
<div
className="
- py-8
- px-4
- flex
- flex-1
- bg-white
- justify-center
- overflow-auto
- scroller
- "
+ border-slate-100
+ py-2
+ px-4
+ border-b
+ space-x-2
+ justify-between
+ font-medium
+ flex
+ "
+ >
+ <div className="
+ flex
+ items-center
+ space-x-2
+ ">
+ {providerIcons[model.provider]}
+ <Text
+ text={model.provider}
+ className="
+ text-slate-400
+ "
+ size={Text.size.S2}
+ />
+ </div>
+ <Text
+ text={model.name}
+ />
+ </div>
+ <div
+ className="
+ py-8
+ px-4
+ flex
+ flex-1
+ bg-white
+ justify-center
+ overflow-auto
+ scroller
+ "
>
<div className="
flex
diff --git a/components/Editor/Sidebar/index.tsx b/components/Editor/Sidebar/index.tsx
index bf910725d..fadb3d451 100644
--- a/components/Editor/Sidebar/index.tsx
+++ b/components/Editor/Sidebar/index.tsx
@@ -3,34 +3,26 @@ import clsx from 'clsx'
import useSWRMutation from 'swr/mutation'
import { projects } from '@prisma/client'
-import Agent from './Agent'
-import Envs from './Envs'
-import Model from './Model'
-
import { defaultTemplateID, PromptPart, Route } from 'state/store'
import { useLatestDeployment } from 'hooks/useLatestDeployment'
import { useStateStore } from 'state/StoreProvider'
import { ModelConfig, getModelConfig } from 'state/model'
import useModelProviderArgs from 'hooks/useModelProviderArgs'
-import Prompt from './Prompt'
import { defaultPromptTemplate, evaluatePrompt } from 'state/prompt'
+
+import Agent from './Agent'
+import Envs from './Envs'
+import Model from './Model'
+import Prompt from './Prompt'
+import { identity } from 'utils/identity'
+import { MenuSection } from '../SidebarMenu'
// import Deploy from './Deploy'
export interface Props {
project: projects
- route?: Route
activeMenuSection?: MenuSection
}
-export enum MenuSection {
- Agent = 'Agent',
- Envs = 'Envs',
- Model = 'Model',
- Prompt = 'Prompt',
- // Context = 'Context',
- // Deploy = 'Deploy',
-}
-
async function handlePostGenerate(url: string, { arg }: {
arg: {
controller: AbortController,
@@ -70,10 +62,9 @@ const apiURL = process.env.NEXT_PUBLIC_PROXY
function Sidebar({
project,
- route,
activeMenuSection,
}: Props) {
- const deployment = useLatestDeployment(project, route)
+ const deployment = useLatestDeployment(project)
const {
trigger: generate,
@@ -85,6 +76,7 @@ function Sidebar({
const [selectors] = useStateStore()
const envs = selectors.use.envs()
const model = selectors.use.model()
+ const route = selectors.use.routes().find(identity)
const prompt = selectors.use.modelSetups().find(p =>
p.templateID === defaultTemplateID &&
p.provider === model.provider &&
@@ -94,7 +86,11 @@ function Sidebar({
const [creds] = useModelProviderArgs()
async function deploy() {
- if (!route) return
+ if (!route) {
+ console.error('Cannot get route')
+ return
+ }
+
const config = getModelConfig(model, creds)
if (!config) {
console.error('Cannot get model config')
@@ -106,11 +102,11 @@ function Sidebar({
await generate({
controller,
- projectID: project.id,
route,
- envs,
+ projectID: project.id,
promptTemplate: prompt,
modelConfig: config,
+ envs,
})
}
diff --git a/components/Editor/SidebarMenu.tsx b/components/Editor/SidebarMenu.tsx
new file mode 100644
index 000000000..e7e3ee1b0
--- /dev/null
+++ b/components/Editor/SidebarMenu.tsx
@@ -0,0 +1,81 @@
+import clsx from 'clsx'
+import { Code, Lock, Cpu, WholeWord } from 'lucide-react'
+
+export enum MenuSection {
+ Agent = 'Agent',
+ Envs = 'Envs',
+ Model = 'Model',
+ Prompt = 'Prompt',
+ // Context = 'Context',
+ // Deploy = 'Deploy',
+}
+
+const menuIconSize = '18px'
+
+function getMenuSelectionIcon(selection: MenuSection) {
+ switch (selection) {
+ case MenuSection.Agent:
+ return <Code size={menuIconSize} />
+ // case MenuSection.Context:
+ // return <Box size={menuIconSize} />
+ // case MenuSection.Deploy:
+ // return <Server size={menuIconSize} />
+ case MenuSection.Prompt:
+ return <WholeWord size={menuIconSize} />
+ case MenuSection.Envs:
+ return <Lock size={menuIconSize} />
+ case MenuSection.Model:
+ return <Cpu size={menuIconSize} />
+ }
+}
+
+export interface Props {
+ selected: MenuSection
+ setSelected: (section: MenuSection) => void
+}
+
+function SidebarMenu({ selected, setSelected }: Props) {
+ return (
+ <div className="
+ w-14
+ flex
+ py-2
+ text-sm
+ border-l
+ bg-white
+ flex-col
+ space-y-4
+ items-center
+ "
+ >
+ {Object.values(MenuSection).map(m =>
+ <button
+ key={m}
+ className={clsx(`
+ hover:text-green-800
+ transition-all
+ text-xs
+ items-center
+ justify-center
+ flex
+ flex-col
+ space-y-1
+ `,
+ {
+ 'text-slate-400': selected !== m,
+ 'text-slate-600': selected === m,
+ }
+ )}
+ onClick={() => setSelected(m)}
+ >
+ {getMenuSelectionIcon(m)}
+ <span>
+ {m.toString()}
+ </span>
+ </button>
+ )}
+ </div>
+ )
+}
+
+export default SidebarMenu
diff --git a/components/Editor/RouteEditor/index.tsx b/components/Editor/Template/NodeJSExpressTemplate/Instructions.tsx
similarity index 94%
rename from components/Editor/RouteEditor/index.tsx
rename to components/Editor/Template/NodeJSExpressTemplate/Instructions.tsx
index 507103e89..714638d1c 100644
--- a/components/Editor/RouteEditor/index.tsx
+++ b/components/Editor/Template/NodeJSExpressTemplate/Instructions.tsx
@@ -1,7 +1,7 @@
import { Route } from 'state/store'
import useBlock from 'hooks/useBlock'
-import PromptEditor from './PromptEditor'
+import InstructionsEditor from './InstructionsEditor'
import RequestBodyEditor from './RequestBodyEditor'
import useReferences from 'hooks/useReferences'
@@ -45,7 +45,7 @@ function RouteEditor({ route }: Props) {
grow
">
{descriptionBlock &&
- <PromptEditor
+ <InstructionsEditor
referenceSearch={referenceSearch}
title="What should this route do?"
placeholder="This is an API endpoint that ..."
@@ -60,7 +60,7 @@ function RouteEditor({ route }: Props) {
/>
}
{instructionsBlock &&
- <PromptEditor
+ <InstructionsEditor
referenceSearch={referenceSearch}
title="Step-by-step instructions"
placeholder="1. Check if the incoming `email` is not empty ..."
diff --git a/components/Editor/RouteEditor/PromptEditor/Autocomplete/HighlightedText.tsx b/components/Editor/Template/NodeJSExpressTemplate/InstructionsEditor/Autocomplete/HighlightedText.tsx
similarity index 100%
rename from components/Editor/RouteEditor/PromptEditor/Autocomplete/HighlightedText.tsx
rename to components/Editor/Template/NodeJSExpressTemplate/InstructionsEditor/Autocomplete/HighlightedText.tsx
diff --git a/components/Editor/RouteEditor/PromptEditor/Autocomplete/Item.tsx b/components/Editor/Template/NodeJSExpressTemplate/InstructionsEditor/Autocomplete/Item.tsx
similarity index 100%
rename from components/Editor/RouteEditor/PromptEditor/Autocomplete/Item.tsx
rename to components/Editor/Template/NodeJSExpressTemplate/InstructionsEditor/Autocomplete/Item.tsx
diff --git a/components/Editor/RouteEditor/PromptEditor/Autocomplete/ListWrapper.tsx b/components/Editor/Template/NodeJSExpressTemplate/InstructionsEditor/Autocomplete/ListWrapper.tsx
similarity index 100%
rename from components/Editor/RouteEditor/PromptEditor/Autocomplete/ListWrapper.tsx
rename to components/Editor/Template/NodeJSExpressTemplate/InstructionsEditor/Autocomplete/ListWrapper.tsx
diff --git a/components/Editor/RouteEditor/PromptEditor/Autocomplete/index.tsx b/components/Editor/Template/NodeJSExpressTemplate/InstructionsEditor/Autocomplete/index.tsx
similarity index 100%
rename from components/Editor/RouteEditor/PromptEditor/Autocomplete/index.tsx
rename to components/Editor/Template/NodeJSExpressTemplate/InstructionsEditor/Autocomplete/index.tsx
diff --git a/components/Editor/RouteEditor/PromptEditor/index.tsx b/components/Editor/Template/NodeJSExpressTemplate/InstructionsEditor/index.tsx
similarity index 93%
rename from components/Editor/RouteEditor/PromptEditor/index.tsx
rename to components/Editor/Template/NodeJSExpressTemplate/InstructionsEditor/index.tsx
index 5f207a3e9..24a20c84f 100644
--- a/components/Editor/RouteEditor/PromptEditor/index.tsx
+++ b/components/Editor/Template/NodeJSExpressTemplate/InstructionsEditor/index.tsx
@@ -13,7 +13,7 @@ export interface Props {
referenceSearch?: Fuse<Reference>
}
-function PromptEditor({
+function InstructionsEditor({
title,
onChange,
content,
@@ -51,4 +51,4 @@ function PromptEditor({
)
}
-export default PromptEditor
+export default InstructionsEditor
diff --git a/components/Editor/RouteEditor/RequestBodyEditor.tsx b/components/Editor/Template/NodeJSExpressTemplate/RequestBodyEditor.tsx
similarity index 100%
rename from components/Editor/RouteEditor/RequestBodyEditor.tsx
rename to components/Editor/Template/NodeJSExpressTemplate/RequestBodyEditor.tsx
diff --git a/components/Editor/Routes.tsx b/components/Editor/Template/NodeJSExpressTemplate/Routes.tsx
similarity index 96%
rename from components/Editor/Routes.tsx
rename to components/Editor/Template/NodeJSExpressTemplate/Routes.tsx
index 0d5589c3f..34c6c946b 100644
--- a/components/Editor/Routes.tsx
+++ b/components/Editor/Template/NodeJSExpressTemplate/Routes.tsx
@@ -4,7 +4,6 @@ import { Plus } from 'lucide-react'
import { Method, methods, Route } from 'state/store'
import Button from 'components/Button'
import Text from 'components/Text'
-import DeleteButton from 'components/DeleteButton'
import Select from 'components/Select'
import { useStateStore } from 'state/StoreProvider'
@@ -52,6 +51,7 @@ function Routes({
onClick={addRoute}
variant={Button.variant.Outline}
icon={<Plus size="16px" />}
+ isDisabled={routes.length >= 1}
/>
<div className="
flex
@@ -96,9 +96,9 @@ function Routes({
</div>
</button>
- <DeleteButton
+ {/* <DeleteButton
onDelete={() => deleteRoute(r.id)}
- />
+ /> */}
</div>
)}
</div>
diff --git a/components/Editor/Template/NodeJSExpressTemplate/index.tsx b/components/Editor/Template/NodeJSExpressTemplate/index.tsx
new file mode 100644
index 000000000..319519f0f
--- /dev/null
+++ b/components/Editor/Template/NodeJSExpressTemplate/index.tsx
@@ -0,0 +1,51 @@
+import { useState, useEffect } from 'react'
+
+import { useStateStore } from 'state/StoreProvider'
+
+import RouteEditor from './Instructions'
+import Routes from './Routes'
+
+export interface Props {
+
+}
+
+function NodeJSExpressTemplate({ }: Props) {
+ const [selectors] = useStateStore()
+
+ // TODO: Handle editor state differently so we don't rerender this component on each editor edit.
+ const routes = selectors.use.routes()
+ const deleteRoute = selectors.use.deleteRoute()
+
+ const [selectedRouteID, setSelectedRouteID] = useState(() => routes.length > 0 ? routes[0].id : undefined)
+ const selectedRoute = routes.find(s => s.id === selectedRouteID)
+
+ useEffect(function selectDefaultRoute() {
+ if (selectedRoute?.id || routes.length === 0) return
+ setSelectedRouteID(routes[0].id)
+ }, [routes, selectedRoute?.id])
+
+ function handleDeleteRoute(id: string) {
+ deleteRoute(id)
+ setSelectedRouteID(r => {
+ if (r === id) {
+ return routes.length > 0 ? routes[0].id : undefined
+ }
+ })
+ }
+
+ return (
+ <>
+ <Routes
+ routes={routes}
+ selectRoute={setSelectedRouteID}
+ selectedRouteID={selectedRoute?.id}
+ deleteRoute={handleDeleteRoute}
+ />
+ <RouteEditor
+ route={selectedRoute}
+ />
+ </>
+ )
+}
+
+export default NodeJSExpressTemplate
diff --git a/components/Editor/Template/index.tsx b/components/Editor/Template/index.tsx
new file mode 100644
index 000000000..2dea03d45
--- /dev/null
+++ b/components/Editor/Template/index.tsx
@@ -0,0 +1,23 @@
+import { forwardRef } from 'react'
+
+import NodeJSExpressTemplate from './NodeJSExpressTemplate'
+
+export interface Props { }
+
+const Template = forwardRef<HTMLDivElement, Props>(({ }, ref) => {
+ return (
+ <div
+ ref={ref}
+ className="
+ flex
+ flex-col
+ flex-1
+ ">
+ <NodeJSExpressTemplate />
+ </div>
+ )
+})
+
+Template.displayName = 'Template'
+
+export default Template
diff --git a/components/Editor/index.tsx b/components/Editor/index.tsx
index fe7df6d33..bb251f2dc 100644
--- a/components/Editor/index.tsx
+++ b/components/Editor/index.tsx
@@ -1,64 +1,23 @@
-import { useCallback, useEffect, useRef, useState } from 'react'
+import { useCallback, useRef, useState } from 'react'
import { projects } from '@prisma/client'
import Splitter, { GutterTheme } from '@devbookhq/splitter'
import { useLocalStorage } from 'usehooks-ts'
-import clsx from 'clsx'
-import { Code, Lock, Cpu, WholeWord } from 'lucide-react'
-import { useStateStore } from 'state/StoreProvider'
-import Routes from './Routes'
-import Sidebar, { MenuSection } from './Sidebar'
-import RouteEditor from './RouteEditor'
-
-const menuIconSize = '18px'
-function getMenuSelectionIcon(selection: MenuSection) {
- switch (selection) {
- case MenuSection.Agent:
- return <Code size={menuIconSize} />
- // case MenuSection.Context:
- // return <Box size={menuIconSize} />
- // case MenuSection.Deploy:
- // return <Server size={menuIconSize} />
- case MenuSection.Prompt:
- return <WholeWord size={menuIconSize} />
- case MenuSection.Envs:
- return <Lock size={menuIconSize} />
- case MenuSection.Model:
- return <Cpu size={menuIconSize} />
- }
-}
+import Sidebar from './Sidebar'
+import SidebarMenu, { MenuSection } from './SidebarMenu'
+import Template from './Template'
export interface Props {
project: projects
}
function Editor({ project }: Props) {
- const [selectors] = useStateStore()
const ref = useRef<HTMLDivElement | null>(null)
- const [selectedMenuSection, setSelectedMenuSection] = useState(MenuSection.Agent)
-
- // TODO: Handle editor state differently so we don't rerender this component on each editor edit.
- const routes = selectors.use.routes()
- const deleteRoute = selectors.use.deleteRoute()
-
- const [selectedRouteID, setSelectedRouteID] = useState(() => routes.length > 0 ? routes[0].id : undefined)
- const selectedRoute = routes.find(s => s.id === selectedRouteID)
-
- useEffect(function selectDefaultRoute() {
- if (selectedRoute?.id || routes.length === 0) return
- setSelectedRouteID(routes[0].id)
- }, [routes, selectedRoute?.id])
-
- function handleDeleteRoute(id: string) {
- deleteRoute(id)
- setSelectedRouteID(r => {
- if (r === id) {
- return routes.length > 0 ? routes[0].id : undefined
- }
- })
- }
+ const [selectedMenuSection, setSelectedMenuSection] = useState(
+ MenuSection.Agent,
+ )
const [sizes, setSizes] = useLocalStorage('project-board-splitter-sizes', [50, 50])
const handleResize = useCallback((_: number, newSizes: number[]) => {
@@ -91,68 +50,17 @@ function Editor({ project }: Props) {
gutterClassName='bg-slate-200'
draggerClassName='bg-slate-400'
>
- <div
- ref={ref}
- className="
- flex
- flex-col
- flex-1
- ">
- <Routes
- routes={routes}
- selectRoute={setSelectedRouteID}
- selectedRouteID={selectedRoute?.id}
- deleteRoute={handleDeleteRoute}
- />
- <RouteEditor
- route={selectedRoute}
- />
- </div>
+
+ <Template />
<Sidebar
- activeMenuSection={selectedMenuSection}
+ activeMenuSection={selectedMenuSection as MenuSection}
project={project}
- route={selectedRoute}
/>
</Splitter>
- <div className="
- w-14
- flex
- py-2
- text-sm
- border-l
- bg-white
- flex-col
- space-y-4
- items-center
- "
- >
- {Object.values(MenuSection).map(m =>
- <button
- key={m}
- className={clsx(`
- hover:text-green-800
- transition-all
- text-xs
- items-center
- justify-center
- flex
- flex-col
- space-y-1
- `,
- {
- 'text-slate-400': selectedMenuSection !== m,
- 'text-slate-600': selectedMenuSection === m,
- }
- )}
- onClick={() => setSelectedMenuSection(m)}
- >
- {getMenuSelectionIcon(m)}
- <span>
- {m.toString()}
- </span>
- </button>
- )}
- </div>
+ <SidebarMenu
+ selected={selectedMenuSection as MenuSection}
+ setSelected={setSelectedMenuSection}
+ />
</div>
)
}
diff --git a/components/Select/SelectValue.tsx b/components/Select/SelectValue.tsx
index 5e89cdc02..a6c6b5405 100644
--- a/components/Select/SelectValue.tsx
+++ b/components/Select/SelectValue.tsx
@@ -35,7 +35,7 @@ function SelectValue({
py-1
`,
{
- 'text-green-500': isSelected,
+ 'text-green-800': isSelected,
'text-slate-500': !isSelected,
},
)}
diff --git a/components/Select/index.tsx b/components/Select/index.tsx
index 856e78736..d7c14e238 100644
--- a/components/Select/index.tsx
+++ b/components/Select/index.tsx
@@ -92,7 +92,7 @@ function Select({
p-1
mt-0.5
relative
- border border-green-500
+ border border-green-800
rounded
bg-white
space-y-2`
diff --git a/editor/extensions/autocomplete/index.ts b/editor/extensions/autocomplete/index.ts
index 4ca31eb27..3f41de0a8 100644
--- a/editor/extensions/autocomplete/index.ts
+++ b/editor/extensions/autocomplete/index.ts
@@ -9,8 +9,8 @@ import tippy, {
} from 'tippy.js'
import { destroyOnEsc } from 'editor/tippyPlugins'
-import AutocompleteListWrapper, { AutocompleteList } from 'components/Editor/RouteEditor/PromptEditor/Autocomplete/ListWrapper'
-import Autocomplete from 'components/Editor/RouteEditor/PromptEditor/Autocomplete'
+import AutocompleteListWrapper, { AutocompleteList } from 'components/Editor/Template/NodeJSExpressTemplate/InstructionsEditor/Autocomplete/ListWrapper'
+import Autocomplete from 'components/Editor/Template/NodeJSExpressTemplate/InstructionsEditor/Autocomplete'
import { Suggestion, SuggestionOptions, SuggestionProps } from './suggestion'
import reference from '../reference'
diff --git a/hooks/useLatestDeployment.ts b/hooks/useLatestDeployment.ts
index a8257e7e8..e8e75f004 100644
--- a/hooks/useLatestDeployment.ts
+++ b/hooks/useLatestDeployment.ts
@@ -4,24 +4,20 @@ import { useState, useEffect } from 'react'
import { deploymentsTable } from 'db/tables'
import { Database } from 'db/supabase'
-import { Route } from 'state/store'
-export function useLatestDeployment(project: projects, route?: Route) {
+export function useLatestDeployment(project: projects) {
const [initDeployment, setInitDeployment] = useState<deployments>()
const [deployment, setDeployment] = useState<deployments>()
const client = useSupabaseClient<Database>()
useEffect(function init() {
- if (!route?.id) return
-
(async function () {
// TODO: SECURITY - Enable row security for all tables and secure access to deployments.
const deployment = await client
.from(deploymentsTable)
.select('*')
.eq('project_id', project.id)
- .eq('route_id', route.id)
.order('created_at', { ascending: false })
.limit(1)
.single()
@@ -29,15 +25,13 @@ export function useLatestDeployment(project: projects, route?: Route) {
if (deployment.error) return
setInitDeployment(deployment.data as unknown as deployments)
}())
- }, [client, project.id, route?.id])
+ }, [client, project.id])
// Sometimes a large field from realtime server can be missing because of the internal POSTGRES/TOAST workings.
// We changed the table replication to full with `ALTER TABLE events REPLICA IDENTITY FULL;` to fix this.
// https://github.com/supabase/realtime/issues/223 mentioned that we may need to check the `old_record` field of the payload for the actual value,
// but so far it seems we don't have to.
useEffect(function subscribe() {
- if (!route?.id) return
-
// TODO: SECURITY - Enable row security for all tables and configure access to deployments.
const insertSub = client.channel('any')
.on('postgres_changes',
@@ -47,9 +41,7 @@ export function useLatestDeployment(project: projects, route?: Route) {
table: deploymentsTable,
filter: `project_id=eq.${project.id}`,
}, payload => {
- if (payload.new.route_id === route.id) {
- setDeployment(payload.new as deployments)
- }
+ setDeployment(payload.new as deployments)
})
.subscribe()
@@ -62,9 +54,7 @@ export function useLatestDeployment(project: projects, route?: Route) {
table: deploymentsTable,
filter: `project_id=eq.${project.id}`,
}, payload => {
- if (payload.new.route_id === route.id) {
- setDeployment(payload.new as deployments)
- }
+ setDeployment(payload.new as deployments)
})
.subscribe()
@@ -75,7 +65,6 @@ export function useLatestDeployment(project: projects, route?: Route) {
}, [
client,
project.id,
- route?.id,
])
return deployment || initDeployment
diff --git a/package.json b/package.json
index 232e45622..7b5808f78 100644
--- a/package.json
+++ b/package.json
@@ -27,7 +27,7 @@
"stop": "docker compose down && npm run db:stop",
"lint": "next lint",
"lint:fix": "next lint --fix",
- "dev:next:debug": "NODE_OPTIONS='--inspect' next dev",
+ "dev:next:debug": "cross-env NODE_OPTIONS='--inspect' next dev",
"dev:api-service:debug-without-launch": "npx concurrently -p none \"next dev\" \"npm run start:playground\"",
"db:generate": "prisma generate",
"db:pull": "prisma db pull",
diff --git a/state/model.ts b/state/model.ts
index ac0ef389c..1e526408d 100644
--- a/state/model.ts
+++ b/state/model.ts
@@ -216,17 +216,65 @@ export const modelTemplates: {
},
},
},
- // {
- // name: 'Inference Endpoints model',
- // args: {
- // endpoint_url: {
- // editable: true,
- // type: 'string',
- // label: 'Endpoint URL',
- // placeholder: '...endpoints.huggingface.cloud',
- // },
- // },
- // },
+ {
+ name: 'Inference Endpoints model',
+ args: {
+ endpoint_url: {
+ editable: true,
+ type: 'string',
+ label: 'Endpoint URL',
+ placeholder: '...endpoints.huggingface.cloud',
+ },
+ max_length: {
+ type: 'number',
+ editable: true,
+ step: 1,
+ min: 1,
+ value: 250,
+ optional: true
+ },
+ temperature: {
+ editable: true,
+ type: 'number',
+ value: 1,
+ min: 0.01,
+ max: 100,
+ step: 0.01,
+ optional: true
+ },
+ top_p: {
+ editable: true,
+ type: 'number',
+ min: 0,
+ step: 0.01,
+ optional: true
+ },
+ top_k: {
+ editable: true,
+ type: 'number',
+ min: 0,
+ step: 1,
+ optional: true
+ },
+ repetition_penalty: {
+ editable: true,
+ type: 'number',
+ value: 1,
+ min: 0,
+ max: 100,
+ step: 0.01,
+ optional: true
+ },
+ max_time: {
+ editable: true,
+ type: 'number',
+ min: 0,
+ max: 120,
+ step: 0.01,
+ optional: true
+ },
+ },
+ },
],
},
[ModelProvider.Replicate]: {