@space3-npm/cybersoul-client 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.
Files changed (2) hide show
  1. package/dist/client.js +15 -6
  2. package/package.json +1 -1
package/dist/client.js CHANGED
@@ -108,7 +108,7 @@ EMOTIONAL INERTIA RULES:
108
108
  const prompt = `${this.buildStateContextPrompt(state, params.interactParams?.localContext)}
109
109
 
110
110
  You are an AI image prompt director. Analyze the scene description according to the character's relationship stage and emotional inertia to determine the best image generation parameters.
111
- Output strictly valid JSON exactly matching this schema:
111
+ Output strictly valid JSON ONLY. No markdown, no conversational filler. Return exactly matching this schema:
112
112
  {
113
113
  ${this.getImageSchemaParams()}
114
114
  }`;
@@ -117,10 +117,11 @@ Output strictly valid JSON exactly matching this schema:
117
117
  ...(params.interactParams?.history || []),
118
118
  {
119
119
  role: "user",
120
- content: `Scene Description: "${params.sceneDescription}"`,
120
+ content: `Scene Description: "${params.sceneDescription}"\n\n**CRITICAL REMINDER**: You MUST output your final response exactly in the JSON format specified in the system prompt. DO NOT output plain text dialogue directly. For 'imageParams', ALL values MUST be in ENGLISH ONLY without exception, and you MUST use the exact English enum strings provided.`,
121
121
  },
122
122
  ];
123
123
  const llmRes = await this.llm.generate(promptMessages, 500, 0.4);
124
+ console.log("[CyberSoulClient ImageGen] Raw LLM Response:", llmRes);
124
125
  try {
125
126
  const parsedImageArgs = robustJsonParse(llmRes, "generateImage args fallback");
126
127
  imageParams = parsedImageArgs.imageParams || parsedImageArgs;
@@ -128,7 +129,10 @@ Output strictly valid JSON exactly matching this schema:
128
129
  catch (e) {
129
130
  imageParams = { mode: "full-prompt", full_prompt: params.sceneDescription }; // fallback to basic prompt
130
131
  }
131
- return this.generatePrimitive("image", imageParams);
132
+ const res = await this.generatePrimitive("image", imageParams);
133
+ return {
134
+ imageUrl: res.image_url,
135
+ };
132
136
  }
133
137
  /**
134
138
  * Manually synthesize voice audio outside of chat flow.
@@ -140,26 +144,31 @@ Output strictly valid JSON exactly matching this schema:
140
144
 
141
145
  You are a voice acting director. Analyze the text according to the character's relationship stage and emotional inertia to determine the single best emotion and a style instruction for TTS.
142
146
  Allowed emotions: "happy", "sad", "angry", "fearful", "disgusted", "surprised", "calm", "fluent", "whisper".
143
- Output strictly valid JSON in exactly this format: {"emotion": "chosen_emotion", "style_instruction": "How the line should be spoken"}`;
147
+ Output strictly valid JSON ONLY. No markdown, no conversational filler. Return exactly this format: {"emotion": "chosen_emotion", "style_instruction": "How the line should be spoken"}`;
144
148
  const promptMessages = [
145
149
  { role: "system", content: prompt },
146
150
  ...(params.interactParams?.history || []),
147
151
  {
148
152
  role: "user",
149
- content: `Text: "${params.text}"`,
153
+ content: `Text: "${params.text}"\n\n**CRITICAL REMINDER**: You MUST output your final response exactly in the JSON format specified in the system prompt. DO NOT output plain text dialogue directly.`,
150
154
  },
151
155
  ];
152
156
  const llmRes = await this.llm.generate(promptMessages, 300, 0.3);
157
+ console.log("[CyberSoulClient VoiceGen] Raw LLM Response:", llmRes);
153
158
  try {
154
159
  dynamicArgs = robustJsonParse(llmRes, "generateVoice args fallback");
155
160
  }
156
161
  catch (e) {
157
162
  dynamicArgs = {}; // fallback to empty
158
163
  }
159
- return this.generatePrimitive("voice", {
164
+ const res = await this.generatePrimitive("voice", {
160
165
  text: params.text,
161
166
  dynamicArgs,
162
167
  });
168
+ return {
169
+ audioUrl: res.audio_url,
170
+ durationSec: res.duration_sec,
171
+ };
163
172
  }
164
173
  /**
165
174
  * Gift a new outfit to the character's wardrobe inventory.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@space3-npm/cybersoul-client",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",