Changed code to show how it is used.

This commit is contained in:
Lucas Oliveira 2023-07-26 15:37:18 -03:00
commit aeb7b91446

View file

@ -397,16 +397,20 @@ export function getWidgetCode(flow: FlowType, tabsState?: TabsState): string {
const flowName = flow.name; const flowName = flow.name;
const inputs = buildInputs(tabsState, flow.id); const inputs = buildInputs(tabsState, flow.id);
return `<script src="https://cdn.jsdelivr.net/gh/logspace-ai/langflow-embedded-chat@main/dist/build/static/js/bundle.min.js"></script> return `<!-- Insert this code anywhere in your <body> tag. To use with react, check our docs. -->
<langflow-chat window_title="${flowName}" <script src="https://cdn.jsdelivr.net/gh/logspace-ai/langflow-embedded-chat@main/dist/build/static/js/bundle.min.js"></script>
flow_id="${flowId}" <langflow-chat
${ window_title="${flowName}"
tabsState[flow.id] && tabsState[flow.id].formKeysData flow_id="${flowId}"
? `chat_inputs='${inputs}' ${
chat_input_field="${Object.keys(tabsState[flow.id].formKeysData.input_keys)[0]}" tabsState[flow.id] && tabsState[flow.id].formKeysData
` ? `chat_inputs='${inputs}'
: "" chat_input_field="${
}host_url="http://localhost:7860" Object.keys(tabsState[flow.id].formKeysData.input_keys)[0]
}"
`
: ""
}host_url="http://localhost:7860"
></langflow-chat>`; ></langflow-chat>`;
} }