@@ -7,6 +7,7 @@ import { getFromPromptCache, setPromptToCache } from './promptCache';
77import { isNotNeeded , isSupported } from './filter' ;
88import { ollamaCheckModel } from '../modules/ollamaCheckModel' ;
99import { ollamaDownloadModel } from '../modules/ollamaDownloadModel' ;
10+ import { config } from '../config' ;
1011
1112export class PromptProvider implements vscode . InlineCompletionItemProvider {
1213
@@ -62,22 +63,23 @@ export class PromptProvider implements vscode.InlineCompletionItemProvider {
6263 if ( cached === undefined ) {
6364
6465 // Config
65- let config = vscode . workspace . getConfiguration ( 'inference' ) ;
66- let endpoint = config . get ( 'endpoint' ) as string ;
67- let model = config . get ( 'model' ) as string ;
68- let maxLines = config . get ( 'maxLines' ) as number ;
69- let maxTokens = config . get ( 'maxTokens' ) as number ;
70- let temperature = config . get ( 'temperature' ) as number ;
71- if ( endpoint . endsWith ( '/' ) ) {
72- endpoint = endpoint . slice ( 0 , endpoint . length - 1 ) ;
73- }
66+ let inferenceConfig = config . inference ;
67+ // let config = vscode.workspace.getConfiguration('inference');
68+ // let endpoint = config.get('endpoint') as string;
69+ // let model = config.get('model') as string;
70+ // let maxLines = config.get('maxLines') as number;
71+ // let maxTokens = config.get('maxTokens') as number;
72+ // let temperature = config.get('temperature') as number;
73+ // if (endpoint.endsWith('/')) {
74+ // endpoint = endpoint.slice(0, endpoint.length - 1);
75+ // }
7476
7577 // Update status
7678 this . statusbar . text = `$(sync~spin) Llama Coder` ;
7779 try {
7880
7981 // Check model exists
80- let modelExists = await ollamaCheckModel ( endpoint , model ) ;
82+ let modelExists = await ollamaCheckModel ( inferenceConfig . endpoint , inferenceConfig . modelName ) ;
8183 if ( token . isCancellationRequested ) {
8284 info ( `Canceled after AI completion.` ) ;
8385 return ;
@@ -86,7 +88,7 @@ export class PromptProvider implements vscode.InlineCompletionItemProvider {
8688 // Download model if not exists
8789 if ( ! modelExists ) {
8890 this . statusbar . text = `$(sync~spin) Downloading` ;
89- await ollamaDownloadModel ( endpoint , model ) ;
91+ await ollamaDownloadModel ( inferenceConfig . endpoint , inferenceConfig . modelName ) ;
9092 this . statusbar . text = `$(sync~spin) Llama Coder` ;
9193 }
9294 if ( token . isCancellationRequested ) {
@@ -99,11 +101,12 @@ export class PromptProvider implements vscode.InlineCompletionItemProvider {
99101 res = await autocomplete ( {
100102 prefix : prepared . prefix ,
101103 suffix : prepared . suffix ,
102- endpoint : endpoint ,
103- model : model ,
104- maxLines : maxLines ,
105- maxTokens : maxTokens ,
106- temperature,
104+ endpoint : inferenceConfig . endpoint ,
105+ model : inferenceConfig . modelName ,
106+ format : inferenceConfig . modelFormat ,
107+ maxLines : inferenceConfig . maxLines ,
108+ maxTokens : inferenceConfig . maxTokens ,
109+ temperature : inferenceConfig . temperature ,
107110 canceled : ( ) => token . isCancellationRequested ,
108111 } ) ;
109112 info ( `AI completion completed: ${ res } ` ) ;
0 commit comments