fixup from refactoring

This commit is contained in:
Akarshan Biswas 2025-05-20 12:48:08 +05:30 committed by Louis
parent bbbf4779df
commit 0e9a8a27e5
No known key found for this signature in database
GPG Key ID: 44FA9F4D33C37DE2
2 changed files with 2 additions and 20 deletions

View File

@ -235,25 +235,7 @@ export default class llamacpp_extension
async chat( async chat(
opts: chatOptions opts: chatOptions
): Promise<chatCompletion | AsyncIterable<chatCompletionChunk>> { ): Promise<chatCompletion | AsyncIterable<chatCompletionChunk>> {
const sessionInfo = this.activeSessions.get(opts.sessionId) throw new Error("method not implemented yet")
if (!sessionInfo) {
throw new Error(
`No active session found for sessionId: ${opts.sessionId}`
)
}
// For streaming responses
if (opts.stream) {
return this.streamChat(opts)
}
// For non-streaming responses
try {
return await invoke<chatCompletion>('plugin:llamacpp|chat', { opts })
} catch (error) {
console.error('Error during chat completion:', error)
throw new Error(`Chat completion failed: ${error}`)
}
} }
async delete(opts: deleteOptions): Promise<deleteResult> { async delete(opts: deleteOptions): Promise<deleteResult> {

View File

@ -89,7 +89,7 @@ export interface modelInfo {
export interface listOptions { export interface listOptions {
providerId: string; // To specify which provider if a central manager calls this providerId: string; // To specify which provider if a central manager calls this
} }
export type listResult = ModelInfo[]; export type listResult = modelInfo[];
// 2. /pull // 2. /pull
export interface pullOptions { export interface pullOptions {