-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add an ability to set default model through an env config (#70)
* feat: use zod enums for models list * feat: use env to set default LLM models * feat: make models input optional
- Loading branch information
Showing
7 changed files
with
32 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,4 +11,4 @@ dist | |
|
||
# Env | ||
.env* | ||
!.env.sample | ||
!.env.example |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,20 @@ | ||
import { SUPPORTED_MODELS_MAP } from '../../llm/utils'; | ||
import type { AutocompleteHandler } from '../builder'; | ||
|
||
function get25ptions(models: typeof SUPPORTED_MODELS_MAP) { | ||
return models.slice(0, 25); | ||
} | ||
|
||
export const selectModelAutocomplete: AutocompleteHandler = async (interaction) => { | ||
const searchTerm = interaction.options.getString('model', true).trim().toLowerCase(); | ||
let searchTerm = interaction.options.getString('model', false); | ||
if (!searchTerm) { | ||
const options = get25ptions(SUPPORTED_MODELS_MAP); | ||
interaction.respond(options); | ||
return; | ||
} | ||
|
||
const options = SUPPORTED_MODELS_MAP.filter((model) => { | ||
if (!searchTerm) return true; | ||
return model.name.includes(searchTerm); | ||
}).slice(0, 25); | ||
searchTerm = searchTerm.trim().toLowerCase(); | ||
const filtered = SUPPORTED_MODELS_MAP.filter((model) => model.name.includes(searchTerm)); | ||
const options = get25ptions(filtered); | ||
interaction.respond(options); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters