fix(coding-agent): use ModelRegistry in custom-compaction example (fixes #1387)
This commit is contained in:
@@ -13,7 +13,7 @@
|
|||||||
* pi --extension examples/extensions/custom-compaction.ts
|
* pi --extension examples/extensions/custom-compaction.ts
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { complete, getModel } from "@mariozechner/pi-ai";
|
import { complete } from "@mariozechner/pi-ai";
|
||||||
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
|
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
|
||||||
import { convertToLlm, serializeConversation } from "@mariozechner/pi-coding-agent";
|
import { convertToLlm, serializeConversation } from "@mariozechner/pi-coding-agent";
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@ export default function (pi: ExtensionAPI) {
|
|||||||
const { messagesToSummarize, turnPrefixMessages, tokensBefore, firstKeptEntryId, previousSummary } = preparation;
|
const { messagesToSummarize, turnPrefixMessages, tokensBefore, firstKeptEntryId, previousSummary } = preparation;
|
||||||
|
|
||||||
// Use Gemini Flash for summarization (cheaper/faster than most conversation models)
|
// Use Gemini Flash for summarization (cheaper/faster than most conversation models)
|
||||||
const model = getModel("google", "gemini-2.5-flash");
|
const model = ctx.modelRegistry.find("google", "gemini-2.5-flash");
|
||||||
if (!model) {
|
if (!model) {
|
||||||
ctx.ui.notify(`Could not find Gemini Flash model, using default compaction`, "warning");
|
ctx.ui.notify(`Could not find Gemini Flash model, using default compaction`, "warning");
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user