Merge branch 'dev' into updateMakefile
This commit is contained in:
commit
a7ed611a15
3 changed files with 84 additions and 187 deletions
|
|
@ -508,84 +508,3 @@ export const URL_EXCLUDED_FROM_ERROR_RETRIES = [
|
||||||
"/api/v1/custom_component",
|
"/api/v1/custom_component",
|
||||||
"/api/v1/validate/prompt",
|
"/api/v1/validate/prompt",
|
||||||
];
|
];
|
||||||
|
|
||||||
export const tabsCode = [];
|
|
||||||
|
|
||||||
export function tabsArray(codes: string[], method: number) {
|
|
||||||
if (!method) return;
|
|
||||||
if (method === 0) {
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
name: "cURL",
|
|
||||||
mode: "bash",
|
|
||||||
image: "https://curl.se/logo/curl-symbol-transparent.png",
|
|
||||||
language: "sh",
|
|
||||||
code: codes[0],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Python API",
|
|
||||||
mode: "python",
|
|
||||||
image:
|
|
||||||
"https://images.squarespace-cdn.com/content/v1/5df3d8c5d2be5962e4f87890/1628015119369-OY4TV3XJJ53ECO0W2OLQ/Python+API+Training+Logo.png?format=1000w",
|
|
||||||
language: "py",
|
|
||||||
code: codes[1],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Python Code",
|
|
||||||
mode: "python",
|
|
||||||
image: "https://cdn-icons-png.flaticon.com/512/5968/5968350.png",
|
|
||||||
language: "py",
|
|
||||||
code: codes[2],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Chat Widget HTML",
|
|
||||||
description:
|
|
||||||
"Insert this code anywhere in your <body> tag. To use with react and other libs, check our <a class='link-color' href='https://langflow.org/guidelines/widget'>documentation</a>.",
|
|
||||||
mode: "html",
|
|
||||||
image: "https://cdn-icons-png.flaticon.com/512/5968/5968350.png",
|
|
||||||
language: "py",
|
|
||||||
code: codes[3],
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
name: "cURL",
|
|
||||||
mode: "bash",
|
|
||||||
image: "https://curl.se/logo/curl-symbol-transparent.png",
|
|
||||||
language: "sh",
|
|
||||||
code: codes[0],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Python API",
|
|
||||||
mode: "python",
|
|
||||||
image:
|
|
||||||
"https://images.squarespace-cdn.com/content/v1/5df3d8c5d2be5962e4f87890/1628015119369-OY4TV3XJJ53ECO0W2OLQ/Python+API+Training+Logo.png?format=1000w",
|
|
||||||
language: "py",
|
|
||||||
code: codes[1],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Python Code",
|
|
||||||
mode: "python",
|
|
||||||
language: "py",
|
|
||||||
image: "https://cdn-icons-png.flaticon.com/512/5968/5968350.png",
|
|
||||||
code: codes[2],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Chat Widget HTML",
|
|
||||||
description:
|
|
||||||
"Insert this code anywhere in your <body> tag. To use with react and other libs, check our <a class='link-color' href='https://langflow.org/guidelines/widget'>documentation</a>.",
|
|
||||||
mode: "html",
|
|
||||||
image: "https://cdn-icons-png.flaticon.com/512/5968/5968350.png",
|
|
||||||
language: "py",
|
|
||||||
code: codes[3],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Tweaks",
|
|
||||||
mode: "python",
|
|
||||||
image: "https://cdn-icons-png.flaticon.com/512/5968/5968350.png",
|
|
||||||
language: "py",
|
|
||||||
code: codes[4],
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ import {
|
||||||
getPythonApiCode,
|
getPythonApiCode,
|
||||||
getPythonCode,
|
getPythonCode,
|
||||||
getWidgetCode,
|
getWidgetCode,
|
||||||
|
tabsArray,
|
||||||
} from "../../utils/utils";
|
} from "../../utils/utils";
|
||||||
import BaseModal from "../baseModal";
|
import BaseModal from "../baseModal";
|
||||||
|
|
||||||
|
|
@ -48,39 +49,8 @@ const ApiModal = forwardRef(
|
||||||
const pythonCode = getPythonCode(flow, tweak.current, tabsState);
|
const pythonCode = getPythonCode(flow, tweak.current, tabsState);
|
||||||
const widgetCode = getWidgetCode(flow, tabsState);
|
const widgetCode = getWidgetCode(flow, tabsState);
|
||||||
const tweaksCode = buildTweaks(flow);
|
const tweaksCode = buildTweaks(flow);
|
||||||
const [tabs, setTabs] = useState([
|
const codesArray = [curl_code, pythonApiCode, pythonCode, widgetCode, pythonCode];
|
||||||
{
|
const [tabs, setTabs] = useState(tabsArray(codesArray, 0));
|
||||||
name: "cURL",
|
|
||||||
mode: "bash",
|
|
||||||
image: "https://curl.se/logo/curl-symbol-transparent.png",
|
|
||||||
language: "sh",
|
|
||||||
code: curl_code,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Python API",
|
|
||||||
mode: "python",
|
|
||||||
image:
|
|
||||||
"https://images.squarespace-cdn.com/content/v1/5df3d8c5d2be5962e4f87890/1628015119369-OY4TV3XJJ53ECO0W2OLQ/Python+API+Training+Logo.png?format=1000w",
|
|
||||||
language: "py",
|
|
||||||
code: pythonApiCode,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Python Code",
|
|
||||||
mode: "python",
|
|
||||||
image: "https://cdn-icons-png.flaticon.com/512/5968/5968350.png",
|
|
||||||
language: "py",
|
|
||||||
code: pythonCode,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Chat Widget HTML",
|
|
||||||
description:
|
|
||||||
"Insert this code anywhere in your <body> tag. To use with react and other libs, check our <a class='link-color' href='https://docs.langflow.org/guidelines/widget'>documentation</a>.",
|
|
||||||
mode: "html",
|
|
||||||
image: "https://cdn-icons-png.flaticon.com/512/5968/5968350.png",
|
|
||||||
language: "py",
|
|
||||||
code: widgetCode,
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
|
|
||||||
function startState() {
|
function startState() {
|
||||||
tweak.current = [];
|
tweak.current = [];
|
||||||
|
|
@ -101,80 +71,9 @@ const ApiModal = forwardRef(
|
||||||
|
|
||||||
if (Object.keys(tweaksCode).length > 0) {
|
if (Object.keys(tweaksCode).length > 0) {
|
||||||
setActiveTab("0");
|
setActiveTab("0");
|
||||||
setTabs([
|
setTabs(tabsArray(codesArray, 1));
|
||||||
{
|
|
||||||
name: "cURL",
|
|
||||||
mode: "bash",
|
|
||||||
image: "https://curl.se/logo/curl-symbol-transparent.png",
|
|
||||||
language: "sh",
|
|
||||||
code: curl_code,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Python API",
|
|
||||||
mode: "python",
|
|
||||||
image:
|
|
||||||
"https://images.squarespace-cdn.com/content/v1/5df3d8c5d2be5962e4f87890/1628015119369-OY4TV3XJJ53ECO0W2OLQ/Python+API+Training+Logo.png?format=1000w",
|
|
||||||
language: "py",
|
|
||||||
code: pythonApiCode,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Python Code",
|
|
||||||
mode: "python",
|
|
||||||
language: "py",
|
|
||||||
image: "https://cdn-icons-png.flaticon.com/512/5968/5968350.png",
|
|
||||||
code: pythonCode,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Chat Widget HTML",
|
|
||||||
description:
|
|
||||||
"Insert this code anywhere in your <body> tag. To use with react and other libs, check our <a class='link-color' href='https://docs.langflow.org/guidelines/widget'>documentation</a>.",
|
|
||||||
mode: "html",
|
|
||||||
image: "https://cdn-icons-png.flaticon.com/512/5968/5968350.png",
|
|
||||||
language: "py",
|
|
||||||
code: widgetCode,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Tweaks",
|
|
||||||
mode: "python",
|
|
||||||
image: "https://cdn-icons-png.flaticon.com/512/5968/5968350.png",
|
|
||||||
language: "py",
|
|
||||||
code: pythonCode,
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
} else {
|
} else {
|
||||||
setTabs([
|
setTabs(tabsArray(codesArray, 1));
|
||||||
{
|
|
||||||
name: "cURL",
|
|
||||||
mode: "bash",
|
|
||||||
image: "https://curl.se/logo/curl-symbol-transparent.png",
|
|
||||||
language: "sh",
|
|
||||||
code: curl_code,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Python API",
|
|
||||||
mode: "python",
|
|
||||||
image:
|
|
||||||
"https://images.squarespace-cdn.com/content/v1/5df3d8c5d2be5962e4f87890/1628015119369-OY4TV3XJJ53ECO0W2OLQ/Python+API+Training+Logo.png?format=1000w",
|
|
||||||
language: "py",
|
|
||||||
code: pythonApiCode,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Python Code",
|
|
||||||
mode: "python",
|
|
||||||
image: "https://cdn-icons-png.flaticon.com/512/5968/5968350.png",
|
|
||||||
language: "py",
|
|
||||||
code: pythonCode,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Chat Widget HTML",
|
|
||||||
description:
|
|
||||||
"Insert this code anywhere in your <body> tag. To use with react and other libs, check our <a class='link-color' href='https://docs.langflow.org/guidelines/widget'>documentation</a>.",
|
|
||||||
mode: "html",
|
|
||||||
image: "https://cdn-icons-png.flaticon.com/512/5968/5968350.png",
|
|
||||||
language: "py",
|
|
||||||
code: widgetCode,
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
}, [flow["data"]["nodes"], open]);
|
}, [flow["data"]["nodes"], open]);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -410,3 +410,82 @@ chat_input_field: Input key that you want the chat to send the user message with
|
||||||
}host_url="http://localhost:7860"
|
}host_url="http://localhost:7860"
|
||||||
></langflow-chat>`;
|
></langflow-chat>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function tabsArray(codes: string[], method: number) {
|
||||||
|
if (!method) return;
|
||||||
|
if (method === 0) {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
name: "cURL",
|
||||||
|
mode: "bash",
|
||||||
|
image: "https://curl.se/logo/curl-symbol-transparent.png",
|
||||||
|
language: "sh",
|
||||||
|
code: codes[0],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Python API",
|
||||||
|
mode: "python",
|
||||||
|
image:
|
||||||
|
"https://images.squarespace-cdn.com/content/v1/5df3d8c5d2be5962e4f87890/1628015119369-OY4TV3XJJ53ECO0W2OLQ/Python+API+Training+Logo.png?format=1000w",
|
||||||
|
language: "py",
|
||||||
|
code: codes[1],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Python Code",
|
||||||
|
mode: "python",
|
||||||
|
image: "https://cdn-icons-png.flaticon.com/512/5968/5968350.png",
|
||||||
|
language: "py",
|
||||||
|
code: codes[2],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Chat Widget HTML",
|
||||||
|
description:
|
||||||
|
"Insert this code anywhere in your <body> tag. To use with react and other libs, check our <a class='link-color' href='https://langflow.org/guidelines/widget'>documentation</a>.",
|
||||||
|
mode: "html",
|
||||||
|
image: "https://cdn-icons-png.flaticon.com/512/5968/5968350.png",
|
||||||
|
language: "py",
|
||||||
|
code: codes[3],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
name: "cURL",
|
||||||
|
mode: "bash",
|
||||||
|
image: "https://curl.se/logo/curl-symbol-transparent.png",
|
||||||
|
language: "sh",
|
||||||
|
code: codes[0],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Python API",
|
||||||
|
mode: "python",
|
||||||
|
image:
|
||||||
|
"https://images.squarespace-cdn.com/content/v1/5df3d8c5d2be5962e4f87890/1628015119369-OY4TV3XJJ53ECO0W2OLQ/Python+API+Training+Logo.png?format=1000w",
|
||||||
|
language: "py",
|
||||||
|
code: codes[1],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Python Code",
|
||||||
|
mode: "python",
|
||||||
|
language: "py",
|
||||||
|
image: "https://cdn-icons-png.flaticon.com/512/5968/5968350.png",
|
||||||
|
code: codes[2],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Chat Widget HTML",
|
||||||
|
description:
|
||||||
|
"Insert this code anywhere in your <body> tag. To use with react and other libs, check our <a class='link-color' href='https://langflow.org/guidelines/widget'>documentation</a>.",
|
||||||
|
mode: "html",
|
||||||
|
image: "https://cdn-icons-png.flaticon.com/512/5968/5968350.png",
|
||||||
|
language: "py",
|
||||||
|
code: codes[3],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Tweaks",
|
||||||
|
mode: "python",
|
||||||
|
image: "https://cdn-icons-png.flaticon.com/512/5968/5968350.png",
|
||||||
|
language: "py",
|
||||||
|
code: codes[4],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue