mirror of
https://github.com/nexu-io/openmotion.git
synced 2026-12-03 23:51:02 +08:00
* feat(sound-studio): redesign waveforms, live playback flow, voice cards and audio track library - Extract real 128-bucket PCM audio waveforms with noise gating and smoothing on probe and playback decode - Redesign Sound Studio waveforms into pixel-crisp 1:1 SVG bars with generous horizontal breathing room, pointer-capture drag scrubbing, monochrome played progress, accent needle, and 60/120fps direct-DOM living playback flow - Redesign Speech voice selector into clean typographic studio cards with authentic localized timbre traits, isolated inline auditioning, balanced featured grids for large catalogs, and single-column layout for single-voice models - Refine Audio track library filtering, server-side audioKind queries, voice metadata display, overflow actions, and bottom player dock polish across dark and light themes * fix(sound-studio): preserve cross-tab starter drafts and persist resolved audioKind - Route Music, SFX, and Speech starter Use actions through selectSoundTab/reuseInScene with the target draft and resolved SFX model parameters so draftKey transitions never drop prompts or SFX settings - Persist resolved audioKind on audio AssetVersion records during generation (using model id, mode, modelId, and label) and uploads, keeping id-only inference as legacy fallback across gateway filtering and Sound Studio UI - Add regression tests covering cross-tab starter handoff and opaque model ID audioKind classification * fix(sound-studio): split structured vs advanced JSON params on draftKey transitions - Split persisted or cross-tab draft.parameters via parameterDraftFromParams using the model's structured generationOptions fields so schema-less BYOK raw JSON keys stay in advanced and never leak into ParameterDraft.values - Seed parameterDrafts once per draftKey transition rather than on local SoundComposer handleParamChange updates - Add regression test verifying editing and clearing raw JSON on a schema-less BYOK audio model --------- Co-authored-by: bone3deep1962-collab <bone3deep1962@gmail.com>
42 lines
2.4 KiB
TypeScript
42 lines
2.4 KiB
TypeScript
import type { AudioKind } from './audio-kind.ts';
|
|
import type { Modality } from './gateway.ts';
|
|
|
|
/** A reference always pins immutable bytes, never the asset's changing current version. */
|
|
export type AssetReference = { assetId: string; versionId: string };
|
|
export type AssetVersion = {
|
|
id: string; createdAt: number; source: 'upload' | 'generated'; filename: string; name?: string;
|
|
mimeType: string; bytes: number; sha256: string; width?: number; height?: number; duration?: number;
|
|
waveform?: number[];
|
|
audioKind?: AudioKind;
|
|
prompt?: string; model?: string; parameters?: Record<string, unknown>;
|
|
references: AssetReference[]; parentVersionId?: string; jobId?: string; conversationId?: string;
|
|
requestId?: string; requestHash?: string;
|
|
result?: Record<string, unknown>;
|
|
};
|
|
export type LibraryAsset = {
|
|
id: string; name: string; modality: Modality; createdAt: number; updatedAt: number;
|
|
currentVersionId: string; versions: AssetVersion[]; trashedAt?: number;
|
|
};
|
|
export type LibraryGeneration = {
|
|
assetId?: string; title?: string; parentVersionId?: string;
|
|
references?: AssetReference[]; conversationId?: string;
|
|
};
|
|
export type AssetListInput = {
|
|
modality?: Modality; audioKind?: AudioKind; source?: 'upload' | 'generated'; query?: string; trash?: boolean;
|
|
sort?: 'newest' | 'oldest' | 'name'; offset?: number; limit?: number;
|
|
};
|
|
export const assetVersion = (asset: LibraryAsset, versionId = asset.currentVersionId) => asset.versions.find(version => version.id === versionId);
|
|
export const assetMediaUrl = (assetId: string, versionId: string) => `/motion-api/assets/${encodeURIComponent(assetId)}/versions/${encodeURIComponent(versionId)}/file`;
|
|
|
|
export type AssetReadContent = { type: 'text'; text: string } | { type: 'image' | 'audio'; mimeType: string; data: string };
|
|
export type AssetReadResult = {
|
|
assetId: string; versionId: string; modality: Modality; version: AssetVersion;
|
|
previews: { mimeType: string; bytes: number; width?: number; height?: number; timestamp?: number; start?: number; duration?: number }[];
|
|
content: AssetReadContent[];
|
|
};
|
|
/** Media belongs in native content, never duplicated in JSON metadata or persisted chat messages. */
|
|
export function assetReadToolResult(value: AssetReadResult) {
|
|
const { content, ...metadata } = value;
|
|
return { content: [{ type: 'text' as const, text: JSON.stringify(metadata) }, ...content], structuredContent: metadata };
|
|
}
|