feat: v1 — persistent shell, model gateway, artifact improvements (#1462)
This commit is contained in:
parent
3651670fb9
commit
f9652b452a
161 changed files with 5166 additions and 8009 deletions
|
|
@ -1,27 +1,14 @@
|
|||
import { gateway } from "@ai-sdk/gateway";
|
||||
import {
|
||||
customProvider,
|
||||
extractReasoningMiddleware,
|
||||
wrapLanguageModel,
|
||||
} from "ai";
|
||||
import { customProvider, gateway } from "ai";
|
||||
import { isTestEnvironment } from "../constants";
|
||||
|
||||
const THINKING_SUFFIX_REGEX = /-thinking$/;
|
||||
import { titleModel } from "./models";
|
||||
|
||||
export const myProvider = isTestEnvironment
|
||||
? (() => {
|
||||
const {
|
||||
artifactModel,
|
||||
chatModel,
|
||||
reasoningModel,
|
||||
titleModel,
|
||||
} = require("./models.mock");
|
||||
const { chatModel, titleModel } = require("./models.mock");
|
||||
return customProvider({
|
||||
languageModels: {
|
||||
"chat-model": chatModel,
|
||||
"chat-model-reasoning": reasoningModel,
|
||||
"title-model": titleModel,
|
||||
"artifact-model": artifactModel,
|
||||
},
|
||||
});
|
||||
})()
|
||||
|
|
@ -32,19 +19,6 @@ export function getLanguageModel(modelId: string) {
|
|||
return myProvider.languageModel(modelId);
|
||||
}
|
||||
|
||||
const isReasoningModel =
|
||||
modelId.endsWith("-thinking") ||
|
||||
(modelId.includes("reasoning") && !modelId.includes("non-reasoning"));
|
||||
|
||||
if (isReasoningModel) {
|
||||
const gatewayModelId = modelId.replace(THINKING_SUFFIX_REGEX, "");
|
||||
|
||||
return wrapLanguageModel({
|
||||
model: gateway.languageModel(gatewayModelId),
|
||||
middleware: extractReasoningMiddleware({ tagName: "thinking" }),
|
||||
});
|
||||
}
|
||||
|
||||
return gateway.languageModel(modelId);
|
||||
}
|
||||
|
||||
|
|
@ -52,12 +26,5 @@ export function getTitleModel() {
|
|||
if (isTestEnvironment && myProvider) {
|
||||
return myProvider.languageModel("title-model");
|
||||
}
|
||||
return gateway.languageModel("google/gemini-2.5-flash-lite");
|
||||
}
|
||||
|
||||
export function getArtifactModel() {
|
||||
if (isTestEnvironment && myProvider) {
|
||||
return myProvider.languageModel("artifact-model");
|
||||
}
|
||||
return gateway.languageModel("anthropic/claude-haiku-4.5");
|
||||
return gateway.languageModel(titleModel.id);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue