27 lines
875 B
TypeScript
27 lines
875 B
TypeScript
import express from "express";
|
|
import { success } from "@/lib/responseFormat";
|
|
import u from "@/utils";
|
|
import { z } from "zod";
|
|
import { validateFields } from "@/middleware/middleware";
|
|
const router = express.Router();
|
|
|
|
export default router.post(
|
|
"/",
|
|
validateFields({
|
|
id: z.number(),
|
|
name: z.string(),
|
|
model: z.string(),
|
|
modelName: z.string(),
|
|
vendorId: z.string().nullable(),
|
|
desc: z.string(),
|
|
topP: z.number().optional(),
|
|
temperature: z.number().optional(),
|
|
maxOutputTokens: z.number().optional(),
|
|
}),
|
|
async (req, res) => {
|
|
const { id, name, model, modelName, vendorId, desc, topP, temperature, maxOutputTokens } = req.body;
|
|
await u.db("o_agentDeploy").where({ id }).update({ id, name, model, modelName, vendorId, desc, topP, temperature, maxOutputTokens });
|
|
res.status(200).send(success("配置成功"));
|
|
},
|
|
);
|