patch failing calls to cortex
This commit is contained in:
parent
31971e7821
commit
39bb3f34d6
@ -51,7 +51,7 @@ export default class JanEngineManagementExtension extends EngineManagementExtens
|
|||||||
*/
|
*/
|
||||||
async onLoad() {
|
async onLoad() {
|
||||||
// Update default local engine
|
// Update default local engine
|
||||||
this.updateDefaultEngine()
|
// this.updateDefaultEngine()
|
||||||
|
|
||||||
// Migrate
|
// Migrate
|
||||||
this.migrate()
|
this.migrate()
|
||||||
@ -66,6 +66,7 @@ export default class JanEngineManagementExtension extends EngineManagementExtens
|
|||||||
* @returns A Promise that resolves to an object of list engines.
|
* @returns A Promise that resolves to an object of list engines.
|
||||||
*/
|
*/
|
||||||
async getEngines(): Promise<Engines> {
|
async getEngines(): Promise<Engines> {
|
||||||
|
return {}
|
||||||
return this.apiInstance().then((api) =>
|
return this.apiInstance().then((api) =>
|
||||||
api
|
api
|
||||||
.get('v1/engines')
|
.get('v1/engines')
|
||||||
@ -94,6 +95,7 @@ export default class JanEngineManagementExtension extends EngineManagementExtens
|
|||||||
* @returns A Promise that resolves to an array of installed engine.
|
* @returns A Promise that resolves to an array of installed engine.
|
||||||
*/
|
*/
|
||||||
async getInstalledEngines(name: string): Promise<EngineVariant[]> {
|
async getInstalledEngines(name: string): Promise<EngineVariant[]> {
|
||||||
|
return []
|
||||||
return this.apiInstance().then((api) =>
|
return this.apiInstance().then((api) =>
|
||||||
api
|
api
|
||||||
.get(`v1/engines/${name}`)
|
.get(`v1/engines/${name}`)
|
||||||
|
|||||||
@ -23,7 +23,7 @@ import {
|
|||||||
} from '@janhq/core'
|
} from '@janhq/core'
|
||||||
|
|
||||||
import { invoke } from '@tauri-apps/api/core'
|
import { invoke } from '@tauri-apps/api/core'
|
||||||
import { createHmac } from 'crypto'
|
// import { createHmac } from 'crypto'
|
||||||
|
|
||||||
type LlamacppConfig = {
|
type LlamacppConfig = {
|
||||||
n_gpu_layers: number;
|
n_gpu_layers: number;
|
||||||
@ -131,8 +131,9 @@ export default class llamacpp_extension extends AIEngine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private generateApiKey(modelId: string): string {
|
private generateApiKey(modelId: string): string {
|
||||||
const hash = createHmac('sha256', this.apiSecret).update(modelId).digest("base64")
|
return ''
|
||||||
return hash
|
// const hash = createHmac('sha256', this.apiSecret).update(modelId).digest("base64")
|
||||||
|
// return hash
|
||||||
}
|
}
|
||||||
|
|
||||||
// Implement the required LocalProvider interface methods
|
// Implement the required LocalProvider interface methods
|
||||||
|
|||||||
@ -288,6 +288,7 @@ export default class JanModelExtension extends ModelExtension {
|
|||||||
* @param model
|
* @param model
|
||||||
*/
|
*/
|
||||||
async getSources(): Promise<ModelSource[]> {
|
async getSources(): Promise<ModelSource[]> {
|
||||||
|
return []
|
||||||
const sources = await this.apiInstance()
|
const sources = await this.apiInstance()
|
||||||
.then((api) => api.get('v1/models/sources').json<Data<ModelSource>>())
|
.then((api) => api.get('v1/models/sources').json<Data<ModelSource>>())
|
||||||
.then((e) => (typeof e === 'object' ? (e.data as ModelSource[]) : []))
|
.then((e) => (typeof e === 'object' ? (e.data as ModelSource[]) : []))
|
||||||
@ -304,6 +305,7 @@ export default class JanModelExtension extends ModelExtension {
|
|||||||
* @param model
|
* @param model
|
||||||
*/
|
*/
|
||||||
async addSource(source: string): Promise<any> {
|
async addSource(source: string): Promise<any> {
|
||||||
|
return
|
||||||
return this.apiInstance().then((api) =>
|
return this.apiInstance().then((api) =>
|
||||||
api.post('v1/models/sources', {
|
api.post('v1/models/sources', {
|
||||||
json: {
|
json: {
|
||||||
@ -353,6 +355,7 @@ export default class JanModelExtension extends ModelExtension {
|
|||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
async fetchModels(): Promise<Model[]> {
|
async fetchModels(): Promise<Model[]> {
|
||||||
|
return []
|
||||||
return this.apiInstance()
|
return this.apiInstance()
|
||||||
.then((api) => api.get('v1/models?limit=-1').json<Data<Model>>())
|
.then((api) => api.get('v1/models?limit=-1').json<Data<Model>>())
|
||||||
.then((e) =>
|
.then((e) =>
|
||||||
@ -401,6 +404,7 @@ export default class JanModelExtension extends ModelExtension {
|
|||||||
* Fetch models from cortex.so
|
* Fetch models from cortex.so
|
||||||
*/
|
*/
|
||||||
fetchModelsHub = async () => {
|
fetchModelsHub = async () => {
|
||||||
|
return
|
||||||
const models = await this.fetchModels()
|
const models = await this.fetchModels()
|
||||||
|
|
||||||
defaultModelSources.forEach((model) => {
|
defaultModelSources.forEach((model) => {
|
||||||
|
|||||||
@ -87,7 +87,7 @@ pub async fn load_llama_model(
|
|||||||
let mut command = Command::new(server_path);
|
let mut command = Command::new(server_path);
|
||||||
|
|
||||||
let model_path = args[2].replace("-m", "");
|
let model_path = args[2].replace("-m", "");
|
||||||
let api_key = args[1].replace("--api-key", "")
|
let api_key = args[1].replace("--api-key", "");
|
||||||
command.args(args);
|
command.args(args);
|
||||||
|
|
||||||
// Optional: Redirect stdio if needed (e.g., for logging within Jan)
|
// Optional: Redirect stdio if needed (e.g., for logging within Jan)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user