Files
cozsweet-frontend-nextjs/src/data/models/chat/stt_data.ts
T
admin c22b90c7f4 feat: setup barrelsby for automatic barrel file generation
Add barrelsby as a dev dependency with a `generate-barrels` npm script and a `barrelesby.json` config targeting `./src`. This automates creation of barrel/index files to simplify imports across the project.
2026-06-08 13:07:37 +08:00

25 lines
574 B
TypeScript

/**
* STT(语音转文字)响应
* 原始 Dart: SttData (lib/data/models/chat/stt_response.dart)
*/
export class SttData {
readonly text: string;
constructor(params: { text: string }) {
this.text = params.text;
Object.freeze(this);
}
toJson(): Record<string, unknown> {
return { text: this.text };
}
static fromJson(json: Record<string, unknown>): SttData {
const text = json.text;
if (typeof text !== "string") {
throw new Error("SttData.text is required and must be a string");
}
return new SttData({ text });
}
}