- #70: implémentation suppression modèles locaux téléchargés - #100: correction scroll OpenCode - #102: correction fit TUI après switch/layout - memory note scoping UX
49 lines
1.5 KiB
TypeScript
49 lines
1.5 KiB
TypeScript
/**
|
|
* Tauri adapter for {@link ModelServerGateway} (F35). One of the only places that
|
|
* calls `invoke()`; features reach it exclusively through the port.
|
|
*
|
|
* Commands and payload keys are camelCase, matching the backend DTO convention.
|
|
* The flat `LocalModelServerConfig` wire shape is the DTO frozen by Architect —
|
|
* no nesting.
|
|
*/
|
|
|
|
import { invoke } from "@tauri-apps/api/core";
|
|
|
|
import type {
|
|
LocalModelServerConfig,
|
|
ModelServerCommandPreview,
|
|
} from "@/domain";
|
|
import type { ModelServerGateway } from "@/ports";
|
|
|
|
export class TauriModelServerGateway implements ModelServerGateway {
|
|
listModelServers(): Promise<LocalModelServerConfig[]> {
|
|
return invoke<LocalModelServerConfig[]>("list_model_servers");
|
|
}
|
|
|
|
saveModelServer(
|
|
config: LocalModelServerConfig,
|
|
): Promise<LocalModelServerConfig> {
|
|
return invoke<LocalModelServerConfig>("save_model_server", {
|
|
request: { config },
|
|
});
|
|
}
|
|
|
|
async deleteModelServer(serverId: string): Promise<void> {
|
|
await invoke("delete_model_server", { serverId });
|
|
}
|
|
|
|
async deleteModelArtifact(serverId: string): Promise<void> {
|
|
await invoke("delete_model_artifact", { serverId });
|
|
}
|
|
|
|
previewModelServerCommand(
|
|
config: LocalModelServerConfig,
|
|
): Promise<ModelServerCommandPreview> {
|
|
// `preview_model_server_command` takes the config directly (no `request`
|
|
// wrapper), unlike `save_model_server`.
|
|
return invoke<ModelServerCommandPreview>("preview_model_server_command", {
|
|
config,
|
|
});
|
|
}
|
|
}
|