@devvibex/aiflow 1.0.7 → 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 +13 -0
- package/src/index.js +8 -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
|
|
|
@@ -184,6 +195,8 @@ export interface AiflowConfig {
|
|
|
184
195
|
maxEmbedInputs: number;
|
|
185
196
|
};
|
|
186
197
|
creditValue: number;
|
|
198
|
+
/** Module-configured default system prompt, or null if none. */
|
|
199
|
+
systemPrompt?: string | null;
|
|
187
200
|
}
|
|
188
201
|
|
|
189
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
|
);
|