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()
|
||||||
@ -60,12 +60,13 @@ export default class JanEngineManagementExtension extends EngineManagementExtens
|
|||||||
/**
|
/**
|
||||||
* Called when the extension is unloaded.
|
* Called when the extension is unloaded.
|
||||||
*/
|
*/
|
||||||
onUnload() {}
|
onUnload() { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @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}`)
|
||||||
@ -223,7 +225,7 @@ export default class JanEngineManagementExtension extends EngineManagementExtens
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
.then((e) => e)
|
.then((e) => e)
|
||||||
.then(() => {})
|
.then(() => { })
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -346,7 +348,7 @@ export default class JanEngineManagementExtension extends EngineManagementExtens
|
|||||||
events.emit(EngineEvent.OnEngineUpdate, {})
|
events.emit(EngineEvent.OnEngineUpdate, {})
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
DEFAULT_REMOTE_MODELS.map((data: Model) =>
|
DEFAULT_REMOTE_MODELS.map((data: Model) =>
|
||||||
this.addRemoteModel(data).catch(() => {})
|
this.addRemoteModel(data).catch(() => { })
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
events.emit(ModelEvent.OnModelsUpdate, { fetch: true })
|
events.emit(ModelEvent.OnModelsUpdate, { fetch: true })
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
@ -87,7 +87,7 @@ export default class JanModelExtension extends ModelExtension {
|
|||||||
* Called when the extension is unloaded.
|
* Called when the extension is unloaded.
|
||||||
* @override
|
* @override
|
||||||
*/
|
*/
|
||||||
async onUnload() {}
|
async onUnload() { }
|
||||||
|
|
||||||
// BEGIN: - Public API
|
// BEGIN: - Public API
|
||||||
/**
|
/**
|
||||||
@ -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) =>
|
||||||
@ -393,7 +396,7 @@ export default class JanModelExtension extends ModelExtension {
|
|||||||
[key: string]: any
|
[key: string]: any
|
||||||
}): Promise<void> {
|
}): Promise<void> {
|
||||||
return this.apiInstance()
|
return this.apiInstance()
|
||||||
.then((api) => api.patch('v1/configs', { json: body }).then(() => {}))
|
.then((api) => api.patch('v1/configs', { json: body }).then(() => { }))
|
||||||
.catch((e) => console.debug(e))
|
.catch((e) => console.debug(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