From 36e89c0b2a0dfea35fd74ba54e376ae117eea1a0 Mon Sep 17 00:00:00 2001 From: Yanyutin753 <132346501+Yanyutin753@users.noreply.github.com> Date: Wed, 24 Apr 2024 13:17:43 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8feat=20support=20/v1/models=20to=20be?= =?UTF-8?q?=20better=20use=20lobechat?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/routes/index.ts | 4 +++- src/api/routes/models.ts | 41 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 src/api/routes/models.ts diff --git a/src/api/routes/index.ts b/src/api/routes/index.ts index 6ecd2fa..16738dd 100644 --- a/src/api/routes/index.ts +++ b/src/api/routes/index.ts @@ -5,6 +5,7 @@ import chat from "./chat.ts"; import images from "./images.ts"; import ping from "./ping.ts"; import token from './token.js'; +import models from './models.ts'; export default [ { @@ -23,5 +24,6 @@ export default [ chat, images, ping, - token + token, + models ]; \ No newline at end of file diff --git a/src/api/routes/models.ts b/src/api/routes/models.ts new file mode 100644 index 0000000..f776cb0 --- /dev/null +++ b/src/api/routes/models.ts @@ -0,0 +1,41 @@ +import _ from 'lodash'; + +export default { + + prefix: '/v1', + + get: { + '/models': async () => { + return { + "data": [ + { + "id": "glm-3-turbo", + "object": "model", + "owned_by": "glm-free-api" + }, + { + "id": "glm-4", + "object": "model", + "owned_by": "glm-free-api" + }, + { + "id": "glm-4v", + "object": "model", + "owned_by": "glm-free-api" + }, + { + "id": "glm-v1", + "object": "model", + "owned_by": "glm-free-api" + }, + { + "id": "glm-v1-vision", + "object": "model", + "owned_by": "glm-free-api" + } + ] + }; + } + + } +} \ No newline at end of file