diff --git a/cookbooks/Getting-Started/travel.aiconfig.json b/cookbooks/Getting-Started/travel.aiconfig.json index 0529b962f..3cc596a1a 100644 --- a/cookbooks/Getting-Started/travel.aiconfig.json +++ b/cookbooks/Getting-Started/travel.aiconfig.json @@ -2,7 +2,9 @@ "name": "NYC Trip Planner", "schema_version": "latest", "metadata": { - "parameters": {}, + "parameters": { + "": "" + }, "models": { "gpt-3.5-turbo": { "model": "gpt-3.5-turbo", @@ -21,8 +23,7 @@ "prompts": [ { "name": "get_activities", - "input": "Tell me 10 fun attractions to do in NYC.", - "outputs": [] + "input": "Tell me 10 fun attractions to do in NYC." }, { "name": "gen_itinerary", @@ -32,8 +33,7 @@ "parameters": { "order_by": "geographic location" } - }, - "outputs": [] + } } ], "$schema": "https://json.schemastore.org/aiconfig-1.0" diff --git a/python/src/aiconfig/editor/client/src/Editor.tsx b/python/src/aiconfig/editor/client/src/Editor.tsx index c2e93f4a2..5888e02f5 100644 --- a/python/src/aiconfig/editor/client/src/Editor.tsx +++ b/python/src/aiconfig/editor/client/src/Editor.tsx @@ -228,8 +228,8 @@ export default function Editor() { to: "pink", deg: 45, }, - - globalStyles: () => ({ + // local editor theme + globalStyles: (local) => ({ ".editorBackground": { background: "radial-gradient(ellipse at top,#08122d,#030712),radial-gradient(ellipse at bottom,#030712,#030712)", @@ -253,6 +253,11 @@ export default function Editor() { maxHeight: "16px", fontFamily: "sf mono, ui-monospace, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace", + border: "none", + borderRadius: "4px", + padding: "4px", + margin: "0px", + backgroundColor: "transparent", }, }, ".cellStyle": { @@ -272,6 +277,9 @@ export default function Editor() { outlineOffset: "-1px", }, }, + ".mantine-InputWrapper-label": { + display: "none", + }, }, ".sidePanel": { border: "1px solid rgba(226,232,255,.1)", @@ -286,6 +294,14 @@ export default function Editor() { outlineOffset: "-1px", }, }, + textarea: { + border: "1px solid rgba(226,232,255,.1)", + backgroundColor: "#060c21", + ":focus": { + outline: "solid 1px #ff1cf7 !important", + outlineOffset: "-1px", + }, + }, }, ".divider": { borderTopWidth: "1px", @@ -297,6 +313,9 @@ export default function Editor() { color: "white", borderRadius: "0", height: "auto", + "&:hover": { + background: "#ff46f8", + }, }, ".actionTabsPanel": { width: "400px", @@ -309,6 +328,62 @@ export default function Editor() { justifyContent: "space-between", alignItems: "center", }, + + ".parametersContainer": { + maxWidth: "1250px", + maxHeight: "-webkit-fill-available", + margin: "16px auto", + padding: "0", + backgroundColor: "rgba(226,232,255,.1)", + borderRadius: "4px", + border: "1px solid rgba(226,232,255,.1) !important", + button: { + ":hover": { + backgroundColor: "rgba(226,232,255,.1)", + }, + }, + input: { + border: "1px solid rgba(226,232,255,.1)", + backgroundColor: "#060c21", + borderRadius: "4px", + ":focus": { + outline: "solid 1px #ff1cf7 !important", + outlineOffset: "-1px", + }, + }, + textarea: { + border: "1px solid rgba(226,232,255,.1)", + backgroundColor: "#060c21", + borderRadius: "4px", + ":focus": { + outline: "solid 1px #ff1cf7 !important", + outlineOffset: "-1px", + }, + }, + }, + ".addParameterButton": { + position: "sticky", + left: "0", + bottom: "0", + margin: "16px 0 0 0", + background: "#ff1cf7", + "&:hover": { + background: "#ff46f8", + }, + }, + ".mantine-Slider-thumb": { + border: "0.25rem solid #ff1cf7", + backgroundColor: "white", + }, + ".mantine-Slider-bar": { + backgroundColor: "#ff1cf7", + }, + ".mantine-Tabs-tab[data-active]": { + borderBottom: "solid 1px #ff1cf7", + ":hover": { + borderBottom: "solid 1px #ff1cf7", + }, + }, }), }} > diff --git a/python/src/aiconfig/editor/client/src/components/EditorContainer.tsx b/python/src/aiconfig/editor/client/src/components/EditorContainer.tsx index 9dcdbf492..4d3528dd9 100644 --- a/python/src/aiconfig/editor/client/src/components/EditorContainer.tsx +++ b/python/src/aiconfig/editor/client/src/components/EditorContainer.tsx @@ -90,7 +90,11 @@ export type RunPromptStreamErrorCallback = ( ) => void; export type AIConfigCallbacks = { - addPrompt: (promptName: string, prompt: Prompt, index: number) => Promise<{ aiconfig: AIConfig }>; + addPrompt: ( + promptName: string, + prompt: Prompt, + index: number + ) => Promise<{ aiconfig: AIConfig }>; clearOutputs: () => Promise<{ aiconfig: AIConfig }>; deletePrompt: (promptName: string) => Promise; getModels: (search: string) => Promise; @@ -563,24 +567,21 @@ export default function EditorContainer({ ); const clearOutputsCallback = callbacks.clearOutputs; - const onClearOutputs = useCallback( - async () => { - dispatch({ - type: "CLEAR_OUTPUTS", + const onClearOutputs = useCallback(async () => { + dispatch({ + type: "CLEAR_OUTPUTS", + }); + try { + await clearOutputsCallback(); + } catch (err: unknown) { + const message = (err as RequestCallbackError).message ?? null; + showNotification({ + title: "Error clearing outputs", + message, + color: "red", }); - try { - await clearOutputsCallback(); - } catch (err: unknown) { - const message = (err as RequestCallbackError).message ?? null; - showNotification({ - title: "Error clearing outputs", - message, - color: "red", - }); - } - }, - [clearOutputsCallback, dispatch] - ); + } + }, [clearOutputsCallback, dispatch]); const runPromptCallback = callbacks.runPrompt; @@ -856,24 +857,29 @@ export default function EditorContainer({ - - - - + + + + + + removeParameter(parameterName)} + disabled={isReadonly} + > + + - removeParameter(parameterName)} - style={{ marginTop: -50 }} - disabled={isReadonly} - > - - ); }); @@ -247,7 +246,7 @@ export default memo(function ParametersRenderer(props: { {isReadonly ? null : ( - +