Skip to content

Commit

Permalink
chore: add missing changes
Browse files Browse the repository at this point in the history
  • Loading branch information
louis-menlo committed Jan 28, 2025
1 parent 6ac59d4 commit 1bb9fb8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 38 deletions.
6 changes: 6 additions & 0 deletions core/src/browser/extensions/enginesManagement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
EngineReleased,
EngineConfig,
DefaultEngineVariant,
Model,
} from '../../types'
import { BaseExtension, ExtensionTypeEnum } from '../extension'

Expand Down Expand Up @@ -103,6 +104,11 @@ export abstract class EngineManagementExtension extends BaseExtension {
engineConfig?: EngineConfig
): Promise<{ messages: string }>

/**
* Add a new remote model for a specific engine
*/
abstract addRemoteModel(model: Model): Promise<void>

/**
* @returns A Promise that resolves to an object of remote models list .
*/
Expand Down
38 changes: 0 additions & 38 deletions web/hooks/useEngineManagement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import {
EngineConfig,
events,
EngineEvent,
ModelSource,
ModelSibling,
Model,
ModelEvent,
} from '@janhq/core'
Expand Down Expand Up @@ -417,39 +415,3 @@ export const addRemoteEngineModel = async (name: string, engine: string) => {
throw error
}
}

/**
* Remote model sources
* @returns A Promise that resolves to an object of model sources.
*/
export const useGetEngineModelSources = () => {
const { engines } = useGetEngines()
const downloadedModels = useAtomValue(downloadedModelsAtom)

return {
sources: Object.entries(engines ?? {})
?.filter((e) => e?.[1]?.[0]?.type === 'remote')
.map(
([key, values]) =>
({
id: key,
models: (
downloadedModels.filter((e) => e.engine === values[0]?.engine) ??
[]
).map(
(e) =>
({
id: e.id,
size: e.metadata?.size,
}) as unknown as ModelSibling
),
metadata: {
id: getTitleByEngine(key as InferenceEngine),
description: getDescriptionByEngine(key as InferenceEngine),
apiKey: values[0]?.api_key,
},
type: 'cloud',
}) as unknown as ModelSource
),
}
}

0 comments on commit 1bb9fb8

Please sign in to comment.