feat: integrate K.G.One music generation panel
- ConfigManager: add `general.kgone` config block (enabled toggle +
base URL); add `setKGOneManagedByServer()` / `isKGOneServerManaged()`
for managed deployments that supply a `kgone-server.txt` override
- App.tsx: probe for `kgone-server.txt` on startup (Content-Type guard
to avoid Vite SPA fallback false-positive)
- GeneralSettings: new K.G.One section with enable toggle + base URL
input; fields disabled when server-managed
- Toolbar: magic wand button (FaWandMagicSparkles) that toggles the
panel; disabled with reduced opacity when K.G.One is turned off;
mutually exclusive with the Chat panel
- projectStore: add `showKGOnePanel` state + `toggleKGOnePanel` action
- KGOnePanel (new): three-tab panel (Clip / Full Song / Separator)
- Clip: prompt + advanced params → POST /v1/clip/generate → poll
/v1/clip/result → download WAV → AudioPlayer preview
- Full Song: caption + lyrics + advanced params → POST
/v1/fullsong/generate → poll /v1/fullsong/result (live progress %
from nested JSON string) → download MP3 → AudioPlayer preview
- Separator: reads selected audio region from OPFS via
KGAudioFileStorage → POST /v1/separator/separate (multipart) →
poll /v1/separator/result → parallel-download all stem files →
multiple labeled AudioPlayer instances rendered vertically
- Shared: custom AudioPlayer (play/pause, clickable seek bar),
spinner + hint text, error card, AbortController cleanup,
DEBUG_MODE.KGONE-gated REQ/RES console logging
This commit is contained in:
@@ -34,6 +34,10 @@ interface AppConfig {
|
||||
soundfont: {
|
||||
base_url: string;
|
||||
};
|
||||
kgone: {
|
||||
enabled: boolean;
|
||||
base_url: string;
|
||||
};
|
||||
};
|
||||
hotkeys: {
|
||||
main: {
|
||||
@@ -100,6 +104,7 @@ export class ConfigManager {
|
||||
private config: AppConfig;
|
||||
private storage: KGConfigStorage;
|
||||
private isInitialized: boolean = false;
|
||||
private kgoneServerManaged: boolean = false;
|
||||
private defaultConfig: AppConfig | null = null;
|
||||
private changeListeners: Set<(changedKeys: string[]) => void> = new Set();
|
||||
|
||||
@@ -199,6 +204,10 @@ export class ConfigManager {
|
||||
},
|
||||
soundfont: {
|
||||
base_url: 'https://cdn.jsdelivr.net/npm/soundfont-for-samplers/FluidR3_GM/'
|
||||
},
|
||||
kgone: {
|
||||
enabled: false,
|
||||
base_url: 'http://127.0.0.1:8000'
|
||||
}
|
||||
},
|
||||
hotkeys: {
|
||||
@@ -548,6 +557,21 @@ export class ConfigManager {
|
||||
return copied;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called at startup when kgone-server.txt is found.
|
||||
* Forces enabled=true and overrides base_url in-memory only (not persisted).
|
||||
*/
|
||||
public setKGOneManagedByServer(url: string): void {
|
||||
this.kgoneServerManaged = true;
|
||||
this.setInObject(this.config as Record<string, unknown>, 'general.kgone.enabled', true);
|
||||
this.setInObject(this.config as Record<string, unknown>, 'general.kgone.base_url', url);
|
||||
this.notifyChangeListeners(['general.kgone.enabled', 'general.kgone.base_url']);
|
||||
}
|
||||
|
||||
public isKGOneServerManaged(): boolean {
|
||||
return this.kgoneServerManaged;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default configuration
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user