mirror of
https://github.com/open-webui/open-webui
synced 2024-11-22 08:07:55 +00:00
feat: gpt-* model support added
This commit is contained in:
parent
f54611fa32
commit
0801ee7dcc
@ -334,7 +334,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-2 text-xs text-gray-500">
|
||||
Adds optional support for 'gpt-3.5-turbo'.
|
||||
Adds optional support for 'gpt-*' models available.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -365,7 +365,7 @@
|
||||
|
||||
if (settings.OPENAI_API_KEY) {
|
||||
// Validate OPENAI_API_KEY
|
||||
const openaiModels = await fetch(`https://api.openai.com/v1/models`, {
|
||||
const openaiModelRes = await fetch(`https://api.openai.com/v1/models`, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
@ -381,14 +381,16 @@
|
||||
toast.error(`OpenAI: ${error.error.message}`);
|
||||
return null;
|
||||
});
|
||||
|
||||
console.log(openaiModels);
|
||||
const openaiModels = openaiModelRes.data;
|
||||
|
||||
if (openaiModels) {
|
||||
models = [
|
||||
...(res?.models ?? []),
|
||||
{ name: 'hr' },
|
||||
{ name: 'gpt-3.5-turbo', label: '(OpenAI)' }
|
||||
|
||||
...openaiModels
|
||||
.map((model) => ({ name: model.id, label: 'OpenAI' }))
|
||||
.filter((model) => model.name.includes('gpt'))
|
||||
];
|
||||
} else {
|
||||
models = res?.models ?? [];
|
||||
@ -401,7 +403,7 @@
|
||||
};
|
||||
|
||||
const sendPrompt = async (userPrompt) => {
|
||||
if (selectedModel === 'gpt-3.5-turbo') {
|
||||
if (selectedModel.includes('gpt-')) {
|
||||
await sendPromptOpenAI(userPrompt);
|
||||
} else {
|
||||
await sendPromptOllama(userPrompt);
|
||||
@ -532,7 +534,7 @@
|
||||
Authorization: `Bearer ${settings.OPENAI_API_KEY}`
|
||||
},
|
||||
body: JSON.stringify({
|
||||
model: 'gpt-3.5-turbo',
|
||||
model: selectedModel,
|
||||
stream: true,
|
||||
messages: messages.map((message) => ({ ...message, done: undefined }))
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user