@axiom-lattice/react-sdk 2.1.118 → 2.1.119

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/dist/index.mjs CHANGED
@@ -16997,7 +16997,7 @@ function useVoiceRecorder(options) {
16997
16997
  setState((prev) => ({
16998
16998
  ...prev,
16999
16999
  status: "idle",
17000
- error: { type: "not_supported", message: "\u5F53\u524D\u6D4F\u89C8\u5668\u4E0D\u652F\u6301\u8BED\u97F3\u8F93\u5165\uFF0C\u8BF7\u4F7F\u7528 Chrome/Edge/Safari" }
17000
+ error: { type: "not_supported", message: "Voice input not supported. Use Chrome, Edge, or Safari." }
17001
17001
  }));
17002
17002
  return;
17003
17003
  }
@@ -17016,7 +17016,7 @@ function useVoiceRecorder(options) {
17016
17016
  setState((prev) => ({
17017
17017
  ...prev,
17018
17018
  status: "idle",
17019
- error: { type: "not_supported", message: "\u5F53\u524D\u6D4F\u89C8\u5668\u4E0D\u652F\u6301\u8BED\u97F3\u5F55\u97F3\u683C\u5F0F" }
17019
+ error: { type: "not_supported", message: "Audio recording format not supported in this browser." }
17020
17020
  }));
17021
17021
  return;
17022
17022
  }
@@ -17089,7 +17089,7 @@ function useVoiceRecorder(options) {
17089
17089
  }).catch((err) => {
17090
17090
  if (!cleanedRef.current) {
17091
17091
  console.error("STT auto upload failed:", err);
17092
- const errorMessage = err instanceof Error ? err.message : "\u8F6C\u5199\u5931\u8D25";
17092
+ const errorMessage = err instanceof Error ? err.message : "Transcription failed";
17093
17093
  setState((prev) => ({
17094
17094
  ...prev,
17095
17095
  error: { type: "upload_failed", message: errorMessage }
@@ -17133,7 +17133,7 @@ function useVoiceRecorder(options) {
17133
17133
  setState((prev) => ({
17134
17134
  ...prev,
17135
17135
  status: "idle",
17136
- error: { type: "recorder_error", message: "\u5F55\u97F3\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5" }
17136
+ error: { type: "recorder_error", message: "Recording failed, please try again." }
17137
17137
  }));
17138
17138
  };
17139
17139
  recorder.start(timeslice);
@@ -17142,7 +17142,7 @@ function useVoiceRecorder(options) {
17142
17142
  setState((prev) => ({
17143
17143
  ...prev,
17144
17144
  status: "idle",
17145
- error: { type: "recorder_error", message: "\u5F55\u97F3\u521D\u59CB\u5316\u5931\u8D25" }
17145
+ error: { type: "recorder_error", message: "Recording initialization failed." }
17146
17146
  }));
17147
17147
  return;
17148
17148
  }
@@ -17173,7 +17173,7 @@ function useVoiceRecorder(options) {
17173
17173
  status: "idle",
17174
17174
  error: {
17175
17175
  type: "permission_denied",
17176
- message: isPermission ? "\u8BF7\u5728\u6D4F\u89C8\u5668\u8BBE\u7F6E\u4E2D\u5141\u8BB8\u9EA6\u514B\u98CE\u8BBF\u95EE" : "\u65E0\u6CD5\u8BBF\u95EE\u9EA6\u514B\u98CE"
17176
+ message: isPermission ? "Please allow microphone access in browser settings" : "Cannot access microphone"
17177
17177
  }
17178
17178
  }));
17179
17179
  }
@@ -17191,7 +17191,7 @@ function useVoiceRecorder(options) {
17191
17191
  ...prev,
17192
17192
  status: "idle",
17193
17193
  voiceLevel: 0,
17194
- error: { type: "upload_failed", message: "\u505C\u6B62\u5F55\u97F3\u8D85\u65F6" }
17194
+ error: { type: "upload_failed", message: "Stop recording timed out" }
17195
17195
  }));
17196
17196
  }, 1e4);
17197
17197
  }, [cleanupAudio]);
