From f19cce0ecad5cbc0a182c9a3495957516e906504 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Ho=CC=88nicke?= Date: Thu, 20 Apr 2023 13:40:05 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=A8=E2=80=8D=F0=9F=92=BB=20feat:=20exa?= =?UTF-8?q?mple=20code=20in=20playground?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/options/generate/templates_user.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/options/generate/templates_user.py b/src/options/generate/templates_user.py index 26fefc4..a54ebbc 100644 --- a/src/options/generate/templates_user.py +++ b/src/options/generate/templates_user.py @@ -297,6 +297,19 @@ The playground must look like it was made by a professional designer. All the ui elements are well thought out to make them visually appealing and easy to use. The playground contains many emojis that fit the theme of the playground and has an emoji as favicon. The playground encourages the user to deploy their own microservice by clicking on this link: https://github.com/jina-ai/gptdeploy +The playground provides a javascript code snippet that can be used to send requests to the executor. It looks like this: +```javascript +(async () => { + const deploymentId = ''; + const url = `https://gptdeploy-${deploymentId}.wolf.jina.ai/`; + const docArray = [{ text: '...' }]; + + const res = await fetch(url, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(docArray) }); + console.log((await res.json())[0].text); +})(); +``` +Make sure you put the right example data into the text attribute of the document. + This is an example how you can connect to the executor assuming the document (d) is already defined: ``` from jina import Client, Document, DocumentArray