File tree Expand file tree Collapse file tree 3 files changed +37
-2
lines changed Expand file tree Collapse file tree 3 files changed +37
-2
lines changed Original file line number Diff line number Diff line change 1
1
import Configuration from "../configuration" ;
2
+ import { Config } from '../config' ;
3
+ import * as vscode from 'vscode' ;
4
+ import { stat } from 'fs/promises' ;
5
+ import ollama , { ListResponse } from "ollama" ;
6
+ import { AiProvider , LLMConfig } from "./types" ;
2
7
3
- export type AiProvider = "Ollama" | "GitHub Copilot" ;
8
+
9
+ export class AiModelQuickPick implements vscode . QuickPickItem {
10
+ label : string // model title
11
+ description ?: string ; // model details
12
+ detail ?: string ; // ai provider
13
+
14
+ constructor ( object : LLMConfig ) {
15
+ this . label = object . model ;
16
+ this . description = object . provider ;
17
+ }
18
+ }
19
+
20
+ export async function getOllamaModels ( ) {
21
+ const ollamaModels : ListResponse = await ollama . list ( ) ;
22
+ const formattedModels : LLMConfig [ ] = ollamaModels . models . map ( ( model ) => {
23
+ return {
24
+ model : model . name , // Assuming 'id' is the correct property for the model identifier
25
+ provider : "Ollama" as AiProvider ,
26
+ } ;
27
+ } ) ;
28
+
29
+ return formattedModels ;
30
+ }
4
31
5
32
export class AiConfig {
33
+
6
34
static getProvider ( ) : AiProvider {
7
35
return Configuration . get < AiProvider > ( `ai.provider` ) ;
8
36
}
Original file line number Diff line number Diff line change 7
7
LanguageModelChatResponse ,
8
8
} from "vscode" ;
9
9
import Configuration from "../configuration" ;
10
- import { AiConfig , AiProvider } from "./aiConfig" ;
10
+ import { AiConfig } from "./aiConfig" ;
11
+ import { AiProvider } from "./types" ;
11
12
12
13
export async function chatRequest (
13
14
provider : AiProvider ,
Original file line number Diff line number Diff line change
1
+ export interface LLMConfig {
2
+ model : string ;
3
+ provider : AiProvider
4
+ }
5
+
6
+ export type AiProvider = "Ollama" | "GitHub Copilot" ;
You can’t perform that action at this time.
0 commit comments