refactor: trim qqbot utility exports · openclaw/openclaw@0ce0509
steipete
·
2026-05-01
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -21,7 +21,7 @@ type SilkWasm = typeof import("silk-wasm");
|
21 | 21 | let _silkWasmPromise: Promise<SilkWasm | null> | null = null; |
22 | 22 | |
23 | 23 | /** Lazy-load the silk-wasm module (singleton cache; returns null on failure). */ |
24 | | -export function loadSilkWasm(): Promise<SilkWasm | null> { |
| 24 | +function loadSilkWasm(): Promise<SilkWasm | null> { |
25 | 25 | if (_silkWasmPromise) { |
26 | 26 | return _silkWasmPromise; |
27 | 27 | } |
@@ -370,7 +370,7 @@ export async function waitForFile(
|
370 | 370 | } |
371 | 371 | |
372 | 372 | /** Encode PCM s16le data into SILK format. */ |
373 | | -export async function pcmToSilk( |
| 373 | +async function pcmToSilk( |
374 | 374 | pcmBuffer: Buffer, |
375 | 375 | sampleRate: number, |
376 | 376 | ): Promise<{ silkBuffer: Buffer; duration: number }> { |
@@ -387,7 +387,7 @@ export async function pcmToSilk(
|
387 | 387 | } |
388 | 388 | |
389 | 389 | /** Use ffmpeg to convert any audio to mono 24 kHz PCM s16le. */ |
390 | | -export function ffmpegToPCM( |
| 390 | +function ffmpegToPCM( |
391 | 391 | ffmpegCmd: string, |
392 | 392 | inputPath: string, |
393 | 393 | sampleRate: number = 24000, |
@@ -428,7 +428,7 @@ export function ffmpegToPCM(
|
428 | 428 | } |
429 | 429 | |
430 | 430 | /** Decode MP3 to PCM via mpg123-decoder WASM (fallback when ffmpeg is unavailable). */ |
431 | | -export async function wasmDecodeMp3ToPCM(buf: Buffer, targetRate: number): Promise<Buffer | null> { |
| 431 | +async function wasmDecodeMp3ToPCM(buf: Buffer, targetRate: number): Promise<Buffer | null> { |
432 | 432 | try { |
433 | 433 | const { MPEGDecoder } = await import("mpg123-decoder"); |
434 | 434 | debugLog(`[audio-convert] WASM MP3 decode: size=${buf.length} bytes`); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -17,7 +17,7 @@ import { getQQBotDataPath } from "./platform.js";
|
17 | 17 | * Normalise an identifier so it is safe to embed in a filename. |
18 | 18 | * Keeps alphanumerics, dot, underscore, dash; everything else becomes `_`. |
19 | 19 | */ |
20 | | -export function safeName(id: string): string { |
| 20 | +function safeName(id: string): string { |
21 | 21 | return id.replace(/[^a-zA-Z0-9._-]/g, "_"); |
22 | 22 | } |
23 | 23 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -16,7 +16,7 @@ export interface ImageSize {
|
16 | 16 | } |
17 | 17 | |
18 | 18 | /** Default dimensions used when probing fails. */ |
19 | | -export const DEFAULT_IMAGE_SIZE: ImageSize = { width: 512, height: 512 }; |
| 19 | +const DEFAULT_IMAGE_SIZE: ImageSize = { width: 512, height: 512 }; |
20 | 20 | |
21 | 21 | /** |
22 | 22 | * Parse image dimensions from the PNG header. |
@@ -199,7 +199,7 @@ export async function getImageSizeFromUrl(
|
199 | 199 | } |
200 | 200 | |
201 | 201 | /** Parse image dimensions from a Base64 data URL. */ |
202 | | -export function getImageSizeFromDataUrl(dataUrl: string): ImageSize | null { |
| 202 | +function getImageSizeFromDataUrl(dataUrl: string): ImageSize | null { |
203 | 203 | try { |
204 | 204 | // Format: data:image/png;base64,xxxxx |
205 | 205 | const matches = dataUrl.match(/^data:image\/[^;]+;base64,(.+)$/); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -84,7 +84,7 @@ export function getQQBotMediaDir(...subPaths: string[]): string {
|
84 | 84 | * `saveMediaBuffer(..., "outbound", ...)`) or `inbound/`, while still keeping |
85 | 85 | * the check anchored to a single, well-known directory. |
86 | 86 | */ |
87 | | -export function getOpenClawMediaDir(): string { |
| 87 | +function getOpenClawMediaDir(): string { |
88 | 88 | return path.join(getHomeDir(), ".openclaw", "media"); |
89 | 89 | } |
90 | 90 | |
@@ -209,7 +209,7 @@ export async function checkSilkWasmAvailable(): Promise<boolean> {
|
209 | 209 | // ---- Tilde expansion and path normalization ---- |
210 | 210 | |
211 | 211 | /** Expand `~` to the current user's home directory. */ |
212 | | -export function expandTilde(p: string): string { |
| 212 | +function expandTilde(p: string): string { |
213 | 213 | if (!p) { |
214 | 214 | return p; |
215 | 215 | } |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。