File size: 638 Bytes
6e6dab9
 
 
 
 
 
 
4a1d039
6e6dab9
 
 
fb77726
6e6dab9
 
 
 
 
fb77726
6e6dab9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import { request_available_models, available_models } from "./llm_requester.js";

export async function setup_available_models_on_select(default_option = null) {
    var select = $("#available-models-select");
    select.empty();
    await request_available_models();
    if (default_option === null) {
        default_option = "gpt-3.5-turbo";
    }

    available_models.forEach((value, index) => {
        const option = new Option(value, value);
        select.append(option);
        if (value === default_option) {
            $(option).prop("selected", true);
        }
    });
    console.log(`Default model: ${select.val()}`);
}