Merge branch 'zustand/io/migration' into cz/new-tests
This commit is contained in:
commit
fe743fd0fa
11 changed files with 1328 additions and 1330 deletions
|
|
@ -205,10 +205,7 @@ export default function CodeTabsComponent({
|
|||
<div className="api-modal-according-display">
|
||||
<div
|
||||
className={classNames(
|
||||
"h-[70vh] w-full rounded-lg bg-muted",
|
||||
1 == 1
|
||||
? "overflow-scroll overflow-x-hidden custom-scroll"
|
||||
: "overflow-hidden"
|
||||
"h-[70vh] w-full rounded-lg bg-muted overflow-y-auto overflow-x-hidden custom-scroll"
|
||||
)}
|
||||
>
|
||||
{data?.map((node: any, i) => (
|
||||
|
|
|
|||
|
|
@ -50,14 +50,9 @@ const ApiModal = forwardRef(
|
|||
const tweaksList = useRef<string[]>([]);
|
||||
const [getTweak, setTweak] = useState<tweakType>([]);
|
||||
const flowState = useFlowStore((state) => state.flowState);
|
||||
const pythonApiCode = getPythonApiCode(
|
||||
flow,
|
||||
autoLogin,
|
||||
tweak.current,
|
||||
flowState
|
||||
);
|
||||
const curl_code = getCurlCode(flow, autoLogin, tweak.current, flowState);
|
||||
const pythonCode = getPythonCode(flow, tweak.current, flowState);
|
||||
const pythonApiCode = getPythonApiCode(flow, autoLogin, tweak.current);
|
||||
const curl_code = getCurlCode(flow, autoLogin, tweak.current);
|
||||
const pythonCode = getPythonCode(flow, tweak.current);
|
||||
const widgetCode = getWidgetCode(flow, autoLogin, flowState);
|
||||
const tweaksCode = buildTweaks(flow);
|
||||
const codesArray = [
|
||||
|
|
@ -168,14 +163,9 @@ const ApiModal = forwardRef(
|
|||
tweak.current.push(newTweak);
|
||||
}
|
||||
|
||||
const pythonApiCode = getPythonApiCode(
|
||||
flow,
|
||||
autoLogin,
|
||||
tweak.current,
|
||||
flowState
|
||||
);
|
||||
const curl_code = getCurlCode(flow, autoLogin, tweak.current, flowState);
|
||||
const pythonCode = getPythonCode(flow, tweak.current, flowState);
|
||||
const pythonApiCode = getPythonApiCode(flow, autoLogin, tweak.current);
|
||||
const curl_code = getCurlCode(flow, autoLogin, tweak.current);
|
||||
const pythonCode = getPythonCode(flow, tweak.current);
|
||||
const widgetCode = getWidgetCode(flow, autoLogin, flowState);
|
||||
|
||||
tabs![0].code = curl_code;
|
||||
|
|
|
|||
|
|
@ -59,13 +59,11 @@ export default function IOModal({
|
|||
if (!chatInput && !chatOutput) {
|
||||
if (inputs.length > 0) {
|
||||
return inputs[0];
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return outputs[0];
|
||||
}
|
||||
}
|
||||
else {
|
||||
return undefined
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -116,12 +114,12 @@ export default function IOModal({
|
|||
}
|
||||
|
||||
useEffect(() => {
|
||||
if(selectedTab!==2) setSelectedTab(inputs.length > 0 ? 1 : outputs.length > 0 ? 2 : 0);
|
||||
}, [allNodes]);
|
||||
setSelectedTab(inputs.length > 0 ? 1 : outputs.length > 0 ? 2 : 0);
|
||||
}, [allNodes.length]);
|
||||
|
||||
useEffect(() => {
|
||||
setSelectedViewField(startView());
|
||||
},[open])
|
||||
}, [open]);
|
||||
|
||||
return (
|
||||
<BaseModal
|
||||
|
|
@ -144,7 +142,7 @@ export default function IOModal({
|
|||
</BaseModal.Header>
|
||||
<BaseModal.Content>
|
||||
<div className="flex h-full flex-col ">
|
||||
<div className="flex-max-width mt-2 h-full">
|
||||
<div className="flex-max-width h-full">
|
||||
{selectedTab !== 0 && (
|
||||
<div
|
||||
className={cn(
|
||||
|
|
@ -320,12 +318,14 @@ export default function IOModal({
|
|||
)}
|
||||
>
|
||||
<div className="font-xl flex items-center justify-center gap-3 font-semibold">
|
||||
{(haveChat && <button onClick={() => setSelectedViewField(undefined)}>
|
||||
<IconComponent
|
||||
name={"ArrowLeft"}
|
||||
className="h-6 w-6"
|
||||
></IconComponent>
|
||||
</button>)}
|
||||
{haveChat && (
|
||||
<button onClick={() => setSelectedViewField(undefined)}>
|
||||
<IconComponent
|
||||
name={"ArrowLeft"}
|
||||
className="h-6 w-6"
|
||||
></IconComponent>
|
||||
</button>
|
||||
)}
|
||||
{
|
||||
nodes.find((node) => node.id === selectedViewField.id)
|
||||
?.data.node.display_name
|
||||
|
|
@ -376,8 +376,8 @@ export default function IOModal({
|
|||
</div>
|
||||
</div>
|
||||
</BaseModal.Content>
|
||||
<BaseModal.Footer>
|
||||
{!haveChat && (
|
||||
{!haveChat ? (
|
||||
<BaseModal.Footer>
|
||||
<div className="flex w-full justify-end pt-2">
|
||||
<Button
|
||||
variant={"outline"}
|
||||
|
|
@ -396,8 +396,10 @@ export default function IOModal({
|
|||
Run Flow
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
</BaseModal.Footer>
|
||||
</BaseModal.Footer>
|
||||
) : (
|
||||
<></>
|
||||
)}
|
||||
</BaseModal>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -456,21 +456,12 @@ export function getWidgetCode(
|
|||
const inputs = buildInputs();
|
||||
let chat_input_field = getChatInputField(flowState);
|
||||
|
||||
return `<script src="https://cdn.jsdelivr.net/gh/logspace-ai/langflow-embedded-chat@main/dist/build/static/js/bundle.min.js"></script>
|
||||
return `<script src="https://cdn.jsdelivr.net/gh/logspace-ai/langflow-embedded-chat@1.0_alpha/dist/build/static/js/bundle.min.js"></script>
|
||||
|
||||
<!-- chat_inputs: Stringified JSON with all the input keys and its values. The value of the key that is defined
|
||||
as chat_input_field will be overwritten by the chat message.
|
||||
chat_input_field: Input key that you want the chat to send the user message with. -->
|
||||
<langflow-chat
|
||||
window_title="${flowName}"
|
||||
flow_id="${flowId}"
|
||||
${
|
||||
flowState
|
||||
? `chat_inputs='${inputs}'
|
||||
chat_input_field="${chat_input_field}"
|
||||
`
|
||||
: ""
|
||||
}host_url="http://localhost:7860"${
|
||||
host_url="http://localhost:7860"${
|
||||
!isAuth
|
||||
? `
|
||||
api_key="..."`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue