mirror of
https://github.com/nomic-ai/gpt4all.git
synced 2025-06-23 05:58:48 +00:00
Add whitelist of openai models.
Signed-off-by: Adam Treat <treat.adam@gmail.com>
This commit is contained in:
parent
51c45e5d47
commit
e6429140dd
@ -62,6 +62,15 @@ ColumnLayout {
|
||||
providerName: qsTr("OpenAI")
|
||||
providerImage: "qrc:/gpt4all/icons/openai.svg"
|
||||
providerDesc: qsTr('OpenAI provides access to advanced AI models, including GPT-4 supporting a wide range of applications, from conversational AI to content generation and code completion.<br><br>Get your API key: <a href="https://platform.openai.com/signup">https://openai.com/</a>')
|
||||
Component.onCompleted: {
|
||||
filterModels = function(names) {
|
||||
// Define a whitelist of allowed names
|
||||
var whitelist = ["gpt-3.5-turbo", "gpt-4o", "gpt-4", "gpt-4-turbo", "gpt-4-32k", "gpt-3.5-turbo-16k"];
|
||||
|
||||
// Filter names based on the whitelist
|
||||
return names.filter(name => whitelist.includes(name));
|
||||
}
|
||||
}
|
||||
}
|
||||
RemoteModelCard {
|
||||
Layout.preferredWidth: 600
|
||||
|
@ -23,6 +23,9 @@ Rectangle {
|
||||
property alias providerDesc: providerDescLabel.helpText
|
||||
property string providerBaseUrl: ""
|
||||
property bool providerIsCustom: false
|
||||
property var filterModels: function(names) {
|
||||
return names;
|
||||
};
|
||||
|
||||
color: theme.conversationBackground
|
||||
radius: 10
|
||||
@ -103,7 +106,7 @@ Rectangle {
|
||||
onTextChanged: {
|
||||
apiKeyField.placeholderTextColor = theme.mutedTextColor;
|
||||
if (!providerIsCustom) {
|
||||
myModelList.model = ModelList.remoteModelList(apiKeyField.text, providerBaseUrl);
|
||||
myModelList.model = filterModels(ModelList.remoteModelList(apiKeyField.text, providerBaseUrl));
|
||||
myModelList.currentIndex = -1;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user