feat: configure key model access after creation
This commit is contained in:
1 parent
6de29ebd6d
commit
7f35960ba6
8 files changed
+175
-23
No files matched your search
@@ -326,6 +326,16 @@ async function route(request: IncomingMessage, response: ServerResponse) {
|
||||
return
|
||||
}
|
||||
|
||||
const keyModelsMatch = path.match(/^\/api\/keys\/([^/]+)\/models$/)
|
||||
const keyModelsId = keyModelsMatch?.[1]
|
||||
if (method === 'POST' && keyModelsId) {
|
||||
const user = await auth.requireUser(token)
|
||||
const body = await readJson(request)
|
||||
const apiKey = await catalog.updateApiKeyModels(user.id, keyModelsId, stringArrayValue(body.modelIds))
|
||||
send(response, 200, { apiKey })
|
||||
return
|
||||
}
|
||||
|
||||
const keyRevokeMatch = path.match(/^\/api\/keys\/([^/]+)\/revoke$/)
|
||||
const keyId = keyRevokeMatch?.[1]
|
||||
if (method === 'POST' && keyId) {
|
||||
|
||||
Reference in new issue
Block a user