fix: comfydeploy npm code display
This commit is contained in:
parent
967a77d3a3
commit
d4d7e98487
@ -69,13 +69,16 @@ const client = new ComfyDeployClient({
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
const jsClientCreateRunTemplate = `
|
const jsClientCreateRunTemplate = `
|
||||||
const { run_id } = await client.run("<ID>", {
|
const { run_id } = await client.run({
|
||||||
|
deployment_id: "<ID>",
|
||||||
inputs: {}
|
inputs: {}
|
||||||
});
|
});
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const jsClientCreateRunNoInputsTemplate = `
|
const jsClientCreateRunNoInputsTemplate = `
|
||||||
const { run_id } = await client.run("<ID>");
|
const { run_id } = await client.run({
|
||||||
|
deployment_id: "<ID>"
|
||||||
|
});
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const clientTemplate_checkStatus = `
|
const clientTemplate_checkStatus = `
|
||||||
@ -119,10 +122,7 @@ export function DeploymentDisplay({
|
|||||||
<TabsContent className="flex flex-col gap-2 !mt-0" value="client">
|
<TabsContent className="flex flex-col gap-2 !mt-0" value="client">
|
||||||
<div>
|
<div>
|
||||||
Install the node comfydeploy SDK
|
Install the node comfydeploy SDK
|
||||||
<CodeBlock
|
<CodeBlock lang="bash" code={`npm i comfydeploy`} />
|
||||||
lang="bash"
|
|
||||||
code={`npm i comfydeploy`}
|
|
||||||
/>
|
|
||||||
Initialize your client
|
Initialize your client
|
||||||
</div>
|
</div>
|
||||||
<CodeBlock
|
<CodeBlock
|
||||||
@ -197,20 +197,18 @@ function formatCode(
|
|||||||
if (inputs && inputs.length > 0) {
|
if (inputs && inputs.length > 0) {
|
||||||
codeTemplate = codeTemplate.replace(
|
codeTemplate = codeTemplate.replace(
|
||||||
"inputs: {}",
|
"inputs: {}",
|
||||||
`inputs: ${
|
`inputs: ${JSON.stringify(
|
||||||
JSON.stringify(
|
Object.fromEntries(
|
||||||
Object.fromEntries(
|
inputs.map((x) => {
|
||||||
inputs.map((x) => {
|
return [x?.input_id, ""];
|
||||||
return [x?.input_id, ""];
|
}),
|
||||||
}),
|
),
|
||||||
),
|
null,
|
||||||
null,
|
2,
|
||||||
2,
|
)
|
||||||
)
|
.split("\n")
|
||||||
.split("\n")
|
.map((line, index) => (index === 0 ? line : ` ${line}`)) // Add two spaces indentation except for the first line
|
||||||
.map((line, index) => (index === 0 ? line : ` ${line}`)) // Add two spaces indentation except for the first line
|
.join("\n")}`,
|
||||||
.join("\n")
|
|
||||||
}`,
|
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
codeTemplate = codeTemplate.replace(
|
codeTemplate = codeTemplate.replace(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user