From a68f412d4139294b209ac12442a626eab4479f2b Mon Sep 17 00:00:00 2001 From: Vignesh Aigal Date: Fri, 8 Sep 2023 15:58:30 -0700 Subject: [PATCH] Fix API examples page --- client/src/components/apps/AppApiExamples.jsx | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/client/src/components/apps/AppApiExamples.jsx b/client/src/components/apps/AppApiExamples.jsx index a2576ee0fe5..8ad82b0b4b3 100644 --- a/client/src/components/apps/AppApiExamples.jsx +++ b/client/src/components/apps/AppApiExamples.jsx @@ -32,8 +32,8 @@ url = '${window.location.origin}/api/apps/${app?.uuid}/run' payload = { "input": { - ${Object.keys(app?.input_schema?.properties || {}) - .map((k) => `"${k}": "<${k}_value>"`) + ${app?.data.input_fields + .map(({ name }) => `"${name}": "<${name}_value>"`) .join(",\n ")} }, "stream": False, @@ -53,8 +53,8 @@ url = '${window.location.origin}/api/apps/${app?.uuid}/run' payload = { "input": { - ${Object.keys(app?.input_schema?.properties || {}) - .map((k) => `"${k}": "<${k}_value>"`) + ${app?.data.input_fields + .map(({ name }) => `"${name}": "<${name}_value>"`) .join(",\n ")} }, "stream": True, @@ -75,8 +75,8 @@ for line in response.iter_lines(): --header 'Authorization: Token ${profile?.token}' \\ --data-raw '{ "input": { - ${Object.keys(app?.input_schema?.properties || {}) - .map((k) => `"${k}": "<${k}_value>"`) + ${app?.data.input_fields + .map(({ name }) => `"${name}": "<${name}_value>"`) .join(",\n ")} }, "stream": false @@ -88,8 +88,8 @@ for line in response.iter_lines(): --header 'Authorization: Token ${profile?.token}' \\ --data-raw '{ "input": { - ${Object.keys(app?.input_schema?.properties || {}) - .map((k) => `"${k}": "<${k}_value>"`) + ${app?.data.input_fields + .map(({ name }) => `"${name}": "<${name}_value>"`) .join(",\n ")} }, "stream": true @@ -101,8 +101,8 @@ const url = '${window.location.origin}/api/apps/${app?.uuid}/run'; const PROMPTLY_TOKEN = '${profile?.token}'; const payload = { "input": { - ${Object.keys(app?.input_schema?.properties || {}) - .map((k) => `"${k}": "<${k}_value>"`) + ${app?.data.input_fields + .map(({ name }) => `"${name}": "<${name}_value>"`) .join(",\n ")} }, "stream": false, @@ -124,8 +124,8 @@ const url = '${window.location.origin}/api/apps/${app?.uuid}/run'; const PROMPTLY_TOKEN = '${profile?.token}'; const payload = { "input": { - ${Object.keys(app?.input_schema?.properties || {}) - .map((k) => `"${k}": "<${k}_value>"`) + ${app?.data.input_fields + .map(({ name }) => `"${name}": "<${name}_value>"`) .join(",\n ")} }, "stream": true,