Spaces:
Sleeping
Sleeping
Update index.js
Browse files
index.js
CHANGED
@@ -27,7 +27,7 @@ const CONFIG = {
|
|
27 |
'Connection': 'Upgrade',
|
28 |
'Pragma': 'no-cache',
|
29 |
'Cache-Control': 'no-cache',
|
30 |
-
'User-Agent': 'Mozilla/5.0 (
|
31 |
'Upgrade': 'websocket',
|
32 |
'Origin': 'https://docs.anthropic.com',
|
33 |
'Sec-WebSocket-Version': '13',
|
@@ -370,7 +370,7 @@ app.use(cors({
|
|
370 |
|
371 |
|
372 |
// 获取模型列表路由
|
373 |
-
app.get('/v1/models', (req, res) => {
|
374 |
res.json({
|
375 |
object: "list",
|
376 |
data: [{
|
@@ -383,7 +383,7 @@ app.get('/v1/models', (req, res) => {
|
|
383 |
});
|
384 |
|
385 |
// 聊天完成路由
|
386 |
-
app.post('/v1/chat/completions', async (req, res) => {
|
387 |
try {
|
388 |
const { messages, model, stream } = req.body;
|
389 |
const authToken = req.headers.authorization?.replace('Bearer ', '');
|
|
|
27 |
'Connection': 'Upgrade',
|
28 |
'Pragma': 'no-cache',
|
29 |
'Cache-Control': 'no-cache',
|
30 |
+
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36',
|
31 |
'Upgrade': 'websocket',
|
32 |
'Origin': 'https://docs.anthropic.com',
|
33 |
'Sec-WebSocket-Version': '13',
|
|
|
370 |
|
371 |
|
372 |
// 获取模型列表路由
|
373 |
+
app.get('/hf/v1/models', (req, res) => {
|
374 |
res.json({
|
375 |
object: "list",
|
376 |
data: [{
|
|
|
383 |
});
|
384 |
|
385 |
// 聊天完成路由
|
386 |
+
app.post('/hf/v1/chat/completions', async (req, res) => {
|
387 |
try {
|
388 |
const { messages, model, stream } = req.body;
|
389 |
const authToken = req.headers.authorization?.replace('Bearer ', '');
|