Feat: more settings for ai engine & models (#611)

* may setup gpt ai engine & model

* ai models setting works

* update openai setting

* validate engine setting before save

* fail fast

* clean code

* refactor gpt preset
This commit is contained in:
an-lee
2024-05-15 15:52:07 +08:00
committed by GitHub
parent b4d7fb837e
commit 61c76006fd
16 changed files with 449 additions and 148 deletions

View File

@@ -1,5 +1,5 @@
import { ChatOpenAI } from "@langchain/openai";
import { RESPONSE_JSON_FORMAT_MODELS } from "@/constants";
import { NOT_SUPPORTE_JSON_FORMAT_MODELS } from "@/constants";
import { zodToJsonSchema } from "zod-to-json-schema";
export const jsonCommand = async (
@@ -15,7 +15,7 @@ export const jsonCommand = async (
const { key, temperature = 0, baseUrl, schema } = options;
let { modelName = "gpt-4o" } = options;
if (RESPONSE_JSON_FORMAT_MODELS.indexOf(modelName) === -1) {
if (NOT_SUPPORTE_JSON_FORMAT_MODELS.indexOf(modelName) > -1) {
modelName = "gpt-4o";
}