mirror of
https://github.com/aljazceru/dev-gpt.git
synced 2025-12-27 02:14:22 +01:00
👨💻 feat: example code in playground
This commit is contained in:
@@ -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 = '<your_deployment_id>';
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user