chore: proxy all /models methods to cortex.cpp
This commit is contained in:
parent
81015bab3c
commit
4a414bf5e9
@ -10,7 +10,7 @@ import {
|
|||||||
getMessages,
|
getMessages,
|
||||||
retrieveMessage,
|
retrieveMessage,
|
||||||
updateThread,
|
updateThread,
|
||||||
getModels,
|
models,
|
||||||
} from './helper/builder'
|
} from './helper/builder'
|
||||||
|
|
||||||
import { JanApiRouteConfiguration } from './helper/configuration'
|
import { JanApiRouteConfiguration } from './helper/configuration'
|
||||||
@ -29,7 +29,7 @@ export const commonRouter = async (app: HttpServer) => {
|
|||||||
Object.keys(JanApiRouteConfiguration).forEach((key) => {
|
Object.keys(JanApiRouteConfiguration).forEach((key) => {
|
||||||
app.get(`/${key}`, async (_req, _res) => {
|
app.get(`/${key}`, async (_req, _res) => {
|
||||||
if (key === 'models') {
|
if (key === 'models') {
|
||||||
return getModels(_req, _res)
|
return models(_req, _res)
|
||||||
}
|
}
|
||||||
return getBuilder(JanApiRouteConfiguration[key]).then(normalizeData)
|
return getBuilder(JanApiRouteConfiguration[key]).then(normalizeData)
|
||||||
})
|
})
|
||||||
|
|||||||
@ -302,14 +302,14 @@ export const downloadModel = async (
|
|||||||
* @param request
|
* @param request
|
||||||
* @param reply
|
* @param reply
|
||||||
*/
|
*/
|
||||||
export const getModels = async (request: any, reply: any) => {
|
export const models = async (request: any, reply: any) => {
|
||||||
const fetch = require('node-fetch')
|
const fetch = require('node-fetch')
|
||||||
const headers: Record<string, any> = {
|
const headers: Record<string, any> = {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
}
|
}
|
||||||
|
|
||||||
const response = await fetch(`${CORTEX_API_URL}/models`, {
|
const response = await fetch(`${CORTEX_API_URL}/models`, {
|
||||||
method: 'GET',
|
method: request.method,
|
||||||
headers: headers,
|
headers: headers,
|
||||||
body: JSON.stringify(request.body),
|
body: JSON.stringify(request.body),
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user