Skip to content
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions extensions/llamacpp-extension/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,7 @@ export default class llamacpp_extension extends AIEngine {
}

private async generateApiKey(modelId: string, port: string): Promise<string> {
const hash = await invoke<string>('generate_api_key', {
const hash = await invoke<string>('plugin:llamacpp|generate_api_key', {
modelId: modelId + port,
apiSecret: this.apiSecret,
})
Expand Down Expand Up @@ -1101,7 +1101,7 @@ export default class llamacpp_extension extends AIEngine {
*/
private async getRandomPort(): Promise<number> {
try {
const port = await invoke<number>('get_random_port')
const port = await invoke<number>('plugin:llamacpp|get_random_port')
return port
} catch {
logger.error('Unable to find a suitable port')
Expand Down Expand Up @@ -1279,7 +1279,7 @@ export default class llamacpp_extension extends AIEngine {

try {
// TODO: add LIBRARY_PATH
const sInfo = await invoke<SessionInfo>('load_llama_model', {
const sInfo = await invoke<SessionInfo>('plugin:llamacpp|load_llama_model', {
backendPath,
libraryPath,
args,
Expand All @@ -1299,7 +1299,7 @@ export default class llamacpp_extension extends AIEngine {
const pid = sInfo.pid
try {
// Pass the PID as the session_id
const result = await invoke<UnloadResult>('unload_llama_model', {
const result = await invoke<UnloadResult>('plugin:llamacpp|unload_llama_model', {
pid: pid,
})

Expand Down Expand Up @@ -1437,7 +1437,7 @@ export default class llamacpp_extension extends AIEngine {

private async findSessionByModel(modelId: string): Promise<SessionInfo> {
try {
let sInfo = await invoke<SessionInfo>('find_session_by_model', {
let sInfo = await invoke<SessionInfo>('plugin:llamacpp|find_session_by_model', {
modelId,
})
return sInfo
Expand All @@ -1456,7 +1456,7 @@ export default class llamacpp_extension extends AIEngine {
throw new Error(`No active session found for model: ${opts.model}`)
}
// check if the process is alive
const result = await invoke<boolean>('is_process_running', {
const result = await invoke<boolean>('plugin:llamacpp|is_process_running', {
pid: sessionInfo.pid,
})
if (result) {
Expand Down Expand Up @@ -1516,7 +1516,7 @@ export default class llamacpp_extension extends AIEngine {

override async getLoadedModels(): Promise<string[]> {
try {
let models: string[] = await invoke<string[]>('get_loaded_models')
let models: string[] = await invoke<string[]>('plugin:llamacpp|get_loaded_models')
return models
} catch (e) {
logger.error(e)
Expand All @@ -1539,7 +1539,7 @@ export default class llamacpp_extension extends AIEngine {
const backendPath = await getBackendExePath(backend, version)
const libraryPath = await joinPath([await this.getProviderPath(), 'lib'])
try {
const dList = await invoke<DeviceList[]>('get_devices', {
const dList = await invoke<DeviceList[]>('plugin:llamacpp|get_devices', {
backendPath,
libraryPath,
})
Expand Down Expand Up @@ -1601,7 +1601,7 @@ export default class llamacpp_extension extends AIEngine {

private async loadMetadata(path: string): Promise<GgufMetadata> {
try {
const data = await invoke<GgufMetadata>('read_gguf_metadata', {
const data = await invoke<GgufMetadata>('plugin:llamacpp|read_gguf_metadata', {
path: path,
})
return data
Expand Down
Loading
Loading