chore: proxy all /models methods to cortex.cpp

This commit is contained in:
Louis 2024-11-08 18:16:09 +07:00
parent 81015bab3c
commit 4a414bf5e9
No known key found for this signature in database
GPG Key ID: 44FA9F4D33C37DE2
2 changed files with 4 additions and 4 deletions

View File

@ -10,7 +10,7 @@ import {
getMessages,
retrieveMessage,
updateThread,
getModels,
models,
} from './helper/builder'
import { JanApiRouteConfiguration } from './helper/configuration'
@ -29,7 +29,7 @@ export const commonRouter = async (app: HttpServer) => {
Object.keys(JanApiRouteConfiguration).forEach((key) => {
app.get(`/${key}`, async (_req, _res) => {
if (key === 'models') {
return getModels(_req, _res)
return models(_req, _res)
}
return getBuilder(JanApiRouteConfiguration[key]).then(normalizeData)
})

View File

@ -302,14 +302,14 @@ export const downloadModel = async (
* @param request
* @param reply
*/
export const getModels = async (request: any, reply: any) => {
export const models = async (request: any, reply: any) => {
const fetch = require('node-fetch')
const headers: Record<string, any> = {
'Content-Type': 'application/json',
}
const response = await fetch(`${CORTEX_API_URL}/models`, {
method: 'GET',
method: request.method,
headers: headers,
body: JSON.stringify(request.body),
})