You've already forked OpenIntegrations
mirror of
https://github.com/Bayselonarrend/OpenIntegrations.git
synced 2025-11-25 22:12:29 +02:00
86 lines
3.5 KiB
Plaintext
Vendored
86 lines
3.5 KiB
Plaintext
Vendored
---
|
|
sidebar_position: 2
|
|
description: Get images and other functions to work with OpenAI in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
|
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, OpenAI]
|
|
---
|
|
|
|
import Tabs from '@theme/Tabs';
|
|
import TabItem from '@theme/TabItem';
|
|
|
|
# Get images
|
|
Generates images based on the specified description
|
|
|
|
|
|
|
|
`Function GetImages(Val URL, Val Token, Val Model, Val Description, Val AdditionalHeaders = "") Export`
|
|
|
|
| Parameter | CLI option | Type | Required | Description |
|
|
|-|-|-|-|-|
|
|
| URL | --url | String | ✔ | OpenAI server URL |
|
|
| Token | --token | String | ✔ | OpenAI authorization token |
|
|
| Model | --model | String | ✔ | Models name |
|
|
| Description | --descr | Structure Of KeyAndValue | ✔ | Generation parameters. See GetImageDescriptionStructure |
|
|
| AdditionalHeaders | --headers | Map Of KeyAndValue | ✖ | Additional request headers, if necessary |
|
|
|
|
|
|
Returns: Map Of KeyAndValue - Processing result
|
|
|
|
<br/>
|
|
|
|
:::tip
|
|
Method at API documentation: [Create image](https://platform.openai.com/docs/api-reference/images/create)
|
|
:::
|
|
<br/>
|
|
|
|
|
|
|
|
```bsl title="1C:Enterprise/OneScript code example"
|
|
URL = "https://bothub.chat/api/v2/openai/";
|
|
Token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjUzYTUwNWFiLTdhYmEtNDkyNy05YmQ0LTZlNDFlZGEyZGRmYyIsImlzRGV2Z...";
|
|
|
|
Model = "dall-e-3";
|
|
Description = OPI_OpenAI.GetImageDescriptionStructure("Yellow alpaca", 1, , "1024x1024");
|
|
Result = OPI_OpenAI.GetImages(URL, Token, Model, Description);
|
|
```
|
|
|
|
|
|
<Tabs>
|
|
|
|
<TabItem value="bash" label="Bash" default>
|
|
```bash
|
|
# JSON data can also be passed as a path to a .json file
|
|
|
|
oint openai GetImages \
|
|
--url "https://bothub.chat/api/v2/openai/" \
|
|
--token "***" \
|
|
--model "dall-e-3" \
|
|
--descr "{'prompt':'Yellow alpaca','n':1,'size':'1024x1024'}"
|
|
```
|
|
</TabItem>
|
|
|
|
<TabItem value="bat" label="CMD/Bat" default>
|
|
```batch
|
|
:: JSON data can also be passed as a path to a .json file
|
|
|
|
oint openai GetImages ^
|
|
--url "https://bothub.chat/api/v2/openai/" ^
|
|
--token "***" ^
|
|
--model "dall-e-3" ^
|
|
--descr "{'prompt':'Yellow alpaca','n':1,'size':'1024x1024'}"
|
|
```
|
|
</TabItem>
|
|
</Tabs>
|
|
|
|
|
|
```json title="Result"
|
|
{
|
|
"created": 1757709283,
|
|
"data": [
|
|
{
|
|
"revised_prompt": "Visualize a sunny, vibrant grassy plain under a clear blue sky. In the middle of this peaceful scene, a cuddly alpaca stands still. Its coat is full and fluffy, dyed with the most cheerful shade of yellow. Its ears are alert and pointed, and its eyes, hidden deep among the thick yellow fur, are as shiny and curious as black opals. The alpaca curiously gazes towards the viewer, emitting a sparkling aura of friendliness and warmth.",
|
|
"url": "https://oaidalleapiprodscus.blob.core.windows.net/private/org-vf0VrTZ44yHusk7vPGBYcYgW/user-HMyGZPKt7HooVlzCBP2dP9we/img-QeAYLUWLGFpQai5ppqosyr8l.png?st=2025-09-12T19%3A34%3A43Z&se=2025-09-12T21%3A34%3A43Z&sp=r&sv=2024-08-04&sr=b&rscd=inline&rsct=image/png&skoid=b1a0ae1f-618f-4548-84fd-8b16cacd5485&sktid=a48cca56-e6da-484e-a814-9c849652bcb3&skt=2025-09-12T10%3A34%3A08Z&ske=2025-09-13T10%3A34%3A08Z&sks=b&skv=2024-08-04&sig=7%2BJ6GguFsPgrJpYjhIn7hnE2cQXCsloUFtBd6tUHQ7w%3D"
|
|
}
|
|
]
|
|
}
|
|
```
|