Mark which models are eligible for turbo edits (#172)
This commit is contained in:
@@ -2,7 +2,7 @@ import { LargeLanguageModel } from "@/lib/schemas";
|
||||
import { readSettings } from "../../main/settings";
|
||||
import { Message } from "../ipc_types";
|
||||
|
||||
import { getLanguageModels } from "../shared/language_model_helpers";
|
||||
import { findLanguageModel } from "./findLanguageModel";
|
||||
|
||||
// Estimate tokens (4 characters per token)
|
||||
export const estimateTokens = (text: string): number => {
|
||||
@@ -31,20 +31,3 @@ export async function getMaxTokens(model: LargeLanguageModel) {
|
||||
const modelOption = await findLanguageModel(model);
|
||||
return modelOption?.maxOutputTokens || DEFAULT_MAX_TOKENS;
|
||||
}
|
||||
|
||||
async function findLanguageModel(model: LargeLanguageModel) {
|
||||
const models = await getLanguageModels({
|
||||
providerId: model.provider,
|
||||
});
|
||||
|
||||
if (model.customModelId) {
|
||||
const customModel = models.find(
|
||||
(m) => m.type === "custom" && m.id === model.customModelId,
|
||||
);
|
||||
if (customModel) {
|
||||
return customModel;
|
||||
}
|
||||
}
|
||||
|
||||
return models.find((m) => m.apiName === model.name);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user