@rimori/client 2.5.20 → 2.5.21-next.0

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.
@@ -1,4 +1,4 @@
1
- type VoiceBackend = (text: string, voice?: string, speed?: number, language?: string, cache?: boolean) => Promise<Blob>;
1
+ type VoiceBackend = (text: string, voice?: string, speed?: number, language?: string, cache?: boolean, instructions?: string) => Promise<Blob>;
2
2
  export declare class MessageSender {
3
3
  private player;
4
4
  private fetchedSentences;
@@ -7,9 +7,11 @@ export declare class MessageSender {
7
7
  private voiceBackend;
8
8
  private cache;
9
9
  private voiceSpeed;
10
+ private instructions;
10
11
  constructor(voiceBackend: VoiceBackend, voice: string, cache?: boolean);
11
12
  private getCompletedSentences;
12
13
  handleNewText(currentText: string | undefined, isLoading: boolean): Promise<void>;
14
+ setInstructions(instructions: string | undefined): void;
13
15
  private generateSpeech;
14
16
  play(): void;
15
17
  stop(): void;
@@ -62,9 +62,12 @@ export class MessageSender {
62
62
  }
63
63
  });
64
64
  }
65
+ setInstructions(instructions) {
66
+ this.instructions = instructions;
67
+ }
65
68
  generateSpeech(sentence) {
66
69
  return __awaiter(this, void 0, void 0, function* () {
67
- const blob = yield this.voiceBackend(sentence, this.voice, this.voiceSpeed, undefined, this.cache);
70
+ const blob = yield this.voiceBackend(sentence, this.voice, this.voiceSpeed, undefined, this.cache, this.instructions);
68
71
  return yield blob.arrayBuffer();
69
72
  });
70
73
  }
@@ -104,7 +104,7 @@ export declare class AIModule {
104
104
  * @param cache Whether to cache the result (default: false).
105
105
  * @returns The generated audio as a Blob.
106
106
  */
107
- getVoice(text: string, voice?: string, speed?: number, language?: string, cache?: boolean): Promise<Blob>;
107
+ getVoice(text: string, voice?: string, speed?: number, language?: string, cache?: boolean, instructions?: string): Promise<Blob>;
108
108
  /**
109
109
  * Convert voice audio to text using AI.
110
110
  * @param file The audio file to convert.
@@ -120,7 +120,7 @@ export class AIModule {
120
120
  * @returns The generated audio as a Blob.
121
121
  */
122
122
  getVoice(text_1) {
123
- return __awaiter(this, arguments, void 0, function* (text, voice = 'alloy', speed = 1, language, cache = false) {
123
+ return __awaiter(this, arguments, void 0, function* (text, voice = 'alloy', speed = 1, language, cache = false, instructions) {
124
124
  var _a;
125
125
  yield this.session.ensure();
126
126
  return yield fetch(`${this.backendUrl}/voice/tts`, {
@@ -129,7 +129,7 @@ export class AIModule {
129
129
  'Content-Type': 'application/json',
130
130
  Authorization: `Bearer ${this.getToken()}`,
131
131
  },
132
- body: JSON.stringify({ input: text, voice, speed, language, cache, session_token_id: (_a = this.sessionTokenId) !== null && _a !== void 0 ? _a : undefined }),
132
+ body: JSON.stringify({ input: text, voice, speed, language, cache, instructions, session_token_id: (_a = this.sessionTokenId) !== null && _a !== void 0 ? _a : undefined }),
133
133
  }).then((r) => r.blob());
134
134
  });
135
135
  }
@@ -171,4 +171,11 @@ export interface UserInfo {
171
171
  * Order (ascending): anonymous < free < standard < premium < early_access
172
172
  */
173
173
  subscription_tier: SubscriptionTier;
174
+ /**
175
+ * Regional dialect name for the user's target city (e.g. "Skånska", "Göteborgska").
176
+ * Only set when: subscription_tier >= premium AND skill_level_listening >= B1
177
+ * AND dialect_enabled = true AND city has a dialect in DB.
178
+ * Undefined otherwise. Plugins decide how to use this on a per-feature basis.
179
+ */
180
+ dialect?: string;
174
181
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rimori/client",
3
- "version": "2.5.20",
3
+ "version": "2.5.21-next.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "repository": {