mirror of
https://github.com/NovaOSS/nova-betterchat.git
synced 2024-11-25 19:33:59 +01:00
fix: chat import model
This commit is contained in:
parent
29013bbd76
commit
325da54e4c
|
@ -3,7 +3,11 @@ import html2canvas from 'html2canvas';
|
|||
import { ChatInterface, ConfigInterface, MessageInterface } from '@type/chat';
|
||||
import { roles } from '@type/chat';
|
||||
import { Theme } from '@type/theme';
|
||||
import { _defaultChatConfig } from '@constants/chat';
|
||||
import {
|
||||
defaultModel,
|
||||
modelOptions,
|
||||
_defaultChatConfig,
|
||||
} from '@constants/chat';
|
||||
|
||||
export const validateAndFixChats = (chats: any): chats is ChatInterface[] => {
|
||||
if (!Array.isArray(chats)) return false;
|
||||
|
@ -49,6 +53,9 @@ const validateAndFixChatConfig = (config: ConfigInterface) => {
|
|||
config.frequency_penalty = _defaultChatConfig.frequency_penalty;
|
||||
if (!(typeof config.frequency_penalty === 'number')) return false;
|
||||
|
||||
if (!config.model) config.model = defaultModel;
|
||||
if (!modelOptions.includes(config.model)) return false;
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue