14 lines
560 B
TypeScript
14 lines
560 B
TypeScript
import { updatePromptPreset, listPromptPresets } from '~/server/utils/promptPresets'
|
|
|
|
export default defineEventHandler(async (event) => {
|
|
const id = getRouterParam(event, 'id')
|
|
if (!id) throw createError({ statusCode: 400, statusMessage: 'Missing instruction set id' })
|
|
const body = await readBody<{ name?: string; systemPrompt?: string; description?: string }>(event).catch(() => ({}))
|
|
const owner = libraryOwnerKey(event)
|
|
const preset = await updatePromptPreset(owner, id, body)
|
|
return {
|
|
preset,
|
|
presets: listPromptPresets(owner)
|
|
}
|
|
})
|