@devvibex/aiflow 1.0.6 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/index.d.ts +14 -0
- package/src/index.js +10 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devvibex/aiflow",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "First-party LLM gateway SDK for apps generated on the VibeX platform — chat, streaming, image generation and embeddings without shipping any third-party API key.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
package/src/index.d.ts
CHANGED
|
@@ -81,6 +81,17 @@ export interface ImageRequest {
|
|
|
81
81
|
n?: number;
|
|
82
82
|
image?: string;
|
|
83
83
|
images?: string[];
|
|
84
|
+
/**
|
|
85
|
+
* System prompt for image generation/editing (e.g. a translation
|
|
86
|
+
* instruction). When omitted, the server-configured `systemPrompt` is used.
|
|
87
|
+
* Prepended to `prompt` server-side since image models take a single prompt.
|
|
88
|
+
*/
|
|
89
|
+
system?: string;
|
|
90
|
+
/**
|
|
91
|
+
* Target language for translation-style image editing. Replaces any
|
|
92
|
+
* `{{language}}` placeholder in the system/user prompt server-side.
|
|
93
|
+
*/
|
|
94
|
+
language?: string;
|
|
84
95
|
signal?: AbortSignal;
|
|
85
96
|
}
|
|
86
97
|
|
|
@@ -102,6 +113,7 @@ export interface VideoRequest {
|
|
|
102
113
|
model?: string;
|
|
103
114
|
aspectRatio?: '16:9' | '9:16' | '1:1' | string;
|
|
104
115
|
image?: string;
|
|
116
|
+
video?: string;
|
|
105
117
|
signal?: AbortSignal;
|
|
106
118
|
}
|
|
107
119
|
|
|
@@ -183,6 +195,8 @@ export interface AiflowConfig {
|
|
|
183
195
|
maxEmbedInputs: number;
|
|
184
196
|
};
|
|
185
197
|
creditValue: number;
|
|
198
|
+
/** Module-configured default system prompt, or null if none. */
|
|
199
|
+
systemPrompt?: string | null;
|
|
186
200
|
}
|
|
187
201
|
|
|
188
202
|
export class AIFlowClient {
|
package/src/index.js
CHANGED
|
@@ -246,6 +246,8 @@ export class AIFlowClient {
|
|
|
246
246
|
n = 1,
|
|
247
247
|
image,
|
|
248
248
|
images,
|
|
249
|
+
system,
|
|
250
|
+
language,
|
|
249
251
|
signal,
|
|
250
252
|
} = {}) {
|
|
251
253
|
if (!prompt || typeof prompt !== 'string') {
|
|
@@ -253,6 +255,10 @@ export class AIFlowClient {
|
|
|
253
255
|
}
|
|
254
256
|
const resolvedModel =
|
|
255
257
|
model || (await this._resolveDefaultModel('image'));
|
|
258
|
+
// Resolve the system prompt: user-provided > server config > null,
|
|
259
|
+
// mirroring chat(). The server prepends it to the prompt and injects
|
|
260
|
+
// the dynamic `language` into any {{language}} placeholder.
|
|
261
|
+
const resolvedSystem = await this._resolveSystemPrompt(system);
|
|
256
262
|
const res = await this._request(
|
|
257
263
|
'/image',
|
|
258
264
|
{
|
|
@@ -262,6 +268,8 @@ export class AIFlowClient {
|
|
|
262
268
|
n,
|
|
263
269
|
image,
|
|
264
270
|
images,
|
|
271
|
+
system: resolvedSystem,
|
|
272
|
+
language,
|
|
265
273
|
},
|
|
266
274
|
{ signal },
|
|
267
275
|
);
|
|
@@ -277,6 +285,7 @@ export class AIFlowClient {
|
|
|
277
285
|
model,
|
|
278
286
|
aspectRatio = '16:9',
|
|
279
287
|
image,
|
|
288
|
+
video,
|
|
280
289
|
signal,
|
|
281
290
|
} = {}) {
|
|
282
291
|
if (!prompt || typeof prompt !== 'string') {
|
|
@@ -291,6 +300,7 @@ export class AIFlowClient {
|
|
|
291
300
|
prompt,
|
|
292
301
|
aspectRatio,
|
|
293
302
|
image,
|
|
303
|
+
video,
|
|
294
304
|
},
|
|
295
305
|
{ signal },
|
|
296
306
|
);
|