feat: save system prompt
This commit is contained in:
@@ -41,7 +41,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
||||
await connectToDatabase();
|
||||
let startTime = Date.now();
|
||||
|
||||
const { model, content, userApiKey, systemKey, userId } = await authChat({
|
||||
const { model, showModelDetail, content, userApiKey, systemKey, userId } = await authChat({
|
||||
modelId,
|
||||
chatId,
|
||||
authorization
|
||||
@@ -120,7 +120,9 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
||||
const { responseContent } = await gpt35StreamResponse({
|
||||
res,
|
||||
stream,
|
||||
chatResponse
|
||||
chatResponse,
|
||||
systemPrompt:
|
||||
showModelDetail && filterPrompts[0].role === 'system' ? filterPrompts[0].content : ''
|
||||
});
|
||||
|
||||
// 只有使用平台的 key 才计费
|
||||
|
||||
@@ -48,7 +48,8 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
||||
$project: {
|
||||
_id: '$content._id',
|
||||
obj: '$content.obj',
|
||||
value: '$content.value'
|
||||
value: '$content.value',
|
||||
systemPrompt: '$content.systemPrompt'
|
||||
}
|
||||
}
|
||||
]);
|
||||
|
||||
@@ -26,7 +26,8 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
||||
const content = prompts.map((item) => ({
|
||||
_id: new mongoose.Types.ObjectId(item._id),
|
||||
obj: item.obj,
|
||||
value: item.value
|
||||
value: item.value,
|
||||
systemPrompt: item.systemPrompt
|
||||
}));
|
||||
|
||||
await authModel({ modelId, userId, authOwner: false });
|
||||
|
||||
Reference in New Issue
Block a user