You've already forked OpenIntegrations
mirror of
https://github.com/Bayselonarrend/OpenIntegrations.git
synced 2025-11-27 22:18:36 +02:00
81 lines
3.1 KiB
Plaintext
Vendored
81 lines
3.1 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://hut.openintegrations.dev/localai/";
|
|
Token = "12We...";
|
|
|
|
Model = "sd-1.5-ggml";
|
|
Description = OPI_OpenAI.GetImageDescriptionStructure("Yellow alpaca", 1, , "64x64");
|
|
Result = OPI_OpenAI.GetImages(URL, Token, Model, Description);
|
|
```
|
|
|
|
|
|
<Tabs>
|
|
|
|
<TabItem value="bash" label="Bash" default>
|
|
```bash
|
|
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
|
|
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": 1757982404,
|
|
"data": [
|
|
{
|
|
"revised_prompt": "An adorable, fluffy alpaca standing in a serene field. Its fur is the color of rich, vibrant yellow, appearing almost golden in the sunlight. The alpaca's gentle eyes and cute, rounded ears make it appear friendly and approachable. In the background, tall grasses and a cloudless blue sky portray a peaceful rural scene.",
|
|
"url": "https://oaidalleapiprodscus.blob.core.windows.net/private/org-vf0VrTZ44yHusk7vPGBYcYgW/user-HMyGZPKt7HooVlzCBP2dP9we/img-mcVZADShuw1V7jNhvLr4sGQ6.png?st=2025-09-15T23%3A26%3A44Z&se=2025-09-16T01%3A26%3A44Z&sp=r&sv=2024-08-04&sr=b&rscd=inline&rsct=image/png&skoid=ed3ea2f9-5e38-44be-9a1b-7c1e65e4d54f&sktid=a48cca56-e6da-484e-a814-9c849652bcb3&skt=2025-09-15T18%3A27%3A16Z&ske=2025-09-16T18%3A27%3A16Z&sks=b&skv=2024-08-04&sig=tSIPVLt4Wp1jFi4dZa%2BB%2BOdBpZOLgupNwosWvAmPMUc%3D"
|
|
}
|
|
]
|
|
}
|
|
```
|