(error, provider, currentModel)
| 85427 | ); |
| 85428 | const chatContextAsCompletionRequest = [...INIT_MESSAGES_PROMPT]; |
| 85429 | chatContextAsCompletionRequest.push({ |
| 85430 | role: "user", |
| 85431 | content: diff |
| 85432 | }); |
| 85433 | return chatContextAsCompletionRequest; |
| 85434 | }; |
| 85435 | async function handleModelNotFoundError(error, provider, currentModel) { |
| 85436 | console.log(source_default.red(` |
| 85437 | \u2716 Model '${currentModel}' not found |
| 85438 | `)); |
| 85439 | const suggestedModels = getSuggestedModels(provider, currentModel); |
| 85440 | const recommended = RECOMMENDED_MODELS[provider]; |
| 85441 | if (suggestedModels.length === 0) { |
| 85442 | console.log( |
| 85443 | source_default.yellow( |
| 85444 | `No alternative models available. Run 'oco setup' to configure a different model.` |
| 85445 | ) |
| 85446 | ); |
| 85447 | return null; |
| 85448 | } |
| 85449 | const options = []; |
| 85450 | if (recommended && suggestedModels.includes(recommended)) { |
| 85451 | options.push({ |
| 85452 | value: recommended, |
| 85453 | label: `${recommended} (Recommended)` |
| 85454 | }); |
| 85455 | } |
| 85456 | suggestedModels.filter((m5) => m5 !== recommended).forEach((model) => { |
| 85457 | options.push({ value: model, label: model }); |
| 85458 | }); |
| 85459 | options.push({ value: "__custom__", label: "Enter custom model..." }); |
| 85460 | const selection = await ee({ |
| 85461 | message: "Select an alternative model:", |
| 85462 | options |
| 85463 | }); |
| 85464 | if (hD2(selection)) { |
| 85465 | return null; |
| 85466 | } |
| 85467 | let newModel; |
| 85468 | if (selection === "__custom__") { |
| 85469 | const { text } = await Promise.resolve().then(() => (init_dist2(), dist_exports)); |
| 85470 | const customModel = await text({ |
| 85471 | message: "Enter model name:", |
| 85472 | validate: (value) => { |
| 85473 | if (!value || value.trim().length === 0) { |
| 85474 | return "Model name is required"; |
| 85475 | } |
| 85476 | return void 0; |
| 85477 | } |
| 85478 | }); |
| 85479 | if (hD2(customModel)) { |
| 85480 | return null; |
| 85481 | } |
| 85482 | newModel = customModel; |
| 85483 | } else { |
| 85484 | newModel = selection; |
| 85485 | } |
| 85486 | const saveAsDefault = await Q3({ |
no test coverage detected
searching dependent graphs…