@@ -17228,7 +17228,7 @@ function useVoiceRecorder(options) {
17228
17228
  setState((prev) => ({ ...prev, status: "idle", voiceLevel: 0 }));
17229
17229
  } catch (err) {
17230
17230
  console.error("[STT] upload failed:", err);
17231
- const message39 = err instanceof Error ? err.message : "\u8F6C\u5199\u5931\u8D25";
17231
+ const message39 = err instanceof Error ? err.message : "Transcription failed";
17232
17232
  cleanupAudio();
17233
17233
  setState((prev) => ({
17234
17234
  ...prev,
@@ -17258,7 +17258,7 @@ function useVoiceRecorder(options) {
17258
17258
  if (text) onTranscriptionRef.current(text);
17259
17259
  setState((prev) => ({ ...prev, status: "idle", voiceLevel: 0 }));
17260
17260
  } catch (err) {
17261
- const message39 = err instanceof Error ? err.message : "\u91CD\u8BD5\u5931\u8D25";
17261
+ const message39 = err instanceof Error ? err.message : "Retry failed";
17262
17262
  setState((prev) => ({
17263
17263
  ...prev,
17264
17264
  status: "idle",
@@ -23473,25 +23473,25 @@ var VoiceInputButton = ({
23473
23473
  };
23474
23474
  const isBusy = isUploading || isRequesting;
23475
23475
  const getAriaLabel = () => {
23476
- if (noSttModel) return "\u8BED\u97F3\u8F93\u5165\u4E0D\u53EF\u7528\uFF1A\u672A\u914D\u7F6E\u8BED\u97F3\u8BC6\u522B\u6A21\u578B";
23477
- if (isBusy) return "\u8F6C\u5199\u4E2D";
23478
- if (hasError && isIdle) return isRetryableError ? "\u8F6C\u5199\u5931\u8D25, \u70B9\u51FB\u91CD\u8BD5" : "\u70B9\u51FB\u91CD\u65B0\u5F55\u97F3";
23479
- if (isRecording) return state.mode === "auto" ? `\u505C\u6B62\u5F55\u97F3\uFF08${state.duration}\u79D2, \u5DF2\u8F6C\u5199${state.partialTexts.length}\u6BB5\uFF09` : `\u505C\u6B62\u5F55\u97F3\uFF08${state.duration}\u79D2\uFF09`;
23480
- return "\u5F00\u59CB\u8BED\u97F3\u8F93\u5165";
23476
+ if (noSttModel) return "Voice input unavailable: No STT model configured";
23477
+ if (isBusy) return "Transcribing...";
23478
+ if (hasError && isIdle) return isRetryableError ? "Transcription failed, tap to retry" : "Tap to re-record";
23479
+ if (isRecording) return state.mode === "auto" ? `Stop recording (${state.duration}s, ${state.partialTexts.length} segments transcribed)` : `Stop recording (${state.duration}s)`;
23480
+ return "Start voice input";
23481
23481
  };
23482
23482
  const getTitle = () => {
23483
- if (noSttModel) return "\u672A\u914D\u7F6E\u8BED\u97F3\u8BC6\u522B\u6A21\u578B";
23484
- if (isBusy) return "\u4E0A\u4F20\u4E2D...";
23485
- if (hasError && isIdle) return isRetryableError ? "\u8F6C\u5199\u5931\u8D25\uFF0C\u70B9\u51FB\u91CD\u8BD5" : "\u70B9\u51FB\u91CD\u65B0\u5F55\u97F3";
23483
+ if (noSttModel) return "No STT model configured";
23484
+ if (isBusy) return "Uploading...";
23485
+ if (hasError && isIdle) return isRetryableError ? "Transcription failed, tap to retry" : "Tap to re-record";
23486
23486
  if (isRecording) {
23487
23487
  const mins = Math.floor(state.duration / 60);
23488
23488
  const secs = state.duration % 60;
23489
23489
  const time = `${String(mins).padStart(2, "0")}:${String(secs).padStart(2, "0")}`;
23490
- const mode = isAutoMode ? "\u81EA\u52A8" : "\u624B\u52A8";
23491
- const chunks = state.partialTexts.length > 0 ? ` \u5DF2\u8F6C\u5199${state.partialTexts.length}\u6BB5` : "";
23492
- return `${mode}\u6A21\u5F0F \u5F55\u97F3\u4E2D ${time}${chunks} \u2014 \u70B9\u51FB\u505C\u6B62`;
23490
+ const mode = isAutoMode ? "Auto" : "Manual";
23491
+ const chunks = state.partialTexts.length > 0 ? ` ${state.partialTexts.length} segments` : "";
23492
+ return `${mode} mode, recording ${time}${chunks} \u2014 tap to stop`;
23493
23493
  }
23494
- return "\u5F00\u59CB\u8BED\u97F3\u8F93\u5165";
23494
+ return "Start voice input";
23495
23495
  };
23496
23496
  return /* @__PURE__ */ jsx91(
23497
23497
  Button47,