@rimori/client 2.5.37-next.1 → 2.5.37-next.2

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.
@@ -110,6 +110,19 @@ export declare class AIModule {
110
110
  * A warning is logged to the console in this case.
111
111
  */
112
112
  getVoice(text: string, voice?: string, speed?: number, language?: string, cache?: boolean, instructions?: string): Promise<Blob>;
113
+ /**
114
+ * Generate an image from a text prompt using AI.
115
+ * @param params.prompt The prompt describing the image to generate.
116
+ * @param params.cache Whether to cache the result by prompt hash (default: true).
117
+ * @returns `{ url, cached }` where `url` is either a data URL or a stored CDN URL.
118
+ */
119
+ getImage(params: {
120
+ prompt: string;
121
+ cache?: boolean;
122
+ }): Promise<{
123
+ url: string;
124
+ cached: boolean;
125
+ }>;
113
126
  /**
114
127
  * Convert voice audio to text using AI.
115
128
  * @param file The audio file to convert.
@@ -115,6 +115,27 @@ export class AIModule {
115
115
  }),
116
116
  }).then((r) => r.blob());
117
117
  }
118
+ /**
119
+ * Generate an image from a text prompt using AI.
120
+ * @param params.prompt The prompt describing the image to generate.
121
+ * @param params.cache Whether to cache the result by prompt hash (default: true).
122
+ * @returns `{ url, cached }` where `url` is either a data URL or a stored CDN URL.
123
+ */
124
+ async getImage(params) {
125
+ const { prompt, cache = true } = params;
126
+ const response = await this.controller.fetchBackend('/ai/image', {
127
+ method: 'POST',
128
+ body: JSON.stringify({
129
+ prompt,
130
+ cache,
131
+ session_token_id: this.sessionTokenId ?? undefined,
132
+ }),
133
+ });
134
+ if (!response.ok) {
135
+ throw new Error(`Failed to generate image: ${response.status} ${response.statusText}`);
136
+ }
137
+ return response.json();
138
+ }
118
139
  /**
119
140
  * Convert voice audio to text using AI.
120
141
  * @param file The audio file to convert.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rimori/client",
3
- "version": "2.5.37-next.1",
3
+ "version": "2.5.37-next.2",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "repository": {