Skip to content

Commit 87bc994

Browse files
authored
add api to get api key (#4)
* add route for generate api key Signed-off-by: cbh778899 <[email protected]> * update doc Signed-off-by: cbh778899 <[email protected]> --------- Signed-off-by: cbh778899 <[email protected]>
1 parent 12d3e39 commit 87bc994

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

doc.html

+20
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,26 @@
8787
description: 'This route showes this page.'
8888
}
8989
]
90+
},
91+
{
92+
name: 'Chat',
93+
route: '/v1/chat',
94+
routes: [
95+
{
96+
route: '/completions',
97+
description: 'route for chat, follow OpenAI request & response format'
98+
}
99+
]
100+
},
101+
{
102+
name: 'Token',
103+
route: '/v1/token',
104+
routes: [
105+
{
106+
route: '/api-key',
107+
description: 'get an API key for request chat'
108+
}
109+
]
90110
}
91111
]
92112

routes/token.js

+6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
import { Router } from "express";
2+
import { generateAPIKey } from "../tools/generator.js";
23

34
export default function tokenRoute() {
45
const router = Router();
6+
7+
router.get('/api-key', (_, res)=>{
8+
res.send({api_key: generateAPIKey()})
9+
})
10+
511
return router;
612
}

0 commit comments

Comments
 (0)