style(ApiModal): fix indentation in SyntaxHighlighter className prop
refactor(ApiModal): add json import to pythonApiCode to fix json.loads error
This commit is contained in:
parent
5049e59530
commit
aac72b894a
1 changed files with 3 additions and 2 deletions
|
|
@ -45,6 +45,7 @@ export default function ApiModal({ flowName }) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const pythonApiCode = `import requests
|
const pythonApiCode = `import requests
|
||||||
|
import json
|
||||||
|
|
||||||
API_URL = "${window.location.protocol}//${window.location.host}/predict"
|
API_URL = "${window.location.protocol}//${window.location.host}/predict"
|
||||||
|
|
||||||
|
|
@ -57,7 +58,7 @@ def predict(message):
|
||||||
|
|
||||||
print(predict("Your message"))`;
|
print(predict("Your message"))`;
|
||||||
|
|
||||||
const pythonCode = `from langflow import load_flow_from_json
|
const pythonCode = `from langflow import load_flow_from_json
|
||||||
|
|
||||||
flow = load_flow_from_json("${flowName}.json")
|
flow = load_flow_from_json("${flowName}.json")
|
||||||
# Now you can use it like any chain
|
# Now you can use it like any chain
|
||||||
|
|
@ -165,7 +166,7 @@ flow("Hey, have you heard of LangFlow?")`;
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<SyntaxHighlighter
|
<SyntaxHighlighter
|
||||||
className="h-[370px]"
|
className="h-[370px]"
|
||||||
language={tabs[activeTab].mode}
|
language={tabs[activeTab].mode}
|
||||||
style={oneDark}
|
style={oneDark}
|
||||||
customStyle={{ margin: 0 }}
|
customStyle={{ margin: 0 }}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue