chore: proxy all /models methods to cortex.cpp
This commit is contained in:
parent
81015bab3c
commit
4a414bf5e9
@ -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)
|
||||
})
|
||||
|
||||
@ -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),
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user