mirror of
https://github.com/stablyai/orca.git
synced 2026-11-04 11:07:42 +00:00
* fix(omp): discover and switch native-chat models Report the running OMP provider/model and discover available choices on the execution host for desktop and mobile. Register an extension command to switch through the OMP API because its TUI does not accept /model args. Advertise that command in status so older hosts remain read-only. Addresses the OMP portion of #17603; Pi chat enablement remains separate. Model reporting begins on lifecycle activity; no startup status is invented. Co-authored-by: SudoAI-DEV <220139811+SudoAI-DEV@users.noreply.github.com> * refactor(omp): check generated model metadata types * test(omp): verify model picker command and reported selection * test(omp): add repeatable real model-switch runtime proof * test(omp): require model capability delivery in runtime smoke * fix(mobile): decode OMP model discovery through RPC operations * fix(omp): preserve exact reported model selectors * fix(omp): preserve generated extension syntax after rebase * fix(omp): merge generated harness UI context types * test(omp): model switching keeps one session manager * test(omp): include transcript path in model status proof * test(omp): avoid renderer error-type union * test(omp): keep renderer test type explicit --------- Co-authored-by: SudoAI-DEV <220139811+SudoAI-DEV@users.noreply.github.com>
26 lines
1.1 KiB
TypeScript
26 lines
1.1 KiB
TypeScript
export function getOmpModelCommandSourceLines(): string[] {
|
|
return [
|
|
" if (isOmpRuntime() && typeof pi.registerCommand === 'function' && typeof pi.setModel === 'function') {",
|
|
" pi.registerCommand('orca-model', {",
|
|
" description: 'Switch the model selected in Orca',",
|
|
' handler: async (selector, ctx) => {',
|
|
' const models = ctx.modelRegistry.getAvailable()',
|
|
" const model = models.find((candidate) => candidate.provider + '/' + candidate.id === selector.trim())",
|
|
' if (!model) {',
|
|
" ctx.ui.notify('Model is no longer available. Refresh the Orca model picker.', 'error')",
|
|
' return',
|
|
' }',
|
|
' if (!await pi.setModel(model)) {',
|
|
" ctx.ui.notify('Could not switch model: no API key is available.', 'error')",
|
|
' return',
|
|
' }',
|
|
' updateRuntimeOmpSessionMetadata(ctx)',
|
|
' updateModelMetadata({ model })',
|
|
" post('model_select')",
|
|
' }',
|
|
' })',
|
|
' ompModelSwitchSupported = true',
|
|
' }'
|
|
]
|
|
}
|