mirror of
https://github.com/ItzCrazyKns/Perplexica.git
synced 2025-09-15 22:01:33 +00:00
Compare commits
5 Commits
238bcaff2b
...
master
Author | SHA1 | Date | |
---|---|---|---|
|
b8e4152e77 | ||
|
c8ac9279bd | ||
|
6f367c34a8 | ||
|
328b12ffbe | ||
|
d8486e90bb |
@@ -107,8 +107,8 @@ const AttachSmall = () => {
|
|||||||
key={i}
|
key={i}
|
||||||
className="flex flex-row items-center justify-start w-full space-x-3 p-3"
|
className="flex flex-row items-center justify-start w-full space-x-3 p-3"
|
||||||
>
|
>
|
||||||
<div className="bg-dark-100 flex items-center justify-center w-10 h-10 rounded-md">
|
<div className="bg-light-100 dark:bg-dark-100 flex items-center justify-center w-10 h-10 rounded-md">
|
||||||
<File size={16} className="text-white/70" />
|
<File size={16} className="text-black/70 dark:text-white/70" />
|
||||||
</div>
|
</div>
|
||||||
<p className="text-black/70 dark:text-white/70 text-sm">
|
<p className="text-black/70 dark:text-white/70 text-sm">
|
||||||
{file.fileName.length > 25
|
{file.fileName.length > 25
|
||||||
|
@@ -120,7 +120,11 @@ export const getAvailableChatModelProviders = async () => {
|
|||||||
model: new ChatOpenAI({
|
model: new ChatOpenAI({
|
||||||
apiKey: customOpenAiApiKey,
|
apiKey: customOpenAiApiKey,
|
||||||
modelName: customOpenAiModelName,
|
modelName: customOpenAiModelName,
|
||||||
temperature: 0.7,
|
...((() => {
|
||||||
|
const temperatureRestrictedModels = ['gpt-5-nano','gpt-5','gpt-5-mini','o1', 'o3', 'o3-mini', 'o4-mini'];
|
||||||
|
const isTemperatureRestricted = temperatureRestrictedModels.some(restrictedModel => customOpenAiModelName.includes(restrictedModel));
|
||||||
|
return isTemperatureRestricted ? {} : { temperature: 0.7 };
|
||||||
|
})()),
|
||||||
configuration: {
|
configuration: {
|
||||||
baseURL: customOpenAiApiUrl,
|
baseURL: customOpenAiApiUrl,
|
||||||
},
|
},
|
||||||
|
@@ -26,6 +26,10 @@ const openaiChatModels: Record<string, string>[] = [
|
|||||||
displayName: 'GPT-4 omni',
|
displayName: 'GPT-4 omni',
|
||||||
key: 'gpt-4o',
|
key: 'gpt-4o',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
displayName: 'GPT-4o (2024-05-13)',
|
||||||
|
key: 'gpt-4o-2024-05-13',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
displayName: 'GPT-4 omni mini',
|
displayName: 'GPT-4 omni mini',
|
||||||
key: 'gpt-4o-mini',
|
key: 'gpt-4o-mini',
|
||||||
@@ -47,12 +51,28 @@ const openaiChatModels: Record<string, string>[] = [
|
|||||||
key: 'gpt-5-nano',
|
key: 'gpt-5-nano',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'GPT 5 mini',
|
displayName: 'GPT 5',
|
||||||
|
key: 'gpt-5',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'GPT 5 Mini',
|
||||||
key: 'gpt-5-mini',
|
key: 'gpt-5-mini',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'GPT 5',
|
displayName: 'o1',
|
||||||
key: 'gpt-5',
|
key: 'o1',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'o3',
|
||||||
|
key: 'o3',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'o3 Mini',
|
||||||
|
key: 'o3-mini',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'o4 Mini',
|
||||||
|
key: 'o4-mini',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -76,13 +96,23 @@ export const loadOpenAIChatModels = async () => {
|
|||||||
const chatModels: Record<string, ChatModel> = {};
|
const chatModels: Record<string, ChatModel> = {};
|
||||||
|
|
||||||
openaiChatModels.forEach((model) => {
|
openaiChatModels.forEach((model) => {
|
||||||
chatModels[model.key] = {
|
// Models that only support temperature = 1
|
||||||
displayName: model.displayName,
|
const temperatureRestrictedModels = ['gpt-5-nano','gpt-5','gpt-5-mini','o1', 'o3', 'o3-mini', 'o4-mini'];
|
||||||
model: new ChatOpenAI({
|
const isTemperatureRestricted = temperatureRestrictedModels.some(restrictedModel => model.key.includes(restrictedModel));
|
||||||
|
|
||||||
|
const modelConfig: any = {
|
||||||
apiKey: openaiApiKey,
|
apiKey: openaiApiKey,
|
||||||
modelName: model.key,
|
modelName: model.key,
|
||||||
temperature: model.key.includes('gpt-5') ? 1 : 0.7,
|
};
|
||||||
}) as unknown as BaseChatModel,
|
|
||||||
|
// Only add temperature if the model supports it
|
||||||
|
if (!isTemperatureRestricted) {
|
||||||
|
modelConfig.temperature = 0.7;
|
||||||
|
}
|
||||||
|
|
||||||
|
chatModels[model.key] = {
|
||||||
|
displayName: model.displayName,
|
||||||
|
model: new ChatOpenAI(modelConfig) as unknown as BaseChatModel,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user