From ce3ad4882f00b9b2204e1192a733dd29eeaa3722 Mon Sep 17 00:00:00 2001 From: gray Date: Tue, 10 Dec 2024 09:09:00 +0800 Subject: [PATCH 01/22] adjust login ui --- src/FE/pages/login/index.tsx | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/FE/pages/login/index.tsx b/src/FE/pages/login/index.tsx index d1792d8e..4deb82f4 100644 --- a/src/FE/pages/login/index.tsx +++ b/src/FE/pages/login/index.tsx @@ -136,8 +136,8 @@ export default function LoginPage() { Chats -
-
+
+
{webSiteInfo?.filingNumber}
-
- © {new Date().getFullYear()} Chats™ . All Rights Reserved. -
{webSiteInfo?.companyName} -
+ +
+ © {new Date().getFullYear()}  + + ™ . All Rights Reserved. +
)} From 48e347ea5e88686bbf34261afef59204f10b2ea8 Mon Sep 17 00:00:00 2001 From: gray Date: Tue, 10 Dec 2024 17:23:33 +0800 Subject: [PATCH 02/22] optimize structure --- .../components/Chat/MemoizedChatMessage.tsx | 9 --- src/FE/components/Search/index.ts | 1 - src/FE/components/Spinner/index.ts | 1 - src/FE/pages/_app.tsx | 5 +- .../_components/ChangeModel}/ChangeModel.tsx | 7 +-- .../_components/ChatError}/ChatError.tsx | 1 - .../_components}/ChatIcon/ChatIcon.tsx | 5 +- .../ChatMessage/ChangeModelAction.tsx | 4 +- .../_components}/ChatMessage/ChatMessage.tsx | 25 +++++--- .../_components}/ChatMessage/CopyAction.tsx | 2 +- .../_components}/ChatMessage/EditAction.tsx | 3 +- .../ChatMessage/GenerateInformationAction.tsx | 33 ++++++---- .../ChatMessage/PaginationAction.tsx | 0 .../ChatMessage/RegenerateAction.tsx | 2 +- .../ChatMessage/ResponseMessage.tsx | 18 ++---- .../ChatMessage/ResponseMessageActions.tsx | 18 ++---- .../_components}/ChatMessage/UserMessage.tsx | 15 ++--- .../_components}/ChatMessage/index.ts | 0 .../_components}/Markdown/CodeBlock.tsx | 0 .../Markdown/MemoizedReactMarkdown.tsx | 0 .../_components}/Search/Search.tsx | 2 +- .../_components}/Tips/Tips.tsx | 0 .../_components}/Files/FileServiceModal.tsx | 0 .../GlobalConfigs/GlobalConfigsModal.tsx | 0 .../InvitationCode/InvitationCodeModal.tsx | 0 .../LoginService/LoginServiceModal.tsx | 0 .../_components}/Messages/ChatMessage.tsx | 63 ++++++++----------- .../ModelKeys/ConfigModelModal.tsx | 4 +- .../_components}/ModelKeys/ModelKeysModal.tsx | 9 +-- .../_components}/Models/AddModelModal.tsx | 0 .../_components}/Models/EditModelModal.tsx | 0 .../admin/_components}/Nav/Nav.tsx | 0 .../_components}/Pagiation/Pagiation.tsx | 0 .../PayService/PayServiceModal.tsx | 0 .../RequestLogs/RequestLogDetailsModal.tsx | 0 .../Users/EditUserBalanceModel.tsx | 0 .../_components}/Users/EditUserModelModal.tsx | 0 .../Users/UserInitialConfigModal.tsx | 0 .../admin/_components}/Users/UserModal.tsx | 0 src/FE/pages/admin/file-service/index.tsx | 2 +- src/FE/pages/admin/global-configs/index.tsx | 2 +- src/FE/pages/admin/invitation-code/index.tsx | 2 +- src/FE/pages/admin/layout/index.tsx | 2 +- src/FE/pages/admin/login-service/index.tsx | 2 +- src/FE/pages/admin/messages/index.tsx | 2 +- src/FE/pages/admin/model-keys/index.tsx | 4 +- src/FE/pages/admin/models/index.tsx | 4 +- src/FE/pages/admin/pay-service/index.tsx | 2 +- src/FE/pages/admin/request-logs/index.tsx | 4 +- src/FE/pages/admin/user-config/index.tsx | 2 +- src/FE/pages/admin/users/index.tsx | 8 +-- .../home/_components}/Button/CopyButton.tsx | 0 .../Button/SidebarActionButton.tsx | 0 .../home/_components}/Button/UploadButton.tsx | 2 +- .../home/_components}/Chat/AccountBalance.tsx | 2 +- .../home/_components}/Chat/Chat.tsx | 12 +++- .../_components}/Chat/ChatButtonTooltip.tsx | 0 .../home/_components}/Chat/ChatInput.tsx | 8 +-- .../home/_components}/Chat/ChatLoader.tsx | 0 .../_components}/Chat/EnableNetworkSearch.tsx | 0 .../_components/Chat/MemoizedChatMessage.tsx | 10 +++ .../home/_components}/Chat/ModelSelect.tsx | 4 +- .../home/_components}/Chat/NoModel.tsx | 2 +- .../home/_components}/Chat/PromptList.tsx | 0 .../_components}/Chat/SharedMessageModal.tsx | 0 .../home/_components}/Chat/SystemPrompt.tsx | 0 .../home/_components}/Chat/Temperature.tsx | 2 +- .../home/_components}/Chat/VariableModal.tsx | 0 .../ChatSettings/ChatSettings.tsx | 0 .../ChatSettings/ChatSettingsBar.tsx | 4 +- .../ChatSettings/SliderSetting.tsx | 0 .../_components}/Chatbar/Chatbar.context.tsx | 0 .../_components}/Chatbar/Chatbar.state.tsx | 0 .../home/_components}/Chatbar/Chatbar.tsx | 4 +- .../_components}/Chatbar/ChatbarSettings.tsx | 10 +-- .../Chatbar/ClearConversations.tsx | 2 +- .../_components}/Chatbar/Conversation.tsx | 10 +-- .../_components}/Chatbar/Conversations.tsx | 2 +- .../_components}/HomeContent/HomeContent.tsx | 15 +++-- .../Modal/ChangePasswordModal.tsx | 0 .../_components}/Modal/UserBalanceModal.tsx | 0 .../_components}/ModeToggle/ModeTooggle.tsx | 0 .../PageNotFound/PageNotFound.tsx | 0 .../_components}/PasteUpload/PasteUpload.tsx | 0 .../_components}/Popover/DateTimePopover.tsx | 0 .../_components}/Popover/DeletePopover.tsx | 0 .../Promptbar/PromptBar.context.tsx | 0 .../Promptbar/Promptbar.state.tsx | 0 .../home/_components}/Promptbar/Promptbar.tsx | 4 +- .../Promptbar/components/Prompt.tsx | 2 +- .../Promptbar/components/PromptModal.tsx | 6 +- .../components/PromptbarSettings.tsx | 0 .../Promptbar/components/Prompts.tsx | 0 .../home/_components}/Promptbar/index.ts | 0 .../Settings/ApiKeyTabContent.tsx | 6 +- .../_components}/Settings/SettingModal.tsx | 0 .../_components}/Sidebar/OpenCloseButton.tsx | 0 .../home/_components}/Sidebar/Sidebar.tsx | 4 +- .../_components}/Sidebar/SidebarButton.tsx | 0 .../home/_components}/Sidebar/index.ts | 0 .../home/_components}/Spinner/Spinner.tsx | 0 .../home/_contents}/Home.context.ts | 0 src/FE/pages/home/index.tsx | 2 +- .../login/_components}/AccountLoginCard.tsx | 0 .../login/_components}/KeyCloakLogin.tsx | 0 .../login/_components}/PhoneLoginCard.tsx | 0 .../login/_components}/PhoneRegisterCard.tsx | 0 .../login/_components}/WeChatLogin.tsx | 0 .../login/_components}/WeChatLoginModal.tsx | 2 +- src/FE/pages/login/_components/index.ts | 13 ++++ src/FE/pages/login/index.tsx | 13 ++-- src/FE/pages/message/[id].tsx | 3 +- src/FE/pages/share/[id].tsx | 12 ++-- .../Theme => providers}/ThemeProvider.tsx | 0 114 files changed, 208 insertions(+), 211 deletions(-) delete mode 100644 src/FE/components/Chat/MemoizedChatMessage.tsx delete mode 100644 src/FE/components/Search/index.ts delete mode 100644 src/FE/components/Spinner/index.ts rename src/FE/{components/Chat => pages/_components/ChangeModel}/ChangeModel.tsx (94%) rename src/FE/{components/Chat => pages/_components/ChatError}/ChatError.tsx (94%) rename src/FE/{components => pages/_components}/ChatIcon/ChatIcon.tsx (99%) rename src/FE/{components/Chat => pages/_components}/ChatMessage/ChangeModelAction.tsx (86%) rename src/FE/{components/Chat => pages/_components}/ChatMessage/ChatMessage.tsx (85%) rename src/FE/{components/Chat => pages/_components}/ChatMessage/CopyAction.tsx (96%) rename src/FE/{components/Chat => pages/_components}/ChatMessage/EditAction.tsx (93%) rename src/FE/{components/Chat => pages/_components}/ChatMessage/GenerateInformationAction.tsx (78%) rename src/FE/{components/Chat => pages/_components}/ChatMessage/PaginationAction.tsx (100%) rename src/FE/{components/Chat => pages/_components}/ChatMessage/RegenerateAction.tsx (94%) rename src/FE/{components/Chat => pages/_components}/ChatMessage/ResponseMessage.tsx (87%) rename src/FE/{components/Chat => pages/_components}/ChatMessage/ResponseMessageActions.tsx (91%) rename src/FE/{components/Chat => pages/_components}/ChatMessage/UserMessage.tsx (95%) rename src/FE/{components/Chat => pages/_components}/ChatMessage/index.ts (100%) rename src/FE/{components => pages/_components}/Markdown/CodeBlock.tsx (100%) rename src/FE/{components => pages/_components}/Markdown/MemoizedReactMarkdown.tsx (100%) rename src/FE/{components => pages/_components}/Search/Search.tsx (96%) rename src/FE/{components => pages/_components}/Tips/Tips.tsx (100%) rename src/FE/{components/Admin => pages/admin/_components}/Files/FileServiceModal.tsx (100%) rename src/FE/{components/Admin => pages/admin/_components}/GlobalConfigs/GlobalConfigsModal.tsx (100%) rename src/FE/{components/Admin => pages/admin/_components}/InvitationCode/InvitationCodeModal.tsx (100%) rename src/FE/{components/Admin => pages/admin/_components}/LoginService/LoginServiceModal.tsx (100%) rename src/FE/{components/Admin => pages/admin/_components}/Messages/ChatMessage.tsx (85%) rename src/FE/{components/Admin => pages/admin/_components}/ModelKeys/ConfigModelModal.tsx (98%) rename src/FE/{components/Admin => pages/admin/_components}/ModelKeys/ModelKeysModal.tsx (96%) rename src/FE/{components/Admin => pages/admin/_components}/Models/AddModelModal.tsx (100%) rename src/FE/{components/Admin => pages/admin/_components}/Models/EditModelModal.tsx (100%) rename src/FE/{components/Admin => pages/admin/_components}/Nav/Nav.tsx (100%) rename src/FE/{components/Admin => pages/admin/_components}/Pagiation/Pagiation.tsx (100%) rename src/FE/{components/Admin => pages/admin/_components}/PayService/PayServiceModal.tsx (100%) rename src/FE/{components/Admin => pages/admin/_components}/RequestLogs/RequestLogDetailsModal.tsx (100%) rename src/FE/{components/Admin => pages/admin/_components}/Users/EditUserBalanceModel.tsx (100%) rename src/FE/{components/Admin => pages/admin/_components}/Users/EditUserModelModal.tsx (100%) rename src/FE/{components/Admin => pages/admin/_components}/Users/UserInitialConfigModal.tsx (100%) rename src/FE/{components/Admin => pages/admin/_components}/Users/UserModal.tsx (100%) rename src/FE/{components => pages/home/_components}/Button/CopyButton.tsx (100%) rename src/FE/{components => pages/home/_components}/Button/SidebarActionButton.tsx (100%) rename src/FE/{components => pages/home/_components}/Button/UploadButton.tsx (96%) rename src/FE/{components => pages/home/_components}/Chat/AccountBalance.tsx (92%) rename src/FE/{components => pages/home/_components}/Chat/Chat.tsx (97%) rename src/FE/{components => pages/home/_components}/Chat/ChatButtonTooltip.tsx (100%) rename src/FE/{components => pages/home/_components}/Chat/ChatInput.tsx (97%) rename src/FE/{components => pages/home/_components}/Chat/ChatLoader.tsx (100%) rename src/FE/{components => pages/home/_components}/Chat/EnableNetworkSearch.tsx (100%) create mode 100644 src/FE/pages/home/_components/Chat/MemoizedChatMessage.tsx rename src/FE/{components => pages/home/_components}/Chat/ModelSelect.tsx (97%) rename src/FE/{components => pages/home/_components}/Chat/NoModel.tsx (91%) rename src/FE/{components => pages/home/_components}/Chat/PromptList.tsx (100%) rename src/FE/{components => pages/home/_components}/Chat/SharedMessageModal.tsx (100%) rename src/FE/{components => pages/home/_components}/Chat/SystemPrompt.tsx (100%) rename src/FE/{components => pages/home/_components}/Chat/Temperature.tsx (97%) rename src/FE/{components => pages/home/_components}/Chat/VariableModal.tsx (100%) rename src/FE/{components => pages/home/_components}/ChatSettings/ChatSettings.tsx (100%) rename src/FE/{components => pages/home/_components}/ChatSettings/ChatSettingsBar.tsx (92%) rename src/FE/{components => pages/home/_components}/ChatSettings/SliderSetting.tsx (100%) rename src/FE/{components => pages/home/_components}/Chatbar/Chatbar.context.tsx (100%) rename src/FE/{components => pages/home/_components}/Chatbar/Chatbar.state.tsx (100%) rename src/FE/{components => pages/home/_components}/Chatbar/Chatbar.tsx (95%) rename src/FE/{components => pages/home/_components}/Chatbar/ChatbarSettings.tsx (91%) rename src/FE/{components => pages/home/_components}/Chatbar/ClearConversations.tsx (94%) rename src/FE/{components => pages/home/_components}/Chatbar/Conversation.tsx (94%) rename src/FE/{components => pages/home/_components}/Chatbar/Conversations.tsx (94%) rename src/FE/{components => pages/home/_components}/HomeContent/HomeContent.tsx (96%) rename src/FE/{components => pages/home/_components}/Modal/ChangePasswordModal.tsx (100%) rename src/FE/{components => pages/home/_components}/Modal/UserBalanceModal.tsx (100%) rename src/FE/{components => pages/home/_components}/ModeToggle/ModeTooggle.tsx (100%) rename src/FE/{components => pages/home/_components}/PageNotFound/PageNotFound.tsx (100%) rename src/FE/{components => pages/home/_components}/PasteUpload/PasteUpload.tsx (100%) rename src/FE/{components => pages/home/_components}/Popover/DateTimePopover.tsx (100%) rename src/FE/{components => pages/home/_components}/Popover/DeletePopover.tsx (100%) rename src/FE/{components => pages/home/_components}/Promptbar/PromptBar.context.tsx (100%) rename src/FE/{components => pages/home/_components}/Promptbar/Promptbar.state.tsx (100%) rename src/FE/{components => pages/home/_components}/Promptbar/Promptbar.tsx (96%) rename src/FE/{components => pages/home/_components}/Promptbar/components/Prompt.tsx (97%) rename src/FE/{components => pages/home/_components}/Promptbar/components/PromptModal.tsx (97%) rename src/FE/{components => pages/home/_components}/Promptbar/components/PromptbarSettings.tsx (100%) rename src/FE/{components => pages/home/_components}/Promptbar/components/Prompts.tsx (100%) rename src/FE/{components => pages/home/_components}/Promptbar/index.ts (100%) rename src/FE/{components => pages/home/_components}/Settings/ApiKeyTabContent.tsx (95%) rename src/FE/{components => pages/home/_components}/Settings/SettingModal.tsx (100%) rename src/FE/{components => pages/home/_components}/Sidebar/OpenCloseButton.tsx (100%) rename src/FE/{components => pages/home/_components}/Sidebar/Sidebar.tsx (97%) rename src/FE/{components => pages/home/_components}/Sidebar/SidebarButton.tsx (100%) rename src/FE/{components => pages/home/_components}/Sidebar/index.ts (100%) rename src/FE/{components => pages/home/_components}/Spinner/Spinner.tsx (100%) rename src/FE/{contexts => pages/home/_contents}/Home.context.ts (100%) rename src/FE/{components/Login => pages/login/_components}/AccountLoginCard.tsx (100%) rename src/FE/{components/Login => pages/login/_components}/KeyCloakLogin.tsx (100%) rename src/FE/{components/Login => pages/login/_components}/PhoneLoginCard.tsx (100%) rename src/FE/{components/Login => pages/login/_components}/PhoneRegisterCard.tsx (100%) rename src/FE/{components/Login => pages/login/_components}/WeChatLogin.tsx (100%) rename src/FE/{components/Login => pages/login/_components}/WeChatLoginModal.tsx (95%) create mode 100644 src/FE/pages/login/_components/index.ts rename src/FE/{components/Theme => providers}/ThemeProvider.tsx (100%) diff --git a/src/FE/components/Chat/MemoizedChatMessage.tsx b/src/FE/components/Chat/MemoizedChatMessage.tsx deleted file mode 100644 index 8a95fd75..00000000 --- a/src/FE/components/Chat/MemoizedChatMessage.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { FC, memo } from 'react'; - -import { ChatMessage, Props } from './ChatMessage'; - -export const MemoizedChatMessage: FC = memo( - ChatMessage, - (prevProps, nextProps) => - prevProps.message.content === nextProps.message.content, -); diff --git a/src/FE/components/Search/index.ts b/src/FE/components/Search/index.ts deleted file mode 100644 index 85bb434b..00000000 --- a/src/FE/components/Search/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from './Search'; diff --git a/src/FE/components/Spinner/index.ts b/src/FE/components/Spinner/index.ts deleted file mode 100644 index f90663a5..00000000 --- a/src/FE/components/Spinner/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from './Spinner'; diff --git a/src/FE/pages/_app.tsx b/src/FE/pages/_app.tsx index 8c25e65d..04203d68 100644 --- a/src/FE/pages/_app.tsx +++ b/src/FE/pages/_app.tsx @@ -9,12 +9,11 @@ import { getUserInfo } from '@/utils/user'; import { UserRole } from '@/types/adminApis'; -import { ThemeProvider } from '@/components/Theme/ThemeProvider'; - import ErrorPage from './_error'; import AdminLayout from './admin/layout'; import './globals.css'; +import { ThemeProvider } from '@/providers/ThemeProvider'; import 'katex/dist/katex.min.css'; function App({ Component, pageProps }: AppProps<{}> | any) { @@ -25,7 +24,7 @@ function App({ Component, pageProps }: AppProps<{}> | any) { useEffect(() => { setIsClient(true); - document.title = "Chats"; + document.title = 'Chats'; }, []); const isAdmin = () => { diff --git a/src/FE/components/Chat/ChangeModel.tsx b/src/FE/pages/_components/ChangeModel/ChangeModel.tsx similarity index 94% rename from src/FE/components/Chat/ChangeModel.tsx rename to src/FE/pages/_components/ChangeModel/ChangeModel.tsx index 1e142c7e..71022853 100644 --- a/src/FE/components/Chat/ChangeModel.tsx +++ b/src/FE/pages/_components/ChangeModel/ChangeModel.tsx @@ -5,10 +5,9 @@ import useTranslation from '@/hooks/useTranslation'; import { AdminModelDto } from '@/types/adminApis'; import { feModelProviders } from '@/types/model'; -import ChatIcon from '@/components/ChatIcon/ChatIcon'; +import ChatIcon from '@/pages/_components/ChatIcon/ChatIcon'; import { IconChevronDown } from '@/components/Icons'; -import Search from '@/components/Search'; -import { Button } from '@/components/ui/button'; +import Search from '@/pages/_components/Search/Search'; import { DropdownMenu, DropdownMenuContent, @@ -21,7 +20,7 @@ import { DropdownMenuTrigger, } from '@/components/ui/dropdown-menu'; -import { HomeContext } from '@/contexts/Home.context'; +import { HomeContext } from '@/pages/home/_contents/Home.context'; import { cn } from '@/lib/utils'; const ChangeModel = ({ diff --git a/src/FE/components/Chat/ChatError.tsx b/src/FE/pages/_components/ChatError/ChatError.tsx similarity index 94% rename from src/FE/components/Chat/ChatError.tsx rename to src/FE/pages/_components/ChatError/ChatError.tsx index d6f42778..0bde22cf 100644 --- a/src/FE/components/Chat/ChatError.tsx +++ b/src/FE/pages/_components/ChatError/ChatError.tsx @@ -1,6 +1,5 @@ import useTranslation from '@/hooks/useTranslation'; -import { IconError } from '@/components/Icons'; import { Alert, AlertDescription } from '@/components/ui/alert'; interface Props { diff --git a/src/FE/components/ChatIcon/ChatIcon.tsx b/src/FE/pages/_components/ChatIcon/ChatIcon.tsx similarity index 99% rename from src/FE/components/ChatIcon/ChatIcon.tsx rename to src/FE/pages/_components/ChatIcon/ChatIcon.tsx index cf12780b..5d3f3ba5 100644 --- a/src/FE/components/ChatIcon/ChatIcon.tsx +++ b/src/FE/pages/_components/ChatIcon/ChatIcon.tsx @@ -1,9 +1,10 @@ +import useTranslation from '@/hooks/useTranslation'; + +import { feModelProviders } from '@/types/model'; import { IconShare } from '@/components/Icons'; -import useTranslation from '@/hooks/useTranslation'; import { cn } from '@/lib/utils'; -import { feModelProviders } from '@/types/model'; interface Props { providerId: number; diff --git a/src/FE/components/Chat/ChatMessage/ChangeModelAction.tsx b/src/FE/pages/_components/ChatMessage/ChangeModelAction.tsx similarity index 86% rename from src/FE/components/Chat/ChatMessage/ChangeModelAction.tsx rename to src/FE/pages/_components/ChatMessage/ChangeModelAction.tsx index a23d0a5f..f6be5937 100644 --- a/src/FE/components/Chat/ChatMessage/ChangeModelAction.tsx +++ b/src/FE/pages/_components/ChatMessage/ChangeModelAction.tsx @@ -1,7 +1,7 @@ import useTranslation from '@/hooks/useTranslation'; -import ChangeModel from '@/components/Chat/ChangeModel'; -import Tips from '@/components/Tips/Tips'; +import ChangeModel from '@/pages/_components/ChangeModel/ChangeModel'; +import Tips from '@/pages/_components/Tips/Tips'; interface Props { hidden?: boolean; diff --git a/src/FE/components/Chat/ChatMessage/ChatMessage.tsx b/src/FE/pages/_components/ChatMessage/ChatMessage.tsx similarity index 85% rename from src/FE/components/Chat/ChatMessage/ChatMessage.tsx rename to src/FE/pages/_components/ChatMessage/ChatMessage.tsx index bcf04a90..41672bdd 100644 --- a/src/FE/components/Chat/ChatMessage/ChatMessage.tsx +++ b/src/FE/pages/_components/ChatMessage/ChatMessage.tsx @@ -1,13 +1,11 @@ -import { FC, memo, useContext } from 'react'; +import { FC, memo } from 'react'; -import { Message } from '@/types/chat'; +import { IChat, Message } from '@/types/chat'; import { PropsMessage } from '@/types/components/chat'; -import { HomeContext } from '@/contexts/Home.context'; - import { IconRobot } from '@/components/Icons/index'; -import ChatError from '../ChatError'; +import ChatError from '../ChatError/ChatError'; import ResponseMessage from './ResponseMessage'; import ResponseMessageActions from './ResponseMessageActions'; import UserMessage from './UserMessage'; @@ -23,7 +21,11 @@ export interface Props { modelName?: string; modelId?: number; lastMessageId: string; + currentChatMessageId: string; message: PropsMessage; + messageIsStreaming: boolean; + chatError: boolean; + selectChat: IChat; onChangeMessage?: (messageId: string) => void; onEdit?: (editedMessage: Message, parentId: string | null) => void; onRegenerate?: (modelId?: number) => void; @@ -41,14 +43,14 @@ export const ChatMessage: FC = memo( modelId, lastMessageId, message, + messageIsStreaming, + currentChatMessageId, + chatError, + selectChat, onEdit, onChangeMessage, onRegenerate, }) => { - const { - state: { messageIsStreaming, currentChatMessageId, chatError }, - } = useContext(HomeContext); - return (
@@ -59,6 +61,8 @@ export const ChatMessage: FC = memo(
{message.role === 'user' && ( = memo( {message.role === 'assistant' && ( = memo( {message.role === 'assistant' && (
); }; + +export default SystemPrompt; diff --git a/src/FE/pages/home/_components/Chat/VariableModal.tsx b/src/FE/pages/home/_components/Chat/VariableModal.tsx index d989bea8..34f36edc 100644 --- a/src/FE/pages/home/_components/Chat/VariableModal.tsx +++ b/src/FE/pages/home/_components/Chat/VariableModal.tsx @@ -21,12 +21,7 @@ interface Props { onClose: () => void; } -export const VariableModal: FC = ({ - prompt, - variables, - onSubmit, - onClose, -}) => { +const VariableModal: FC = ({ prompt, variables, onSubmit, onClose }) => { const { t } = useTranslation(); const [updatedVariables, setUpdatedVariables] = useState< { key: string; value: string }[] @@ -112,3 +107,5 @@ export const VariableModal: FC = ({ ); }; + +export default VariableModal; diff --git a/src/FE/pages/home/_components/ChatSettings/ChatSettingsBar.tsx b/src/FE/pages/home/_components/ChatSettings/ChatSettingsBar.tsx index eefd2ceb..54a59091 100644 --- a/src/FE/pages/home/_components/ChatSettings/ChatSettingsBar.tsx +++ b/src/FE/pages/home/_components/ChatSettings/ChatSettingsBar.tsx @@ -1,9 +1,8 @@ -import { useContext, useEffect, useState } from 'react'; +import { useContext, useState } from 'react'; -import { HomeContext } from '@/pages/home/_contents/Home.context'; +import { IconX } from '@/components/Icons'; -import { IconX } from '../../../../components/Icons'; -import ChatSettings from './ChatSettings'; +import HomeContext from '../../_contents/Home.context'; import SliderSetting from './SliderSetting'; const ChatSettingsBar = () => { diff --git a/src/FE/pages/home/_components/Chatbar/Chatbar.context.tsx b/src/FE/pages/home/_components/Chatbar/Chatbar.context.tsx index 15f38cf1..c21f11db 100644 --- a/src/FE/pages/home/_components/Chatbar/Chatbar.context.tsx +++ b/src/FE/pages/home/_components/Chatbar/Chatbar.context.tsx @@ -2,13 +2,22 @@ import { Dispatch, createContext } from 'react'; import { ActionType } from '@/hooks/useCreateReducer'; -import { ChatbarInitialState } from './Chatbar.state'; +import { ChatResult } from '@/types/clientApis'; export interface ChatbarContextProps { state: ChatbarInitialState; dispatch: Dispatch>; handleDeleteChat: (chatId: string) => void; } +export interface ChatbarInitialState { + searchTerm: string; + filteredChats: ChatResult[]; +} + +export const initialState: ChatbarInitialState = { + searchTerm: '', + filteredChats: [], +}; const ChatbarContext = createContext(undefined!); diff --git a/src/FE/pages/home/_components/Chatbar/Chatbar.state.tsx b/src/FE/pages/home/_components/Chatbar/Chatbar.state.tsx deleted file mode 100644 index d871c528..00000000 --- a/src/FE/pages/home/_components/Chatbar/Chatbar.state.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import { ChatResult } from '@/types/clientApis'; - -export interface ChatbarInitialState { - searchTerm: string; - filteredChats: ChatResult[]; -} - -export const initialState: ChatbarInitialState = { - searchTerm: '', - filteredChats: [], -}; diff --git a/src/FE/pages/home/_components/Chatbar/Chatbar.tsx b/src/FE/pages/home/_components/Chatbar/Chatbar.tsx index e083435e..357c078c 100644 --- a/src/FE/pages/home/_components/Chatbar/Chatbar.tsx +++ b/src/FE/pages/home/_components/Chatbar/Chatbar.tsx @@ -7,16 +7,14 @@ import { removeSelectChatId, saveSelectChatId } from '@/utils/chats'; import { ChatResult } from '@/types/clientApis'; -import Sidebar from '@/pages/home/_components/Sidebar'; - +import HomeContext from '../../_contents/Home.context'; +import Sidebar from '../Sidebar/Sidebar'; import ChatbarContext from './Chatbar.context'; -import { ChatbarInitialState, initialState } from './Chatbar.state'; -import { ChatBarSettings } from './ChatbarSettings'; -import { Conversations } from './Conversations'; - -import { HomeContext } from '@/pages/home/_contents/Home.context'; +import { ChatbarInitialState, initialState } from './Chatbar.context'; +import ChatBarSettings from './ChatbarSettings'; +import Conversations from './Conversations'; -export const Chatbar = () => { +const Chatbar = () => { const { t } = useTranslation(); const chatBarContextValue = useCreateReducer({ @@ -102,3 +100,4 @@ export const Chatbar = () => { ); }; +export default Chatbar; diff --git a/src/FE/pages/home/_components/Chatbar/ChatbarSettings.tsx b/src/FE/pages/home/_components/Chatbar/ChatbarSettings.tsx index 1f98f5f9..99ff4f53 100644 --- a/src/FE/pages/home/_components/Chatbar/ChatbarSettings.tsx +++ b/src/FE/pages/home/_components/Chatbar/ChatbarSettings.tsx @@ -17,10 +17,6 @@ import { IconSettingsCog, IconUser, } from '@/components/Icons/index'; -import { ChangePasswordModal } from '@/pages/home/_components/Modal/ChangePasswordModal'; -import UserBalanceModal from '@/pages/home/_components/Modal/UserBalanceModal'; -import { SettingModal } from '@/pages/home/_components/Settings/SettingModal'; -import { SidebarButton } from '@/pages/home/_components/Sidebar/SidebarButton'; import { Popover, PopoverContent, @@ -28,10 +24,15 @@ import { } from '@/components/ui/popover'; import { Separator } from '@/components/ui/separator'; +import HomeContext from '../../_contents/Home.context'; +import ChangePasswordModal from '../Modal/ChangePasswordModal'; +import UserBalanceModal from '../Modal/UserBalanceModal'; +import SettingModal from '../Settings/SettingModal'; +import SidebarButton from '../Sidebar/SidebarButton'; + import { getUserBalanceOnly } from '@/apis/clientApis'; -import { HomeContext } from '@/pages/home/_contents/Home.context'; -export const ChatBarSettings = () => { +const ChatBarSettings = () => { const router = useRouter(); const { t } = useTranslation(); const [changePwdModalOpen, setChangePwdModalOpen] = useState(false); @@ -153,3 +154,4 @@ export const ChatBarSettings = () => {
); }; +export default ChatBarSettings; diff --git a/src/FE/pages/home/_components/Chatbar/ClearConversations.tsx b/src/FE/pages/home/_components/Chatbar/ClearConversations.tsx index cb0acead..fb4bfc32 100644 --- a/src/FE/pages/home/_components/Chatbar/ClearConversations.tsx +++ b/src/FE/pages/home/_components/Chatbar/ClearConversations.tsx @@ -3,13 +3,14 @@ import { FC, useState } from 'react'; import useTranslation from '@/hooks/useTranslation'; import { IconCheck, IconTrash, IconX } from '@/components/Icons/index'; -import { SidebarButton } from '@/pages/home/_components/Sidebar/SidebarButton'; + +import SidebarButton from '../Sidebar/SidebarButton'; interface Props { onClearConversations: () => void; } -export const ClearConversations: FC = ({ onClearConversations }) => { +const ClearConversations: FC = ({ onClearConversations }) => { const [isConfirming, setIsConfirming] = useState(false); const { t } = useTranslation(); @@ -55,3 +56,5 @@ export const ClearConversations: FC = ({ onClearConversations }) => { /> ); }; + +export default ClearConversations; diff --git a/src/FE/pages/home/_components/Chatbar/Conversation.tsx b/src/FE/pages/home/_components/Chatbar/Conversation.tsx index 480c72eb..895e04a8 100644 --- a/src/FE/pages/home/_components/Chatbar/Conversation.tsx +++ b/src/FE/pages/home/_components/Chatbar/Conversation.tsx @@ -10,12 +10,9 @@ import toast from 'react-hot-toast'; import useTranslation from '@/hooks/useTranslation'; import { ChatResult } from '@/types/clientApis'; -import { DBModelProvider } from '@/types/model'; -import SidebarActionButton from '@/pages/home/_components/Button/SidebarActionButton'; -import { SharedMessageModal } from '@/pages/home/_components/Chat/SharedMessageModal'; -import ChatIcon from '@/pages/_components/ChatIcon/ChatIcon'; -import ChatbarContext from '@/pages/home/_components/Chatbar/Chatbar.context'; +import SidebarActionButton from '@/components/Button/SidebarActionButton'; +import ChatIcon from '@/components/ChatIcon/ChatIcon'; import { IconCheck, IconDots, @@ -24,7 +21,6 @@ import { IconTrash, IconX, } from '@/components/Icons/index'; -import { Button } from '@/components/ui/button'; import { DropdownMenu, DropdownMenuContent, @@ -32,14 +28,17 @@ import { DropdownMenuTrigger, } from '@/components/ui/dropdown-menu'; +import HomeContext from '../../_contents/Home.context'; +import SharedMessageModal from '../Chat/SharedMessageModal'; +import ChatbarContext from '../Chatbar/Chatbar.context'; + import { deleteChats, putChats } from '@/apis/clientApis'; -import { HomeContext } from '@/pages/home/_contents/Home.context'; interface Props { chat: ChatResult; } -export const ConversationComponent = ({ chat }: Props) => { +const ConversationComponent = ({ chat }: Props) => { const { t } = useTranslation(); const { state: { @@ -215,3 +214,5 @@ export const ConversationComponent = ({ chat }: Props) => {
); }; + +export default ConversationComponent; diff --git a/src/FE/pages/home/_components/Chatbar/Conversations.tsx b/src/FE/pages/home/_components/Chatbar/Conversations.tsx index d6d09323..c4c3b0d0 100644 --- a/src/FE/pages/home/_components/Chatbar/Conversations.tsx +++ b/src/FE/pages/home/_components/Chatbar/Conversations.tsx @@ -4,17 +4,16 @@ import useTranslation from '@/hooks/useTranslation'; import { ChatResult } from '@/types/clientApis'; -import { HomeContext } from '@/pages/home/_contents/Home.context'; - import { Button } from '@/components/ui/button'; -import { ConversationComponent } from './Conversation'; +import HomeContext from '../../_contents/Home.context'; +import ConversationComponent from './Conversation'; interface Props { chats: ChatResult[]; } -export const Conversations = ({ chats }: Props) => { +const Conversations = ({ chats }: Props) => { const { t } = useTranslation(); const { state: { chatsPaging }, @@ -46,3 +45,4 @@ export const Conversations = ({ chats }: Props) => { ); }; +export default Conversations; diff --git a/src/FE/pages/home/_components/HomeContent/HomeContent.tsx b/src/FE/pages/home/_components/HomeContent/HomeContent.tsx index 6835cf2d..82aec4ff 100644 --- a/src/FE/pages/home/_components/HomeContent/HomeContent.tsx +++ b/src/FE/pages/home/_components/HomeContent/HomeContent.tsx @@ -21,11 +21,17 @@ import { DEFAULT_TEMPERATURE, IChat, Role } from '@/types/chat'; import { ChatMessage } from '@/types/chatMessage'; import { ChatResult, GetChatsParams } from '@/types/clientApis'; -import { Chat } from '@/pages/home/_components/Chat/Chat'; -import ChatSettingsBar from '@/pages/home/_components/ChatSettings/ChatSettingsBar'; -import { Chatbar } from '@/pages/home/_components/Chatbar/Chatbar'; -import PromptBar from '@/pages/home/_components/Promptbar'; -import Spinner from '@/pages/home/_components/Spinner/Spinner'; +import Spinner from '@/components/Spinner/Spinner'; + +import HomeContext, { + HandleUpdateChatParams, + HomeInitialState, + initialState, +} from '../../_contents/Home.context'; +import Chat from '../Chat/Chat'; +import ChatSettingsBar from '../ChatSettings/ChatSettingsBar'; +import Chatbar from '../Chatbar/Chatbar'; +import PromptBar from '../Promptbar/Promptbar'; import { getChatsByPaging, @@ -35,12 +41,6 @@ import { getUserPromptBrief, postChats, } from '@/apis/clientApis'; -import { - HandleUpdateChatParams, - HomeContext, - HomeInitialState, - initialState, -} from '@/pages/home/_contents/Home.context'; import Decimal from 'decimal.js'; import { v4 as uuidv4 } from 'uuid'; diff --git a/src/FE/pages/home/_components/Modal/ChangePasswordModal.tsx b/src/FE/pages/home/_components/Modal/ChangePasswordModal.tsx index ae833119..a7ecf701 100644 --- a/src/FE/pages/home/_components/Modal/ChangePasswordModal.tsx +++ b/src/FE/pages/home/_components/Modal/ChangePasswordModal.tsx @@ -29,7 +29,7 @@ interface Props { onClose: () => void; } -export const ChangePasswordModal = (props: Props) => { +const ChangePasswordModal = (props: Props) => { const { isOpen, onClose } = props; const { t } = useTranslation(); const router = useRouter(); @@ -159,3 +159,4 @@ export const ChangePasswordModal = (props: Props) => { ); }; +export default ChangePasswordModal; diff --git a/src/FE/pages/home/_components/ModeToggle/ModeTooggle.tsx b/src/FE/pages/home/_components/ModeToggle/ModeToggle.tsx similarity index 92% rename from src/FE/pages/home/_components/ModeToggle/ModeTooggle.tsx rename to src/FE/pages/home/_components/ModeToggle/ModeToggle.tsx index fc6cb780..5c4ad186 100644 --- a/src/FE/pages/home/_components/ModeToggle/ModeTooggle.tsx +++ b/src/FE/pages/home/_components/ModeToggle/ModeToggle.tsx @@ -7,7 +7,7 @@ import { useTheme } from 'next-themes'; import { IconMoon, IconSun } from '@/components/Icons'; import { Button } from '@/components/ui/button'; -export function ModeToggle() { +function ModeToggle() { const { setTheme } = useTheme(); return ( @@ -25,3 +25,4 @@ export function ModeToggle() { ); } +export default ModeToggle; diff --git a/src/FE/pages/home/_components/Promptbar/components/Prompt.tsx b/src/FE/pages/home/_components/Promptbar/Prompt.tsx similarity index 93% rename from src/FE/pages/home/_components/Promptbar/components/Prompt.tsx rename to src/FE/pages/home/_components/Promptbar/Prompt.tsx index 799a77ee..0eb116b4 100644 --- a/src/FE/pages/home/_components/Promptbar/components/Prompt.tsx +++ b/src/FE/pages/home/_components/Promptbar/Prompt.tsx @@ -2,7 +2,7 @@ import { MouseEventHandler, useContext, useEffect, useState } from 'react'; import { Prompt, PromptSlim } from '@/types/prompt'; -import SidebarActionButton from '@/pages/home/_components/Button/SidebarActionButton'; +import SidebarActionButton from '@/components/Button/SidebarActionButton'; import { IconBulbFilled, IconCheck, @@ -10,8 +10,8 @@ import { IconX, } from '@/components/Icons/index'; -import PromptbarContext from '../PromptBar.context'; -import { PromptModal } from './PromptModal'; +import PromptbarContext from './PromptBar.context'; +import PromptModal from './PromptModal'; import { getUserPromptDetail } from '@/apis/clientApis'; @@ -19,7 +19,7 @@ interface Props { prompt: PromptSlim; } -export const PromptComponent = ({ prompt }: Props) => { +const PromptComponent = ({ prompt }: Props) => { const { dispatch: promptDispatch, handleUpdatePrompt, @@ -128,3 +128,4 @@ export const PromptComponent = ({ prompt }: Props) => { ); }; +export default PromptComponent; diff --git a/src/FE/pages/home/_components/Promptbar/PromptBar.context.tsx b/src/FE/pages/home/_components/Promptbar/PromptBar.context.tsx index 497cf510..9201a0ee 100644 --- a/src/FE/pages/home/_components/Promptbar/PromptBar.context.tsx +++ b/src/FE/pages/home/_components/Promptbar/PromptBar.context.tsx @@ -2,9 +2,8 @@ import { Dispatch, createContext } from 'react'; import { ActionType } from '@/hooks/useCreateReducer'; -import { Prompt, PromptSlim } from '@/types/prompt'; - -import { PromptbarInitialState } from './Promptbar.state'; +import { Prompt } from '@/types/prompt'; +import { PromptSlim } from '@/types/prompt'; export interface PromptbarContextProps { state: PromptbarInitialState; @@ -14,6 +13,16 @@ export interface PromptbarContextProps { handleUpdatePrompt: (prompt: Prompt) => void; } +export interface PromptbarInitialState { + searchTerm: string; + filteredPrompts: PromptSlim[]; +} + +export const initialState: PromptbarInitialState = { + searchTerm: '', + filteredPrompts: [], +}; + const PromptbarContext = createContext(undefined!); export default PromptbarContext; diff --git a/src/FE/pages/home/_components/Promptbar/components/PromptModal.tsx b/src/FE/pages/home/_components/Promptbar/PromptModal.tsx similarity index 96% rename from src/FE/pages/home/_components/Promptbar/components/PromptModal.tsx rename to src/FE/pages/home/_components/Promptbar/PromptModal.tsx index dab59137..c6d7e51f 100644 --- a/src/FE/pages/home/_components/Promptbar/components/PromptModal.tsx +++ b/src/FE/pages/home/_components/Promptbar/PromptModal.tsx @@ -9,9 +9,9 @@ import { UserRole } from '@/types/adminApis'; import { DEFAULT_TEMPERATURE } from '@/types/chat'; import { Prompt } from '@/types/prompt'; -import { TemperatureSlider } from '@/pages/home/_components/Chat/Temperature'; import { IconInfo } from '@/components/Icons'; -import Tips from '@/pages/_components/Tips/Tips'; +import TemperatureSlider from '@/components/TemperatureSlider/TemperatureSlider'; +import Tips from '@/components/Tips/Tips'; import { Button } from '@/components/ui/button'; import { Dialog, @@ -24,7 +24,8 @@ import FormInput from '@/components/ui/form/input'; import FormSwitch from '@/components/ui/form/switch'; import FormTextarea from '@/components/ui/form/textarea'; -import { HomeContext } from '@/pages/home/_contents/Home.context'; +import HomeContext from '../../_contents/Home.context'; + import { zodResolver } from '@hookform/resolvers/zod'; import { z } from 'zod'; @@ -34,7 +35,7 @@ interface IProps { onClose: () => void; } -export const PromptModal = (props: IProps) => { +const PromptModal = (props: IProps) => { const { t } = useTranslation(); const { prompt, onUpdatePrompt, onClose } = props; @@ -191,3 +192,4 @@ export const PromptModal = (props: IProps) => { ); }; +export default PromptModal; diff --git a/src/FE/pages/home/_components/Promptbar/Promptbar.state.tsx b/src/FE/pages/home/_components/Promptbar/Promptbar.state.tsx deleted file mode 100644 index 2a6ba0d2..00000000 --- a/src/FE/pages/home/_components/Promptbar/Promptbar.state.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import { PromptSlim } from '@/types/prompt'; - -export interface PromptbarInitialState { - searchTerm: string; - filteredPrompts: PromptSlim[]; -} - -export const initialState: PromptbarInitialState = { - searchTerm: '', - filteredPrompts: [], -}; diff --git a/src/FE/pages/home/_components/Promptbar/Promptbar.tsx b/src/FE/pages/home/_components/Promptbar/Promptbar.tsx index bc0ac466..744a550e 100644 --- a/src/FE/pages/home/_components/Promptbar/Promptbar.tsx +++ b/src/FE/pages/home/_components/Promptbar/Promptbar.tsx @@ -1,19 +1,16 @@ import { useContext, useEffect } from 'react'; import toast from 'react-hot-toast'; -import useTranslation from '@/hooks/useTranslation'; - import { useCreateReducer } from '@/hooks/useCreateReducer'; +import useTranslation from '@/hooks/useTranslation'; import { Prompt, PromptSlim } from '@/types/prompt'; -import { HomeContext } from '@/pages/home/_contents/Home.context'; - -import { Prompts } from './components/Prompts'; -import Sidebar from '@/pages/home/_components/Sidebar'; - +import HomeContext from '../../_contents/Home.context'; +import Sidebar from '../Sidebar/Sidebar'; import PromptbarContext from './PromptBar.context'; -import { PromptbarInitialState, initialState } from './Promptbar.state'; +import { PromptbarInitialState, initialState } from './PromptBar.context'; +import Prompts from './Prompts'; import { deleteUserPrompts, @@ -72,7 +69,7 @@ const PromptBar = () => { const handleUpdatePrompt = (prompt: Prompt) => { putUserPrompts(prompt.id, prompt).then(() => { - const existingPrompts = prompts.filter(x => x.id !== prompt.id); + const existingPrompts = prompts.filter((x) => x.id !== prompt.id); homeDispatch({ field: 'prompts', value: [...existingPrompts, prompt] }); toast.success(t('Updated successful')); }); diff --git a/src/FE/pages/home/_components/Promptbar/components/Prompts.tsx b/src/FE/pages/home/_components/Promptbar/Prompts.tsx similarity index 76% rename from src/FE/pages/home/_components/Promptbar/components/Prompts.tsx rename to src/FE/pages/home/_components/Promptbar/Prompts.tsx index 8b85569a..54e674c9 100644 --- a/src/FE/pages/home/_components/Promptbar/components/Prompts.tsx +++ b/src/FE/pages/home/_components/Promptbar/Prompts.tsx @@ -2,13 +2,13 @@ import { FC } from 'react'; import { PromptSlim } from '@/types/prompt'; -import { PromptComponent } from './Prompt'; +import PromptComponent from './Prompt'; interface Props { prompts: PromptSlim[]; } -export const Prompts: FC = ({ prompts }) => { +const Prompts: FC = ({ prompts }) => { return (
{prompts @@ -20,3 +20,4 @@ export const Prompts: FC = ({ prompts }) => {
); }; +export default Prompts; diff --git a/src/FE/pages/home/_components/Promptbar/components/PromptbarSettings.tsx b/src/FE/pages/home/_components/Promptbar/components/PromptbarSettings.tsx deleted file mode 100644 index 5fad6f9c..00000000 --- a/src/FE/pages/home/_components/Promptbar/components/PromptbarSettings.tsx +++ /dev/null @@ -1,7 +0,0 @@ -import { FC } from 'react'; - -interface Props {} - -export const PromptbarSettings: FC = () => { - return
; -}; diff --git a/src/FE/pages/home/_components/Promptbar/index.ts b/src/FE/pages/home/_components/Promptbar/index.ts deleted file mode 100644 index e3f6b39b..00000000 --- a/src/FE/pages/home/_components/Promptbar/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from './Promptbar'; diff --git a/src/FE/pages/home/_components/Settings/ApiKeyTabContent.tsx b/src/FE/pages/home/_components/Settings/ApiKeyTabContent.tsx index 3790c9dc..96970078 100644 --- a/src/FE/pages/home/_components/Settings/ApiKeyTabContent.tsx +++ b/src/FE/pages/home/_components/Settings/ApiKeyTabContent.tsx @@ -9,9 +9,7 @@ import { getApiUrl } from '@/utils/common'; import { GetUserApiKeyResult } from '@/types/clientApis'; -import CopyButton from '@/pages/home/_components/Button/CopyButton'; -import DateTimePopover from '@/pages/home/_components/Popover/DateTimePopover'; -import DeletePopover from '@/pages/home/_components/Popover/DeletePopover'; +import CopyButton from '@/components/Button/CopyButton'; import { Button } from '@/components/ui/button'; import { Card, CardContent } from '@/components/ui/card'; import { Input } from '@/components/ui/input'; @@ -24,6 +22,9 @@ import { TableRow, } from '@/components/ui/table'; +import DateTimePopover from '../Popover/DateTimePopover'; +import DeletePopover from '../Popover/DeletePopover'; + import { deleteUserApiKey, getUserApiKey, @@ -32,7 +33,7 @@ import { } from '@/apis/clientApis'; let timer: NodeJS.Timeout; -export const ApiKeyTab = () => { +const ApiKeyTab = () => { const { t } = useTranslation(); const [loading, setLoading] = useState(false); const [apiKeys, setApiKeys] = useState([]); @@ -178,3 +179,4 @@ export const ApiKeyTab = () => { ); }; +export default ApiKeyTab; diff --git a/src/FE/pages/home/_components/Settings/SettingModal.tsx b/src/FE/pages/home/_components/Settings/SettingModal.tsx index 5dd79942..fa0e92d8 100644 --- a/src/FE/pages/home/_components/Settings/SettingModal.tsx +++ b/src/FE/pages/home/_components/Settings/SettingModal.tsx @@ -9,14 +9,14 @@ import { DialogTitle, } from '@/components/ui/dialog'; -import { ApiKeyTab } from './ApiKeyTabContent'; +import ApiKeyTab from './ApiKeyTabContent'; interface Props { isOpen: boolean; onClose: () => void; } -export const SettingModal = (props: Props) => { +const SettingModal = (props: Props) => { const { isOpen, onClose } = props; const { t } = useTranslation(); @@ -33,3 +33,4 @@ export const SettingModal = (props: Props) => { ); }; +export default SettingModal; diff --git a/src/FE/pages/home/_components/Sidebar/OpenCloseButton.tsx b/src/FE/pages/home/_components/Sidebar/OpenCloseButton.tsx deleted file mode 100644 index 500ff79d..00000000 --- a/src/FE/pages/home/_components/Sidebar/OpenCloseButton.tsx +++ /dev/null @@ -1,69 +0,0 @@ -import { - IconLayoutSidebar, - IconLayoutSidebarRight, - IconX, -} from '@/components/Icons'; - -import { Button } from '@/components/ui/button'; - -interface Props { - onClick: () => void; - side: 'left' | 'right'; -} - -export const CloseSidebarButton = ({ onClick, side }: Props) => { - return ( -
- -
- ); -}; - -export const OpenSidebarButton = ({ onClick, side }: Props) => { - return ( -
- -
- ) : ( -
- -
- )} - - - - - ); -}; diff --git a/src/FE/pages/home/_components/Sidebar/Sidebar.tsx b/src/FE/pages/home/_components/Sidebar/Sidebar.tsx index 206a88c5..4fbc35c6 100644 --- a/src/FE/pages/home/_components/Sidebar/Sidebar.tsx +++ b/src/FE/pages/home/_components/Sidebar/Sidebar.tsx @@ -8,8 +8,8 @@ import { IconSearch, IconSquarePlus, } from '@/components/Icons/index'; -import Search from '@/pages/_components/Search/Search'; -import Tips from '@/pages/_components/Tips/Tips'; +import Search from '@/components/Search/Search'; +import Tips from '@/components/Tips/Tips'; import { Button } from '@/components/ui/button'; import { cn } from '@/lib/utils'; diff --git a/src/FE/pages/home/_components/Sidebar/SidebarButton.tsx b/src/FE/pages/home/_components/Sidebar/SidebarButton.tsx index 91ad5114..74a936a0 100644 --- a/src/FE/pages/home/_components/Sidebar/SidebarButton.tsx +++ b/src/FE/pages/home/_components/Sidebar/SidebarButton.tsx @@ -8,7 +8,7 @@ interface Props { onClick: () => void; } -export const SidebarButton: FC = ({ +const SidebarButton: FC = ({ text, icon, className, @@ -36,3 +36,4 @@ export const SidebarButton: FC = ({ ); }; +export default SidebarButton; diff --git a/src/FE/pages/home/_components/Sidebar/index.ts b/src/FE/pages/home/_components/Sidebar/index.ts deleted file mode 100644 index e842a859..00000000 --- a/src/FE/pages/home/_components/Sidebar/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from './Sidebar'; diff --git a/src/FE/pages/home/_contents/Home.context.ts b/src/FE/pages/home/_contents/Home.context.ts index 1064e755..26626062 100644 --- a/src/FE/pages/home/_contents/Home.context.ts +++ b/src/FE/pages/home/_contents/Home.context.ts @@ -40,7 +40,7 @@ export interface HomeInitialState { searchTerm: string; } -const initialState: HomeInitialState = { +export const initialState: HomeInitialState = { user: null, loading: false, messageIsStreaming: false, @@ -86,4 +86,4 @@ export interface HomeContextProps { const HomeContext = createContext(undefined!); -export { initialState, HomeContext }; +export default HomeContext; diff --git a/src/FE/pages/home/index.tsx b/src/FE/pages/home/index.tsx index 4a2b53bc..5afb5164 100644 --- a/src/FE/pages/home/index.tsx +++ b/src/FE/pages/home/index.tsx @@ -1,6 +1,6 @@ import Head from 'next/head'; -import HomeContent from '@/pages/home/_components/HomeContent/HomeContent'; +import HomeContent from './_components/HomeContent/HomeContent'; const Home = () => { return ( diff --git a/src/FE/pages/login/_components/WeChatLoginModal.tsx b/src/FE/pages/login/_components/WeChatLoginModal.tsx index 8e059cba..6502ab31 100644 --- a/src/FE/pages/login/_components/WeChatLoginModal.tsx +++ b/src/FE/pages/login/_components/WeChatLoginModal.tsx @@ -2,7 +2,7 @@ import { useEffect } from 'react'; import useExternal from '@/hooks/useExternal'; -import Spinner from '@/pages/home/_components/Spinner/Spinner'; +import Spinner from '@/components/Spinner/Spinner'; import { Dialog, DialogContent } from '@/components/ui/dialog'; const WeChatLoginModal = (props: { diff --git a/src/FE/pages/login/_components/index.ts b/src/FE/pages/login/_components/index.ts deleted file mode 100644 index 4521b8b9..00000000 --- a/src/FE/pages/login/_components/index.ts +++ /dev/null @@ -1,13 +0,0 @@ -import AccountLoginCard from './AccountLoginCard'; -import KeyCloakLogin from './KeyCloakLogin'; -import PhoneLoginCard from './PhoneLoginCard'; -import PhoneRegisterCard from './PhoneRegisterCard'; -import WeChatLogin from './WeChatLogin'; - -export { - AccountLoginCard, - KeyCloakLogin, - PhoneLoginCard, - PhoneRegisterCard, - WeChatLogin, -}; diff --git a/src/FE/pages/login/index.tsx b/src/FE/pages/login/index.tsx index f186403f..c256bb3a 100644 --- a/src/FE/pages/login/index.tsx +++ b/src/FE/pages/login/index.tsx @@ -11,13 +11,11 @@ import { LoginType } from '@/types/user'; import { Button } from '@/components/ui/button'; import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'; -import { - AccountLoginCard, - KeyCloakLogin, - PhoneLoginCard, - PhoneRegisterCard, - WeChatLogin, -} from './_components'; +import AccountLoginCard from './_components/AccountLoginCard'; +import KeyCloakLogin from './_components/KeyCloakLogin'; +import PhoneLoginCard from './_components/PhoneLoginCard'; +import PhoneRegisterCard from './_components/PhoneRegisterCard'; +import WeChatLogin from './_components/WeChatLogin'; import { getLoginProviders, getSiteInfo } from '@/apis/clientApis'; diff --git a/src/FE/pages/message/[id].tsx b/src/FE/pages/message/[id].tsx index 77689a1c..c62f7284 100644 --- a/src/FE/pages/message/[id].tsx +++ b/src/FE/pages/message/[id].tsx @@ -2,16 +2,16 @@ import { useEffect, useState } from 'react'; import { useRouter } from 'next/router'; +import { getQueryId } from '@/utils/common'; import { getSelectMessages } from '@/utils/message'; import { GetMessageDetailsResult } from '@/types/adminApis'; import { ChatMessage } from '@/types/chatMessage'; -import { ChatMessage as ChatMessageComponent } from '@/pages/admin/_components/Messages/ChatMessage'; +import { ChatMessageByReadOnly } from '@/components/ChatMessage/ChatMessageByReadOnly'; import { getMessageDetails } from '@/apis/adminApis'; import Decimal from 'decimal.js'; -import { getQueryId } from '@/utils/common'; export default function MessageDetails() { const router = useRouter(); @@ -84,7 +84,7 @@ export default function MessageDetails() { parentChildrenIds = [...parentChildrenIds].reverse(); } return ( - x === current.id, )} diff --git a/src/FE/pages/share/[id].tsx b/src/FE/pages/share/[id].tsx index c06f722e..55c5793f 100644 --- a/src/FE/pages/share/[id].tsx +++ b/src/FE/pages/share/[id].tsx @@ -11,9 +11,8 @@ import { getSelectMessages } from '@/utils/message'; import { GetMessageDetailsResult } from '@/types/adminApis'; import { ChatMessage } from '@/types/chatMessage'; -import { ChatMessage as ChatMessageComponent } from '@/pages/admin/_components/Messages/ChatMessage'; -import PageNotFound from '@/pages/home/_components/PageNotFound/PageNotFound'; - +import { ChatMessageByReadOnly } from '@/components/ChatMessage/ChatMessageByReadOnly'; +import PageNotFound from '@/components/PageNotFound/PageNotFound'; import { Button } from '@/components/ui/button'; import { getShareMessage } from '@/apis/adminApis'; @@ -73,7 +72,7 @@ export default function ShareMessage() { parentChildrenIds = [...parentChildrenIds].reverse(); } return ( - x === current.id, )} diff --git a/src/FE/public/logos/azure.svg b/src/FE/public/logos/azure.svg index fcb11483..142e3b38 100644 --- a/src/FE/public/logos/azure.svg +++ b/src/FE/public/logos/azure.svg @@ -1 +1,9 @@ - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/src/FE/public/logos/github.svg b/src/FE/public/logos/github.svg new file mode 100644 index 00000000..ce2371a4 --- /dev/null +++ b/src/FE/public/logos/github.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/FE/public/logos/x.svg b/src/FE/public/logos/x.svg new file mode 100644 index 00000000..39a664ae --- /dev/null +++ b/src/FE/public/logos/x.svg @@ -0,0 +1,12 @@ + + + + + + + + + \ No newline at end of file From 31ce833dc4e56e742d1018472ef4ba62bceee68e Mon Sep 17 00:00:00 2001 From: sdcb Date: Wed, 11 Dec 2024 12:58:06 +0800 Subject: [PATCH 07/22] introduce scripts project --- Chats.sln | 18 ++++++------------ ...ffold-fe.linq => 20241210-scaffold-fe.linq} | 0 src/scripts/readme.md | 2 ++ src/scripts/scripts.csproj | 7 +++++++ 4 files changed, 15 insertions(+), 12 deletions(-) rename src/scripts/{2024-12-10-scaffold-fe.linq => 20241210-scaffold-fe.linq} (100%) create mode 100644 src/scripts/readme.md create mode 100644 src/scripts/scripts.csproj diff --git a/Chats.sln b/Chats.sln index 8fffdd2d..d940d086 100644 --- a/Chats.sln +++ b/Chats.sln @@ -14,22 +14,13 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Chats.BE", "src\BE\Chats.BE EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Chats.BE.Tests", "src\BE.Tests\Chats.BE.Tests.csproj", "{B785B397-23AB-4782-807B-C5D5001C1ECC}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "scripts", "scripts", "{04AEF080-BF5C-4CD7-BB7E-3D509A0FD3F6}" - ProjectSection(SolutionItems) = preProject - src\scripts\20240902-db-migration.linq = src\scripts\20240902-db-migration.linq - src\scripts\20241101-model-reference-sql.linq = src\scripts\20241101-model-reference-sql.linq - src\scripts\20241112-db-migration.linq = src\scripts\20241112-db-migration.linq - src\scripts\20241115-db-migration.sql = src\scripts\20241115-db-migration.sql - src\scripts\20241121-int-migration.sql = src\scripts\20241121-int-migration.sql - src\scripts\20241127-ref.sql = src\scripts\20241127-ref.sql - src\scripts\20241129-file.sql = src\scripts\20241129-file.sql - EndProjectSection -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "github-actions", "github-actions", "{29CC0F58-0B4E-4F4F-A084-7C461F7A4E60}" ProjectSection(SolutionItems) = preProject .github\workflows\build-container.yml = .github\workflows\build-container.yml EndProjectSection EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "scripts", "src\scripts\scripts.csproj", "{1AE54C98-13A3-408B-B428-1FD975C02AF2}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -44,12 +35,15 @@ Global {B785B397-23AB-4782-807B-C5D5001C1ECC}.Debug|Any CPU.Build.0 = Debug|Any CPU {B785B397-23AB-4782-807B-C5D5001C1ECC}.Release|Any CPU.ActiveCfg = Release|Any CPU {B785B397-23AB-4782-807B-C5D5001C1ECC}.Release|Any CPU.Build.0 = Release|Any CPU + {1AE54C98-13A3-408B-B428-1FD975C02AF2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1AE54C98-13A3-408B-B428-1FD975C02AF2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1AE54C98-13A3-408B-B428-1FD975C02AF2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1AE54C98-13A3-408B-B428-1FD975C02AF2}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution - {04AEF080-BF5C-4CD7-BB7E-3D509A0FD3F6} = {6C78A2EB-D01E-4634-BBA7-85F12BF86232} {29CC0F58-0B4E-4F4F-A084-7C461F7A4E60} = {6C78A2EB-D01E-4634-BBA7-85F12BF86232} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution diff --git a/src/scripts/2024-12-10-scaffold-fe.linq b/src/scripts/20241210-scaffold-fe.linq similarity index 100% rename from src/scripts/2024-12-10-scaffold-fe.linq rename to src/scripts/20241210-scaffold-fe.linq diff --git a/src/scripts/readme.md b/src/scripts/readme.md new file mode 100644 index 00000000..4abbd609 --- /dev/null +++ b/src/scripts/readme.md @@ -0,0 +1,2 @@ +# NOTE +This is a empty project and only put some scripts here for reference. \ No newline at end of file diff --git a/src/scripts/scripts.csproj b/src/scripts/scripts.csproj new file mode 100644 index 00000000..dbdcea46 --- /dev/null +++ b/src/scripts/scripts.csproj @@ -0,0 +1,7 @@ + + + + netstandard2.0 + + + From d8f422a80c727653793b67853048da0fee25f0af Mon Sep 17 00:00:00 2001 From: sdcb Date: Wed, 11 Dec 2024 13:00:03 +0800 Subject: [PATCH 08/22] restructure scripts folder --- src/scripts/{ => db-migration}/20240902-db-migration.linq | 0 .../{ => db-migration}/20241101-model-reference-sql.linq | 0 src/scripts/{ => db-migration}/20241112-db-migration.linq | 0 src/scripts/{ => db-migration}/20241115-db-migration.sql | 0 src/scripts/{ => db-migration}/20241121-int-migration.sql | 0 src/scripts/{ => db-migration}/20241127-ref.sql | 0 src/scripts/{ => db-migration}/20241129-file.sql | 0 src/scripts/{ => tools}/20241210-scaffold-fe.linq | 2 +- 8 files changed, 1 insertion(+), 1 deletion(-) rename src/scripts/{ => db-migration}/20240902-db-migration.linq (100%) rename src/scripts/{ => db-migration}/20241101-model-reference-sql.linq (100%) rename src/scripts/{ => db-migration}/20241112-db-migration.linq (100%) rename src/scripts/{ => db-migration}/20241115-db-migration.sql (100%) rename src/scripts/{ => db-migration}/20241121-int-migration.sql (100%) rename src/scripts/{ => db-migration}/20241127-ref.sql (100%) rename src/scripts/{ => db-migration}/20241129-file.sql (100%) rename src/scripts/{ => tools}/20241210-scaffold-fe.linq (97%) diff --git a/src/scripts/20240902-db-migration.linq b/src/scripts/db-migration/20240902-db-migration.linq similarity index 100% rename from src/scripts/20240902-db-migration.linq rename to src/scripts/db-migration/20240902-db-migration.linq diff --git a/src/scripts/20241101-model-reference-sql.linq b/src/scripts/db-migration/20241101-model-reference-sql.linq similarity index 100% rename from src/scripts/20241101-model-reference-sql.linq rename to src/scripts/db-migration/20241101-model-reference-sql.linq diff --git a/src/scripts/20241112-db-migration.linq b/src/scripts/db-migration/20241112-db-migration.linq similarity index 100% rename from src/scripts/20241112-db-migration.linq rename to src/scripts/db-migration/20241112-db-migration.linq diff --git a/src/scripts/20241115-db-migration.sql b/src/scripts/db-migration/20241115-db-migration.sql similarity index 100% rename from src/scripts/20241115-db-migration.sql rename to src/scripts/db-migration/20241115-db-migration.sql diff --git a/src/scripts/20241121-int-migration.sql b/src/scripts/db-migration/20241121-int-migration.sql similarity index 100% rename from src/scripts/20241121-int-migration.sql rename to src/scripts/db-migration/20241121-int-migration.sql diff --git a/src/scripts/20241127-ref.sql b/src/scripts/db-migration/20241127-ref.sql similarity index 100% rename from src/scripts/20241127-ref.sql rename to src/scripts/db-migration/20241127-ref.sql diff --git a/src/scripts/20241129-file.sql b/src/scripts/db-migration/20241129-file.sql similarity index 100% rename from src/scripts/20241129-file.sql rename to src/scripts/db-migration/20241129-file.sql diff --git a/src/scripts/20241210-scaffold-fe.linq b/src/scripts/tools/20241210-scaffold-fe.linq similarity index 97% rename from src/scripts/20241210-scaffold-fe.linq rename to src/scripts/tools/20241210-scaffold-fe.linq index 037332b1..14de83ad 100644 --- a/src/scripts/20241210-scaffold-fe.linq +++ b/src/scripts/tools/20241210-scaffold-fe.linq @@ -6,7 +6,7 @@ async Task Main() { - string wwwroot = Path.Combine(new DirectoryInfo(Path.GetDirectoryName(Util.CurrentQueryPath)!).Parent!.ToString(), "BE", "wwwroot"); + string wwwroot = Path.Combine(new DirectoryInfo(Path.GetDirectoryName(Util.CurrentQueryPath)!).Parent!.Parent!.ToString(), "BE", "wwwroot"); Directory.Delete(wwwroot, recursive: true); string latestfeUrl = "https://github.com/sdcb/chats/releases/latest/download/chats-fe.zip"; using HttpClient http = new(); From cb64e0733659d846172393c22418ba437aa8a25d Mon Sep 17 00:00:00 2001 From: gray Date: Wed, 11 Dec 2024 15:40:58 +0800 Subject: [PATCH 09/22] format code --- src/FE/.eslintrc.json | 2 +- src/FE/.gitattributes | 1 + src/FE/.prettierignore | 5 +++ src/FE/apis/adminApis.ts | 11 ++++-- src/FE/components/Button/CopyButton.tsx | 6 +-- src/FE/components/Spinner/Spinner.tsx | 4 +- src/FE/components/ui/form/checkbox.tsx | 7 +++- src/FE/components/ui/slider.tsx | 18 ++++----- src/FE/components/ui/table.tsx | 13 +++---- src/FE/components/ui/toggle-group.tsx | 37 ++++++++++--------- src/FE/components/ui/toggle.tsx | 36 +++++++++--------- src/FE/locales/zh-CN.json | 4 +- src/FE/next.config.js | 10 ++--- src/FE/pages/_document.tsx | 6 ++- src/FE/pages/_error.tsx | 5 +-- src/FE/pages/globals.css | 1 - src/FE/pages/home/_components/Chat/Chat.tsx | 4 +- .../_components/PasteUpload/PasteUpload.tsx | 3 +- .../_components/Popover/DateTimePopover.tsx | 6 ++- .../_components/Popover/DeletePopover.tsx | 6 ++- .../login/_components/PhoneRegisterCard.tsx | 2 +- src/FE/types/chat.ts | 2 +- src/FE/types/file.ts | 6 +-- src/FE/types/model.ts | 2 +- src/FE/types/page.ts | 2 +- src/FE/types/prompt.ts | 2 +- src/FE/utils/chats.ts | 2 +- src/FE/utils/common.ts | 8 ++-- src/FE/utils/promptVariable.ts | 7 +++- 29 files changed, 121 insertions(+), 97 deletions(-) create mode 100644 src/FE/.gitattributes create mode 100644 src/FE/.prettierignore diff --git a/src/FE/.eslintrc.json b/src/FE/.eslintrc.json index 4c468d41..6ef85cad 100644 --- a/src/FE/.eslintrc.json +++ b/src/FE/.eslintrc.json @@ -4,4 +4,4 @@ "react-hooks/exhaustive-deps": "off", "@next/next/no-img-element": "off" } -} \ No newline at end of file +} diff --git a/src/FE/.gitattributes b/src/FE/.gitattributes new file mode 100644 index 00000000..21256661 --- /dev/null +++ b/src/FE/.gitattributes @@ -0,0 +1 @@ +* text=auto \ No newline at end of file diff --git a/src/FE/.prettierignore b/src/FE/.prettierignore new file mode 100644 index 00000000..bcf7d26f --- /dev/null +++ b/src/FE/.prettierignore @@ -0,0 +1,5 @@ +out/ +.next/ +node_module/ +.husky/ +public/ \ No newline at end of file diff --git a/src/FE/apis/adminApis.ts b/src/FE/apis/adminApis.ts index e2ba5990..279096ca 100644 --- a/src/FE/apis/adminApis.ts +++ b/src/FE/apis/adminApis.ts @@ -95,7 +95,8 @@ export const getUsers = ( ): Promise> => { const fetchService = useFetch(); return fetchService.get( - `/api/admin/users?page=${params.page}&pageSize=${params.pageSize}&query=${params?.query || '' + `/api/admin/users?page=${params.page}&pageSize=${params.pageSize}&query=${ + params?.query || '' }`, ); }; @@ -164,12 +165,14 @@ export const putFileService = (id: number, params: PostFileServicesParams) => { export const deleteFileService = (id: number) => { const fetchService = useFetch(); return fetchService.delete(`/api/admin/file-service/${id}`); -} +}; export const getFileServiceTypeInitialConfig = (fileServiceTypeId: number) => { const fetchService = useFetch(); - return fetchService.get(`/api/admin/file-service-type/${fileServiceTypeId}/initial-config`); -} + return fetchService.get( + `/api/admin/file-service-type/${fileServiceTypeId}/initial-config`, + ); +}; export const getShareMessage = ( chatId: string, diff --git a/src/FE/components/Button/CopyButton.tsx b/src/FE/components/Button/CopyButton.tsx index b4ca679e..50781c57 100644 --- a/src/FE/components/Button/CopyButton.tsx +++ b/src/FE/components/Button/CopyButton.tsx @@ -35,11 +35,7 @@ export default function CopyButton(props: Props) { onClick={handleCopy} title={t('Copy')} > - {isCopied ? ( - - ) : ( - - )} + {isCopied ? : } ); } diff --git a/src/FE/components/Spinner/Spinner.tsx b/src/FE/components/Spinner/Spinner.tsx index 565df470..d185a7b5 100644 --- a/src/FE/components/Spinner/Spinner.tsx +++ b/src/FE/components/Spinner/Spinner.tsx @@ -9,8 +9,8 @@ const Spinner = ({ className = '' }: Props) => { className={`animate-spin ${className}`} xmlns="http://www.w3.org/2000/svg" fill="none" - width='24' - height='24' + width="24" + height="24" viewBox="0 0 24 24" > - + {label} diff --git a/src/FE/components/ui/slider.tsx b/src/FE/components/ui/slider.tsx index fb55558b..551ac22c 100644 --- a/src/FE/components/ui/slider.tsx +++ b/src/FE/components/ui/slider.tsx @@ -1,9 +1,9 @@ -"use client" +'use client'; -import * as React from "react" -import * as SliderPrimitive from "@radix-ui/react-slider" +import * as SliderPrimitive from '@radix-ui/react-slider'; +import * as React from 'react'; -import { cn } from "@/lib/utils" +import { cn } from '@/lib/utils'; const Slider = React.forwardRef< React.ElementRef, @@ -12,8 +12,8 @@ const Slider = React.forwardRef< @@ -22,7 +22,7 @@ const Slider = React.forwardRef< -)) -Slider.displayName = SliderPrimitive.Root.displayName +)); +Slider.displayName = SliderPrimitive.Root.displayName; -export { Slider } +export { Slider }; diff --git a/src/FE/components/ui/table.tsx b/src/FE/components/ui/table.tsx index 41e730ed..058cad3f 100644 --- a/src/FE/components/ui/table.tsx +++ b/src/FE/components/ui/table.tsx @@ -1,12 +1,12 @@ import * as React from 'react'; import { ReactElement } from 'react-markdown/lib/react-markdown'; +import useTranslation from '@/hooks/useTranslation'; + import { Skeleton } from './skeleton'; import { cn } from '@/lib/utils'; -import useTranslation from '@/hooks/useTranslation'; - const Table = React.forwardRef< HTMLTableElement, React.HTMLAttributes @@ -50,10 +50,9 @@ const TableBody = React.forwardRef( ...props }, ref, - ) => - { + ) => { const { t } = useTranslation(); - return (isLoading ? ( + return isLoading ? ( @@ -87,8 +86,8 @@ const TableBody = React.forwardRef( className={cn('[&_tr:last-child]:border-0', className)} {...props} /> - )) - } + ); + }, ); TableBody.displayName = 'TableBody'; diff --git a/src/FE/components/ui/toggle-group.tsx b/src/FE/components/ui/toggle-group.tsx index 6cadb522..e5322f8a 100644 --- a/src/FE/components/ui/toggle-group.tsx +++ b/src/FE/components/ui/toggle-group.tsx @@ -1,18 +1,19 @@ -"use client" +'use client'; -import * as React from "react" -import * as ToggleGroupPrimitive from "@radix-ui/react-toggle-group" -import { VariantProps } from "class-variance-authority" +import * as ToggleGroupPrimitive from '@radix-ui/react-toggle-group'; +import * as React from 'react'; -import { cn } from "@/lib/utils" -import { toggleVariants } from "@/components/ui/toggle" +import { toggleVariants } from '@/components/ui/toggle'; + +import { cn } from '@/lib/utils'; +import { VariantProps } from 'class-variance-authority'; const ToggleGroupContext = React.createContext< VariantProps >({ - size: "default", - variant: "default", -}) + size: 'default', + variant: 'default', +}); const ToggleGroup = React.forwardRef< React.ElementRef, @@ -21,23 +22,23 @@ const ToggleGroup = React.forwardRef< >(({ className, variant, size, children, ...props }, ref) => ( {children} -)) +)); -ToggleGroup.displayName = ToggleGroupPrimitive.Root.displayName +ToggleGroup.displayName = ToggleGroupPrimitive.Root.displayName; const ToggleGroupItem = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef & VariantProps >(({ className, children, variant, size, ...props }, ref) => { - const context = React.useContext(ToggleGroupContext) + const context = React.useContext(ToggleGroupContext); return ( {children} - ) -}) + ); +}); -ToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName +ToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName; -export { ToggleGroup, ToggleGroupItem } +export { ToggleGroup, ToggleGroupItem }; diff --git a/src/FE/components/ui/toggle.tsx b/src/FE/components/ui/toggle.tsx index 1379f75d..4cf886e4 100644 --- a/src/FE/components/ui/toggle.tsx +++ b/src/FE/components/ui/toggle.tsx @@ -1,32 +1,32 @@ -"use client" +'use client'; -import * as React from "react" -import * as TogglePrimitive from "@radix-ui/react-toggle" -import { cva, type VariantProps } from "class-variance-authority" +import * as TogglePrimitive from '@radix-ui/react-toggle'; +import * as React from 'react'; -import { cn } from "@/lib/utils" +import { cn } from '@/lib/utils'; +import { type VariantProps, cva } from 'class-variance-authority'; const toggleVariants = cva( - "inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground", + 'inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground', { variants: { variant: { - default: "bg-transparent", + default: 'bg-transparent', outline: - "border border-input bg-transparent hover:bg-accent hover:text-accent-foreground", + 'border border-input bg-transparent hover:bg-accent hover:text-accent-foreground', }, size: { - default: "h-10 px-3", - sm: "h-9 px-2.5", - lg: "h-11 px-5", + default: 'h-10 px-3', + sm: 'h-9 px-2.5', + lg: 'h-11 px-5', }, }, defaultVariants: { - variant: "default", - size: "default", + variant: 'default', + size: 'default', }, - } -) + }, +); const Toggle = React.forwardRef< React.ElementRef, @@ -38,8 +38,8 @@ const Toggle = React.forwardRef< className={cn(toggleVariants({ variant, size, className }))} {...props} /> -)) +)); -Toggle.displayName = TogglePrimitive.Root.displayName +Toggle.displayName = TogglePrimitive.Root.displayName; -export { Toggle, toggleVariants } +export { Toggle, toggleVariants }; diff --git a/src/FE/locales/zh-CN.json b/src/FE/locales/zh-CN.json index c5b9b029..e7b0f45b 100644 --- a/src/FE/locales/zh-CN.json +++ b/src/FE/locales/zh-CN.json @@ -344,7 +344,7 @@ "Token Price": "Token价格", "404: Page not found": "404: 页面未找到", "Sorry, we couldn't find the page you were trying to access.": "抱歉,我们找不到你要访问的页面。", - ": An error has occurred": ": 发生错误", + "An error has occurred": "发生错误", "Sorry, there was an unexpected error, please try again later.": "抱歉,出现了意外错误,请稍后再试。", "Local": "本地", "Minio": "Minio", @@ -361,4 +361,4 @@ "There's no model here": "这里没有模型", "You can contact the administrator or create one yourself": "你可以联系管理员或者自己创建一个", "Customized Text(Company name, etc)": "自定义文本(公司名称等)" -} \ No newline at end of file +} diff --git a/src/FE/next.config.js b/src/FE/next.config.js index f341adf8..9c576cb7 100644 --- a/src/FE/next.config.js +++ b/src/FE/next.config.js @@ -1,13 +1,13 @@ const isDev = process.env?.NODE_ENV === 'development'; -console.log("NODE_ENV", process.env?.NODE_ENV); -console.log("-------------------"); +console.log('NODE_ENV', process.env?.NODE_ENV); +console.log('-------------------'); const withPWA = require('next-pwa')({ dest: 'public', register: !isDev, skipWaiting: !isDev, disable: isDev, -}) +}); /** @type {import('next').NextConfig} */ const nextConfig = { @@ -22,8 +22,8 @@ const nextConfig = { }, publicRuntimeConfig: { chattingIds: {}, - globalConfigs: {} - } + globalConfigs: {}, + }, }; module.exports = withPWA(nextConfig); diff --git a/src/FE/pages/_document.tsx b/src/FE/pages/_document.tsx index 9eb3466a..016e5cb8 100644 --- a/src/FE/pages/_document.tsx +++ b/src/FE/pages/_document.tsx @@ -17,7 +17,11 @@ function ChatsDocument(props: Props) { - + diff --git a/src/FE/pages/_error.tsx b/src/FE/pages/_error.tsx index 456abe24..b45e4ff7 100644 --- a/src/FE/pages/_error.tsx +++ b/src/FE/pages/_error.tsx @@ -22,10 +22,7 @@ const ErrorPage = ({ statusCode }: { statusCode: number }) => { return (
-

- {statusCode} - {t(': An error has occurred')} -

+

{t('An error has occurred')}

{t('Sorry, there was an unexpected error, please try again later.')}

diff --git a/src/FE/pages/globals.css b/src/FE/pages/globals.css index 1512be8b..171854aa 100644 --- a/src/FE/pages/globals.css +++ b/src/FE/pages/globals.css @@ -58,7 +58,6 @@ } } - @layer base { * { @apply border-border; diff --git a/src/FE/pages/home/_components/Chat/Chat.tsx b/src/FE/pages/home/_components/Chat/Chat.tsx index 319a1fa9..fe68b284 100644 --- a/src/FE/pages/home/_components/Chat/Chat.tsx +++ b/src/FE/pages/home/_components/Chat/Chat.tsx @@ -425,7 +425,9 @@ const Chat = memo(() => { /> )} {selectModel?.allowTemperature && - userModelConfig && userModelConfig.temperature !== null && userModelConfig.temperature !== undefined && ( + userModelConfig && + userModelConfig.temperature !== null && + userModelConfig.temperature !== undefined && ( void; diff --git a/src/FE/pages/login/_components/PhoneRegisterCard.tsx b/src/FE/pages/login/_components/PhoneRegisterCard.tsx index 790ea604..418f254f 100644 --- a/src/FE/pages/login/_components/PhoneRegisterCard.tsx +++ b/src/FE/pages/login/_components/PhoneRegisterCard.tsx @@ -8,6 +8,7 @@ import useTranslation from '@/hooks/useTranslation'; import { PhoneRegExp, SmsExpirationSeconds } from '@/utils/common'; import { saveUserInfo, setUserSession } from '@/utils/user'; +import { redirectToGithub } from '@/utils/website'; import { Button } from '@/components/ui/button'; import { Card, CardContent } from '@/components/ui/card'; @@ -23,7 +24,6 @@ import { Input } from '@/components/ui/input'; import { registerByPhone, sendRegisterSmsCode } from '@/apis/clientApis'; import { zodResolver } from '@hookform/resolvers/zod'; import { z } from 'zod'; -import { redirectToGithub } from '@/utils/website'; const PhoneRegisterCard = (props: { loginLoading: boolean; diff --git a/src/FE/types/chat.ts b/src/FE/types/chat.ts index 4dea3f31..32e8d308 100644 --- a/src/FE/types/chat.ts +++ b/src/FE/types/chat.ts @@ -1,4 +1,4 @@ -import { UserModelConfig } from "./model"; +import { UserModelConfig } from './model'; export type Role = 'assistant' | 'user' | 'system'; export const DEFAULT_TEMPERATURE = 0.5; diff --git a/src/FE/types/file.ts b/src/FE/types/file.ts index b7e1e952..097931dd 100644 --- a/src/FE/types/file.ts +++ b/src/FE/types/file.ts @@ -8,7 +8,7 @@ export const feFileServiceTypes: FileServiceType[] = [ { id: 1, name: 'Minio' }, { id: 2, name: 'AWS S3' }, { id: 3, name: 'Aliyun OSS' }, - { id: 4, name: 'Azure Blob Storage' } + { id: 4, name: 'Azure Blob Storage' }, ]; export enum DBFileServiceType { @@ -16,5 +16,5 @@ export enum DBFileServiceType { Minio = 1, AWSS3 = 2, AliyunOSS = 3, - AzureBlobStorage = 4 -} \ No newline at end of file + AzureBlobStorage = 4, +} diff --git a/src/FE/types/model.ts b/src/FE/types/model.ts index d9fefaf5..0ebea24a 100644 --- a/src/FE/types/model.ts +++ b/src/FE/types/model.ts @@ -46,4 +46,4 @@ export interface ChatModelFileConfig { export interface ChatModelPriceConfig { input: number; out: number; -} \ No newline at end of file +} diff --git a/src/FE/types/page.ts b/src/FE/types/page.ts index b364b598..23e1f324 100644 --- a/src/FE/types/page.ts +++ b/src/FE/types/page.ts @@ -6,4 +6,4 @@ export interface PageResult { export interface Paging { page: number; pageSize: number; -} \ No newline at end of file +} diff --git a/src/FE/types/prompt.ts b/src/FE/types/prompt.ts index 73457148..33d14303 100644 --- a/src/FE/types/prompt.ts +++ b/src/FE/types/prompt.ts @@ -13,4 +13,4 @@ export interface IdName { export interface PromptSlim extends IdName { isDefault: boolean; isSystem: boolean; -} \ No newline at end of file +} diff --git a/src/FE/utils/chats.ts b/src/FE/utils/chats.ts index 2c1f6491..2e9b25ee 100644 --- a/src/FE/utils/chats.ts +++ b/src/FE/utils/chats.ts @@ -30,4 +30,4 @@ export function preprocessLaTeX(content?: string) { (_, equation) => `$${equation}$`, ); return inlineProcessedContent; -} \ No newline at end of file +} diff --git a/src/FE/utils/common.ts b/src/FE/utils/common.ts index dd4f34df..dd4e92c0 100644 --- a/src/FE/utils/common.ts +++ b/src/FE/utils/common.ts @@ -1,4 +1,4 @@ -import { NextRouter } from "next/router"; +import { NextRouter } from 'next/router'; export const isMobile = () => { const userAgent = @@ -23,7 +23,9 @@ export function formatNumberAsMoney(amount: number, maximumFractionDigits = 5) { } export function termDateString() { - return new Date(new Date().getTime() + 10 * 365 * 24 * 60 * 60 * 1000).toISOString(); // 10 years + return new Date( + new Date().getTime() + 10 * 365 * 24 * 60 * 60 * 1000, + ).toISOString(); // 10 years } export const PhoneRegExp = /^[1][3,4,5,6,7,8,9][0-9]{9}$/; @@ -47,4 +49,4 @@ export const getQueryId = (router: NextRouter): string => { const asPath = router.asPath.split('?')[0]; // 移除查询参数 const pathSegments = asPath.split('/'); return pathSegments[pathSegments.length - 1] || ''; -} \ No newline at end of file +}; diff --git a/src/FE/utils/promptVariable.ts b/src/FE/utils/promptVariable.ts index 307a651a..777abccb 100644 --- a/src/FE/utils/promptVariable.ts +++ b/src/FE/utils/promptVariable.ts @@ -1,4 +1,4 @@ -import { AdminModelDto } from "@/types/adminApis"; +import { AdminModelDto } from '@/types/adminApis'; interface PromptParams { model: AdminModelDto; @@ -7,7 +7,10 @@ interface PromptParams { export const PromptVariables = { '{{CURRENT_DATE}}': () => new Date().toLocaleDateString(), '{{CURRENT_TIME}}': () => new Date().toLocaleString(), - '{{MODEL_NAME}}': (params?: PromptParams) => params?.model?.modelReferenceShortName || params?.model?.modelReferenceName || '', + '{{MODEL_NAME}}': (params?: PromptParams) => + params?.model?.modelReferenceShortName || + params?.model?.modelReferenceName || + '', }; export function formatPrompt(prompt: string, params?: PromptParams) { From 81de32763547c571d8de6392cb90ffee0396b975 Mon Sep 17 00:00:00 2001 From: gray Date: Wed, 11 Dec 2024 15:44:22 +0800 Subject: [PATCH 10/22] add x.ai/githubmodels provider --- src/FE/types/model.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/FE/types/model.ts b/src/FE/types/model.ts index 0ebea24a..be07ebe3 100644 --- a/src/FE/types/model.ts +++ b/src/FE/types/model.ts @@ -16,6 +16,8 @@ export enum DBModelProvider { Spark = 8, ZhiPuAI = 9, DeepSeek = 10, + X_AI = 11, + GithubModels = 12, } export type FEModelProvider = { @@ -36,6 +38,8 @@ export const feModelProviders: FEModelProvider[] = [ { id: 8, name: 'Xunfei SparkDesk', icon: '/logos/spark.svg' }, { id: 9, name: 'Zhipu AI', icon: '/logos/zhipuai.svg' }, { id: 10, name: 'DeepSeek', icon: '/logos/deepseek.svg' }, + { id: 11, name: 'x.ai', icon: '/logos/x.svg' }, + { id: 12, name: 'Github Models', icon: '/logos/github.svg' }, ]; export interface ChatModelFileConfig { From aaa4ce6618376faf56227493c9d65a4538c3b20b Mon Sep 17 00:00:00 2001 From: gray Date: Wed, 11 Dec 2024 15:47:04 +0800 Subject: [PATCH 11/22] add husky --- src/FE/.husky/pre-commit | 1 + src/FE/package-lock.json | 32 +++++++++++++++++--------------- src/FE/package.json | 4 +++- 3 files changed, 21 insertions(+), 16 deletions(-) create mode 100644 src/FE/.husky/pre-commit diff --git a/src/FE/.husky/pre-commit b/src/FE/.husky/pre-commit new file mode 100644 index 00000000..b7807b0d --- /dev/null +++ b/src/FE/.husky/pre-commit @@ -0,0 +1 @@ +npm run format \ No newline at end of file diff --git a/src/FE/package-lock.json b/src/FE/package-lock.json index b3702542..2fe84c73 100644 --- a/src/FE/package-lock.json +++ b/src/FE/package-lock.json @@ -62,6 +62,7 @@ "cross-env": "^7.0.3", "eslint": "8.49.0", "eslint-config-next": "13.4.19", + "husky": "^9.1.7", "postcss": "^8.4.41", "prettier": "^2.8.7", "prettier-plugin-tailwindcss": "^0.2.5", @@ -8019,6 +8020,22 @@ "node": "*" } }, + "node_modules/husky": { + "version": "9.1.7", + "resolved": "https://registry.npmjs.org/husky/-/husky-9.1.7.tgz", + "integrity": "sha512-5gs5ytaNjBrh5Ow3zrvdUUY+0VxIuWVL4i9irt6friV+BqdCfmV11CQTWMiBYWHbXhco+J1kHfTOUkePhCDvMA==", + "dev": true, + "license": "MIT", + "bin": { + "husky": "bin.js" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/typicode" + } + }, "node_modules/idb": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/idb/-/idb-7.1.1.tgz", @@ -13849,21 +13866,6 @@ "type": "github", "url": "https://github.com/sponsors/wooorm" } - }, - "node_modules/@next/swc-win32-ia32-msvc": { - "version": "14.2.5", - "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-14.2.5.tgz", - "integrity": "sha512-Igh9ZlxwvCDsu6438FXlQTHlRno4gFpJzqPjSIBZooD22tKeI4fE/YMRoHVJHmrQ2P5YL1DoZ0qaOKkbeFWeMg==", - "cpu": [ - "ia32" - ], - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 10" - } } } } diff --git a/src/FE/package.json b/src/FE/package.json index 3ededf52..d58bf404 100644 --- a/src/FE/package.json +++ b/src/FE/package.json @@ -8,7 +8,8 @@ "build": "next build", "start": "next start", "lint": "next lint", - "format": "prettier --write ." + "format": "prettier --write .", + "prepare": "husky" }, "dependencies": { "@hookform/resolvers": "^3.3.4", @@ -65,6 +66,7 @@ "cross-env": "^7.0.3", "eslint": "8.49.0", "eslint-config-next": "13.4.19", + "husky": "^9.1.7", "postcss": "^8.4.41", "prettier": "^2.8.7", "prettier-plugin-tailwindcss": "^0.2.5", From 1e5ca764c6672e4820cc4189079ffa6d910ae58e Mon Sep 17 00:00:00 2001 From: sdcb Date: Wed, 11 Dec 2024 18:21:36 +0800 Subject: [PATCH 12/22] new models --- .../{ => 2024}/20240902-db-migration.linq | 0 .../20241101-model-reference-sql.linq | 0 .../{ => 2024}/20241112-db-migration.linq | 0 .../{ => 2024}/20241115-db-migration.sql | 0 .../{ => 2024}/20241121-int-migration.sql | 0 .../db-migration/{ => 2024}/20241127-ref.sql | 0 .../db-migration/{ => 2024}/20241129-file.sql | 0 .../2024/20241211-xai-githubmodels.sql | 24 +++++++++++++++++++ 8 files changed, 24 insertions(+) rename src/scripts/db-migration/{ => 2024}/20240902-db-migration.linq (100%) rename src/scripts/db-migration/{ => 2024}/20241101-model-reference-sql.linq (100%) rename src/scripts/db-migration/{ => 2024}/20241112-db-migration.linq (100%) rename src/scripts/db-migration/{ => 2024}/20241115-db-migration.sql (100%) rename src/scripts/db-migration/{ => 2024}/20241121-int-migration.sql (100%) rename src/scripts/db-migration/{ => 2024}/20241127-ref.sql (100%) rename src/scripts/db-migration/{ => 2024}/20241129-file.sql (100%) create mode 100644 src/scripts/db-migration/2024/20241211-xai-githubmodels.sql diff --git a/src/scripts/db-migration/20240902-db-migration.linq b/src/scripts/db-migration/2024/20240902-db-migration.linq similarity index 100% rename from src/scripts/db-migration/20240902-db-migration.linq rename to src/scripts/db-migration/2024/20240902-db-migration.linq diff --git a/src/scripts/db-migration/20241101-model-reference-sql.linq b/src/scripts/db-migration/2024/20241101-model-reference-sql.linq similarity index 100% rename from src/scripts/db-migration/20241101-model-reference-sql.linq rename to src/scripts/db-migration/2024/20241101-model-reference-sql.linq diff --git a/src/scripts/db-migration/20241112-db-migration.linq b/src/scripts/db-migration/2024/20241112-db-migration.linq similarity index 100% rename from src/scripts/db-migration/20241112-db-migration.linq rename to src/scripts/db-migration/2024/20241112-db-migration.linq diff --git a/src/scripts/db-migration/20241115-db-migration.sql b/src/scripts/db-migration/2024/20241115-db-migration.sql similarity index 100% rename from src/scripts/db-migration/20241115-db-migration.sql rename to src/scripts/db-migration/2024/20241115-db-migration.sql diff --git a/src/scripts/db-migration/20241121-int-migration.sql b/src/scripts/db-migration/2024/20241121-int-migration.sql similarity index 100% rename from src/scripts/db-migration/20241121-int-migration.sql rename to src/scripts/db-migration/2024/20241121-int-migration.sql diff --git a/src/scripts/db-migration/20241127-ref.sql b/src/scripts/db-migration/2024/20241127-ref.sql similarity index 100% rename from src/scripts/db-migration/20241127-ref.sql rename to src/scripts/db-migration/2024/20241127-ref.sql diff --git a/src/scripts/db-migration/20241129-file.sql b/src/scripts/db-migration/2024/20241129-file.sql similarity index 100% rename from src/scripts/db-migration/20241129-file.sql rename to src/scripts/db-migration/2024/20241129-file.sql diff --git a/src/scripts/db-migration/2024/20241211-xai-githubmodels.sql b/src/scripts/db-migration/2024/20241211-xai-githubmodels.sql new file mode 100644 index 00000000..b40fc861 --- /dev/null +++ b/src/scripts/db-migration/2024/20241211-xai-githubmodels.sql @@ -0,0 +1,24 @@ +insert into ModelProvider values(11, 'x.ai', NULL, 'xai-yourkey'); +insert into ModelProvider values(12, 'Github Models', NULL, 'ghp_yourkey'); + +insert into ModelReference values +(1100, 11, 'grok-beta', 'grok', 0, 0, 2, 0, 0, 1, 1, 131072, 4096, NULL, 5, 15, 'USD'), +(1101, 11, 'grok-vision-beta', 'grok', 0, 0, 2, 0, 1, 1, 1, 8192, 4096, NULL, 5, 15, 'USD'), +(1200, 12, 'AI21-Jamba-1.5-Large', 'AI21-Jamba', 0, 0, 2, 0, 0, 1, 1, 256000, 4000, NULL, 5, 15, 'USD'), +(1201, 12, 'AI21-Jamba-1.5-Mini', 'AI21-Jamba', 0, 0, 2, 0, 0, 1, 1, 256000, 4000, NULL, 1, 2, 'USD'), +(1202, 12, 'Cohere-command-r', NULL, 0, 0, 2, 0, 0, 1, 1, 131072, 4096, NULL, 1, 2, 'USD'), +(1203, 12, 'Cohere-command-r-plus', NULL, 0, 0, 2, 0, 0, 1, 1, 131072, 4096, NULL, 0, 0, 'USD'), +(1204, 12, 'Llama-3.2-11B-Vision-Instruct', 'LLaMA', 0, 0, 2, 0, 1, 1, 1, 128000, 4000, NULL, 1, 2, 'USD'), +(1205, 12, 'Llama-3.2-90B-Vision-Instruct', 'LLaMA', 0, 0, 2, 0, 0, 1, 1, 128000, 4000, NULL, 5, 15, 'USD'), +(1206, 12, 'Meta-Llama-3.1-405B-Instruct', 'LLaMA', 0, 0, 2, 0, 0, 1, 1, 131072, 4096, NULL, 5, 15, 'USD'), +(1207, 12, 'Meta-Llama-3.1-70B-Instruct', 'LLaMA', 0, 0, 2, 0, 0, 1, 1, 131072, 4096, NULL, 2.5, 5, 'USD'), +(1208, 12, 'Meta-Llama-3.1-8B-Instruct', 'LLaMA', 0, 0, 2, 0, 0, 1, 1, 131072, 4096, NULL, 1, 2, 'USD'), +(1209, 12, 'Mistral-large', 'Mistral', 1, 0, 2, 0, 0, 1, 1, 32768, 4096, NULL, 5, 15, 'USD'), +(1210, 12, 'Mistral-large-2407', 'Mistral', 0, 0, 2, 0, 0, 1, 1, 131072, 4096, NULL, 5, 15, 'USD'), +(1211, 12, 'Mistral-Nemo', 'Mistral', 0, 0, 2, 0, 0, 1, 1, 131072, 4096, NULL, 1, 2, 'USD'), +(1212, 12, 'Mistral-small', 'Mistral', 1, 0, 2, 0, 0, 1, 1, 32768, 4096, NULL, 1, 2, 'USD'), +(1213, 12, 'gpt-4o', NULL, 0, 0, 2, 0, 1, 1, 1, 128000, 4096, 2, 5, 15, 'USD'), +(1214, 12, 'gpt-4o-mini', NULL, 0, 0, 2, 0, 1, 1, 1, 128000, 4096, 2, 1, 2, 'USD'), +(1215, 12, 'Phi-3.5-MoE-instruct', 'Phi-3.5', 0, 0, 2, 0, 0, 1, 1, 131072, 4096, NULL, 1, 2, 'USD'), +(1216, 12, 'Phi-3.5-mini-instruct', 'Phi-3.5', 0, 0, 2, 0, 0, 1, 1, 131072, 4096, NULL, 0.5, 1, 'USD'), +(1217, 12, 'Phi-3.5-vision-instruct', 'Phi-3.5', 0, 0, 2, 0, 1, 1, 1, 131072, 4096, NULL, 1, 2, 'USD'); From e146cd01625c711036651e3040fe1472805e77cd Mon Sep 17 00:00:00 2001 From: sdcb Date: Wed, 11 Dec 2024 18:42:45 +0800 Subject: [PATCH 13/22] remove model config --- .../Controllers/Chats/Chats/ChatController.cs | 7 +-- .../Chats/UserChats/Dtos/ChatsResponse.cs | 22 ++------- .../Chats/UserChats/UserChatsController.cs | 6 +++ .../ModelInfo/DTOs/LegacyModelProviderDto.cs | 23 ---------- .../ModelInfo/DTOs/LegacyModelReferenceDto.cs | 29 ------------ src/BE/DB/Jsons/JsonMinioConfig.cs | 46 ------------------- src/BE/DB/Jsons/JsonModelConfig.cs | 27 ----------- src/BE/DB/Jsons/JsonUserModelConfig.cs | 25 +++++----- .../ChatCompletionOptionsExtensions.cs | 15 ++++++ src/FE/pages/home/_components/Chat/Chat.tsx | 2 +- src/FE/types/chat.ts | 5 +- src/FE/types/clientApis.ts | 5 +- src/FE/types/model.ts | 12 ++--- 13 files changed, 52 insertions(+), 172 deletions(-) delete mode 100644 src/BE/Controllers/Public/ModelInfo/DTOs/LegacyModelProviderDto.cs delete mode 100644 src/BE/Controllers/Public/ModelInfo/DTOs/LegacyModelReferenceDto.cs delete mode 100644 src/BE/DB/Jsons/JsonMinioConfig.cs delete mode 100644 src/BE/DB/Jsons/JsonModelConfig.cs diff --git a/src/BE/Controllers/Chats/Chats/ChatController.cs b/src/BE/Controllers/Chats/Chats/ChatController.cs index d9734cfe..e643ff10 100644 --- a/src/BE/Controllers/Chats/Chats/ChatController.cs +++ b/src/BE/Controllers/Chats/Chats/ChatController.cs @@ -6,6 +6,7 @@ using Chats.BE.Services; using Chats.BE.Services.ChatServices; using Chats.BE.Services.ChatServices.Dtos; +using Chats.BE.Services.ChatServices.Extensions; using Chats.BE.Services.FileServices; using Chats.BE.Services.UrlEncryption; using Microsoft.AspNetCore.Authorization; @@ -155,12 +156,8 @@ ..await GetMessageTree(existingMessages, messageId).ToAsyncEnumerable().SelectAw throw new InvalidModelException(request.ModelId.ToString()); } + ChatCompletionOptions cco = request.UserModelConfig.ToChatCompletionOptions(currentUser.Id); using ChatService s = conversationFactory.CreateConversationService(userModel.Model); - ChatCompletionOptions cco = new() - { - Temperature = request.UserModelConfig.Temperature, - EndUserId = currentUser.Id.ToString(), - }; await foreach (InternalChatSegment seg in icc.Run(userBalance.Balance, userModel, s.ChatStreamedFEProcessed(messageToSend, cco, cancellationToken))) { if (seg.TextSegment == string.Empty) continue; diff --git a/src/BE/Controllers/Chats/UserChats/Dtos/ChatsResponse.cs b/src/BE/Controllers/Chats/UserChats/Dtos/ChatsResponse.cs index fed215eb..2f17c432 100644 --- a/src/BE/Controllers/Chats/UserChats/Dtos/ChatsResponse.cs +++ b/src/BE/Controllers/Chats/UserChats/Dtos/ChatsResponse.cs @@ -1,7 +1,6 @@ using Chats.BE.DB; using Chats.BE.DB.Enums; using Chats.BE.DB.Jsons; -using Chats.BE.Services.ChatServices; using Chats.BE.Services.UrlEncryption; using System.Text.Json.Serialization; @@ -21,9 +20,6 @@ public record ChatsResponse [JsonPropertyName("modelName")] public required string ModelName { get; init; } - [JsonPropertyName("modelConfig")] - public required JsonModelConfig ModelConfig { get; init; } - [JsonPropertyName("userModelConfig")] public required JsonUserModelConfig UserModelConfig { get; init; } @@ -41,16 +37,11 @@ public static ChatsResponse FromDB(Chat chat, IUrlEncryptionService idEncryption Title = chat.Title, ModelId = chat.ModelId, ModelName = chat.Model.Name, - ModelConfig = new JsonModelConfig - { - DeploymentName = chat.Model.DeploymentName, - EnableSearch = chat.Model.ModelReference.AllowSearch, - MaxLength = chat.Model.ModelReference.MaxResponseTokens, - Temperature = ChatService.DefaultTemperature, - Version = chat.Model.ModelKey.ModelProvider.Name, - Prompt = ChatService.DefaultPrompt, + UserModelConfig = new JsonUserModelConfig + { + EnableSearch = chat.EnableSearch, + Temperature = chat.Temperature, }, - UserModelConfig = new JsonUserModelConfig { EnableSearch = chat.EnableSearch, Temperature = chat.Temperature }, IsShared = chat.IsShared, ModelProviderId = (DBModelProvider)chat.Model.ModelKey.ModelProviderId, }; @@ -85,11 +76,6 @@ public ChatsResponse ToResponse(IUrlEncryptionService idEncryption) Title = Title, ModelId = ChatModelId, ModelName = ModelName, - ModelConfig = new JsonModelConfig - { - Prompt = ChatService.DefaultPrompt, - Temperature = Temperature ?? ChatService.DefaultTemperature, - }, UserModelConfig = UserModelConfig, IsShared = IsShared, ModelProviderId = ModelProvider, diff --git a/src/BE/Controllers/Chats/UserChats/UserChatsController.cs b/src/BE/Controllers/Chats/UserChats/UserChatsController.cs index fef28546..a359c35f 100644 --- a/src/BE/Controllers/Chats/UserChats/UserChatsController.cs +++ b/src/BE/Controllers/Chats/UserChats/UserChatsController.cs @@ -76,6 +76,12 @@ public async Task>> GetChats([FromQuery] { EnableSearch = x.EnableSearch, Temperature = x.Temperature, + Prompt = x.Messages + .FirstOrDefault(x => x.ChatRoleId == (byte)DBChatRole.System) + !.MessageContents + .FirstOrDefault() + !.MessageContentText + !.Content }, }), request, diff --git a/src/BE/Controllers/Public/ModelInfo/DTOs/LegacyModelProviderDto.cs b/src/BE/Controllers/Public/ModelInfo/DTOs/LegacyModelProviderDto.cs deleted file mode 100644 index 0fe01ebc..00000000 --- a/src/BE/Controllers/Public/ModelInfo/DTOs/LegacyModelProviderDto.cs +++ /dev/null @@ -1,23 +0,0 @@ -using Chats.BE.DB.Jsons; -using System.Text.Json.Serialization; - -namespace Chats.BE.Controllers.Public.ModelInfo.DTOs; - -[Obsolete("for old frontend compatibility")] -public record LegacyModelProviderDto -{ - [JsonPropertyName("name")] - public required string Name{ get; init; } - - [JsonPropertyName("models")] - public required string[] Models { get; init; } - - [JsonPropertyName("apiConfig")] - public required JsonModelKey ApiConfig { get; init; } - - [JsonPropertyName("displayName")] - public required string DisplayName { get; init; } - - [JsonPropertyName("icon")] - public required string Icon { get; init; } -} diff --git a/src/BE/Controllers/Public/ModelInfo/DTOs/LegacyModelReferenceDto.cs b/src/BE/Controllers/Public/ModelInfo/DTOs/LegacyModelReferenceDto.cs deleted file mode 100644 index b4d9b6dd..00000000 --- a/src/BE/Controllers/Public/ModelInfo/DTOs/LegacyModelReferenceDto.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Chats.BE.Controllers.Chats.Models.Dtos; -using Chats.BE.DB.Jsons; -using System.Text.Json.Serialization; - -namespace Chats.BE.Controllers.Public.ModelInfo.DTOs; - -[Obsolete("for old frontend compatibility")] -public record LegacyModelReferenceDto -{ - #region new fields - [JsonPropertyName("id")] - public required short Id { get; init; } - #endregion - - [JsonPropertyName("type")] - public required string ProviderName { get; init; } - - [JsonPropertyName("config")] - public required TemperatureOptions Config { get; init; } - - [JsonPropertyName("modelConfig")] - public required JsonModelConfig ModelConfig { get; init; } - - [JsonPropertyName("fileConfig")] - public required JsonFileConfig? FileConfig { get; init; } - - [JsonPropertyName("priceConfig")] - public required JsonPriceConfig PriceConfig { get; init; } -} diff --git a/src/BE/DB/Jsons/JsonMinioConfig.cs b/src/BE/DB/Jsons/JsonMinioConfig.cs deleted file mode 100644 index ad0eb69c..00000000 --- a/src/BE/DB/Jsons/JsonMinioConfig.cs +++ /dev/null @@ -1,46 +0,0 @@ -using Chats.BE.Services.Common; -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace Chats.BE.DB.Jsons; - -public record JsonMinioConfig -{ - [JsonPropertyName("accessKey")] - public required string AccessKey { get; init; } - - [JsonPropertyName("accessSecret")] - public required string AccessSecret { get; init; } - - [JsonPropertyName("endpoint")] - public required string Endpoint { get; init; } - - [JsonPropertyName("bucketName")] - public required string BucketName { get; init; } - - public static JsonMinioConfig Parse(string json) - { - return JsonSerializer.Deserialize(json)!; - } - - public JsonMinioConfig WithMaskedKeys() - { - return this with - { - AccessKey = AccessKey.ToMasked(), - AccessSecret = AccessSecret.ToMasked() - }; - } - - public bool IsMaskedEquals(JsonMinioConfig inputConfig) - { - if (inputConfig.AccessKey.SeemsMasked()) - { - return WithMaskedKeys() == inputConfig; - } - else - { - return this == inputConfig; - } - } -} \ No newline at end of file diff --git a/src/BE/DB/Jsons/JsonModelConfig.cs b/src/BE/DB/Jsons/JsonModelConfig.cs deleted file mode 100644 index 64ab6c45..00000000 --- a/src/BE/DB/Jsons/JsonModelConfig.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Chats.BE.DB.Jsons; - -public record JsonModelConfig -{ - [JsonPropertyName("prompt")] - public required string Prompt { get; init; } - - [JsonPropertyName("temperature")] - public required float Temperature { get; init; } - - [JsonPropertyName("model"), JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - public string? Model { get; init; } - - [JsonPropertyName("version"), JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - public string? Version { get; init; } - - [JsonPropertyName("deploymentName")] - public string? DeploymentName { get; init; } - - [JsonPropertyName("enableSearch")] - public bool? EnableSearch { get; init; } - - [JsonPropertyName("maxLength")] - public int? MaxLength { get; init; } -} \ No newline at end of file diff --git a/src/BE/DB/Jsons/JsonUserModelConfig.cs b/src/BE/DB/Jsons/JsonUserModelConfig.cs index dd9b4483..59889bd8 100644 --- a/src/BE/DB/Jsons/JsonUserModelConfig.cs +++ b/src/BE/DB/Jsons/JsonUserModelConfig.cs @@ -1,29 +1,32 @@ -using System.Text.Json.Serialization; +using Azure.Core; +using Chats.BE.Services.ChatServices.Extensions; +using OpenAI.Chat; +using System.Text.Json.Serialization; namespace Chats.BE.DB.Jsons; public record JsonUserModelConfig { - [JsonPropertyName("prompt"), JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("prompt")] public string? Prompt { get; init; } - [JsonPropertyName("temperature"), JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("temperature")] public float? Temperature { get; init; } - [JsonPropertyName("enableSearch"), JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("enableSearch")] public bool? EnableSearch { get; init; } - [JsonPropertyName("maxLength"), JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("maxLength")] public int? MaxLength { get; init; } - public static JsonUserModelConfig FromJson(JsonModelConfig modelConfig) + public ChatCompletionOptions ToChatCompletionOptions(int userId) { - return new JsonUserModelConfig + ChatCompletionOptions cco = new() { - Prompt = modelConfig.Prompt, - Temperature = modelConfig.Temperature, - EnableSearch = modelConfig.EnableSearch, - MaxLength = modelConfig.MaxLength + Temperature = Temperature, + EndUserId = userId.ToString(), }; + cco.SetAllowSearch(EnableSearch ?? false); + return cco; } } diff --git a/src/BE/Services/ChatServices/Extensions/ChatCompletionOptionsExtensions.cs b/src/BE/Services/ChatServices/Extensions/ChatCompletionOptionsExtensions.cs index 56eaef85..d1ee37d8 100644 --- a/src/BE/Services/ChatServices/Extensions/ChatCompletionOptionsExtensions.cs +++ b/src/BE/Services/ChatServices/Extensions/ChatCompletionOptionsExtensions.cs @@ -16,6 +16,18 @@ public static bool IsSearchEnabled(this ChatCompletionOptions options) return false; } + public static void SetAllowSearch(this ChatCompletionOptions options, bool value) + { + IDictionary? rawData = GetSerializedAdditionalRawData(options); + if (rawData == null) + { + rawData = new Dictionary(); + SetSerializedAdditionalRawData(options, rawData); + } + + rawData["enable_search"] = BinaryData.FromObjectAsJson(value); + } + public static void RemoveAllowSearch(this ChatCompletionOptions options) { IDictionary? rawData = GetSerializedAdditionalRawData(options); @@ -44,4 +56,7 @@ public static void SetModelName(this ChatCompletionOptions @this, string name) [UnsafeAccessor(UnsafeAccessorKind.Method, Name = "get_SerializedAdditionalRawData")] private extern static IDictionary? GetSerializedAdditionalRawData(ChatCompletionOptions @this); + + [UnsafeAccessor(UnsafeAccessorKind.Method, Name = "set_SerializedAdditionalRawData")] + private extern static void SetSerializedAdditionalRawData(ChatCompletionOptions @this, IDictionary? value); } diff --git a/src/FE/pages/home/_components/Chat/Chat.tsx b/src/FE/pages/home/_components/Chat/Chat.tsx index 8836b8e5..ea6f3d7b 100644 --- a/src/FE/pages/home/_components/Chat/Chat.tsx +++ b/src/FE/pages/home/_components/Chat/Chat.tsx @@ -425,7 +425,7 @@ const Chat = memo(() => { /> )} {selectModel?.allowTemperature && - userModelConfig?.temperature !== undefined && ( + userModelConfig && userModelConfig.temperature !== null && ( Date: Wed, 11 Dec 2024 18:45:04 +0800 Subject: [PATCH 14/22] try fix issue --- src/FE/pages/home/_components/Chat/Chat.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/FE/pages/home/_components/Chat/Chat.tsx b/src/FE/pages/home/_components/Chat/Chat.tsx index ea6f3d7b..319a1fa9 100644 --- a/src/FE/pages/home/_components/Chat/Chat.tsx +++ b/src/FE/pages/home/_components/Chat/Chat.tsx @@ -425,7 +425,7 @@ const Chat = memo(() => { /> )} {selectModel?.allowTemperature && - userModelConfig && userModelConfig.temperature !== null && ( + userModelConfig && userModelConfig.temperature !== null && userModelConfig.temperature !== undefined && ( Date: Wed, 11 Dec 2024 18:49:35 +0800 Subject: [PATCH 15/22] add xai/github models --- src/BE/DB/Init/BasicData.cs | 252 ++++++++++++++++++++---------------- 1 file changed, 137 insertions(+), 115 deletions(-) diff --git a/src/BE/DB/Init/BasicData.cs b/src/BE/DB/Init/BasicData.cs index 4e9fb5fe..34f1388a 100644 --- a/src/BE/DB/Init/BasicData.cs +++ b/src/BE/DB/Init/BasicData.cs @@ -107,127 +107,147 @@ private static void InsertTransactionTypes(ChatsDB db) private static void InsertModelReferences(ChatsDB db) { - // Generated from data, hash: ebf7fc3a8c4f38d7efc44b0e1b38633c2af4fea6ec8a42ad73d72299dfdbf6d4 + // Generated from data, hash: 069616f98bbd2020a67c0adc8c5be88728df82ce72f3a3a2245141493c7bdbad db.ModelReferences.AddRange( [ - new(){ Id=0, ProviderId=0, Name="Test", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=2048, MaxResponseTokens=2048, TokenizerId=1, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, - new(){ Id=100, ProviderId=1, Name="gpt-35-turbo-0301", ShortName="gpt-35-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=1.50000M, OutputTokenPrice1M=2.00000M, CurrencyCode="USD", }, - new(){ Id=101, ProviderId=1, Name="gpt-35-turbo-16k-0613", ShortName="gpt-35-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=16385, MaxResponseTokens=16385, TokenizerId=1, InputTokenPrice1M=3.00000M, OutputTokenPrice1M=4.00000M, CurrencyCode="USD", }, - new(){ Id=102, ProviderId=1, Name="gpt-35-turbo-0613", ShortName="gpt-35-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=1.50000M, OutputTokenPrice1M=2.00000M, CurrencyCode="USD", }, - new(){ Id=103, ProviderId=1, Name="gpt-35-turbo-1106", ShortName="gpt-35-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=1.00000M, OutputTokenPrice1M=2.00000M, CurrencyCode="USD", }, - new(){ Id=104, ProviderId=1, Name="gpt-35-turbo-instruct", ShortName="gpt-35-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=1.50000M, OutputTokenPrice1M=2.00000M, CurrencyCode="USD", }, - new(){ Id=105, ProviderId=1, Name="gpt-35-turbo-0125", ShortName="gpt-35-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=0.50000M, OutputTokenPrice1M=1.50000M, CurrencyCode="USD", }, - new(){ Id=106, ProviderId=1, Name="gpt-4-vision-preview", ShortName="gpt-4-vision", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=10.00000M, OutputTokenPrice1M=30.00000M, CurrencyCode="USD", }, - new(){ Id=107, ProviderId=1, Name="gpt-4-1106-preview", ShortName="gpt-4-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=10.00000M, OutputTokenPrice1M=30.00000M, CurrencyCode="USD", }, - new(){ Id=108, ProviderId=1, Name="gpt-4-0125-preview", ShortName="gpt-4-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=10.00000M, OutputTokenPrice1M=30.00000M, CurrencyCode="USD", }, - new(){ Id=109, ProviderId=1, Name="gpt-4-32k", ShortName="gpt-4-32k", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=32768, TokenizerId=1, InputTokenPrice1M=60.00000M, OutputTokenPrice1M=120.00000M, CurrencyCode="USD", }, - new(){ Id=110, ProviderId=1, Name="gpt-4", ShortName="gpt-4", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=8192, TokenizerId=1, InputTokenPrice1M=30.00000M, OutputTokenPrice1M=60.00000M, CurrencyCode="USD", }, - new(){ Id=111, ProviderId=1, Name="gpt-4-turbo-2024-04-09", ShortName="gpt-4-turbo", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=10.00000M, OutputTokenPrice1M=30.00000M, CurrencyCode="USD", }, - new(){ Id=112, ProviderId=1, Name="o1-preview-2024-09-12", ShortName="o1-preview", IsLegacy=false, MinTemperature=1.00M, MaxTemperature=1.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=false, AllowStreaming=false, ContextWindow=128000, MaxResponseTokens=32768, TokenizerId=2, InputTokenPrice1M=15.00000M, OutputTokenPrice1M=60.00000M, CurrencyCode="USD", }, - new(){ Id=113, ProviderId=1, Name="o1-mini-2024-09-12", ShortName="o1-mini", IsLegacy=false, MinTemperature=1.00M, MaxTemperature=1.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=false, AllowStreaming=false, ContextWindow=128000, MaxResponseTokens=65536, TokenizerId=2, InputTokenPrice1M=3.00000M, OutputTokenPrice1M=12.00000M, CurrencyCode="USD", }, - new(){ Id=114, ProviderId=1, Name="gpt-4o-mini-2024-07-18", ShortName="gpt-4o", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=16384, TokenizerId=2, InputTokenPrice1M=0.15000M, OutputTokenPrice1M=0.60000M, CurrencyCode="USD", }, - new(){ Id=115, ProviderId=1, Name="gpt-4o-2024-05-13", ShortName="gpt-4o", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=4096, TokenizerId=2, InputTokenPrice1M=5.00000M, OutputTokenPrice1M=15.00000M, CurrencyCode="USD", }, - new(){ Id=116, ProviderId=1, Name="gpt-4o-2024-08-06", ShortName="gpt-4o", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=16384, TokenizerId=2, InputTokenPrice1M=2.50000M, OutputTokenPrice1M=10.00000M, CurrencyCode="USD", }, - new(){ Id=117, ProviderId=1, Name="gpt-4o-2024-11-20", ShortName="gpt-4o", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=16384, TokenizerId=2, InputTokenPrice1M=2.50000M, OutputTokenPrice1M=10.00000M, CurrencyCode="USD", }, - new(){ Id=200, ProviderId=2, Name="hunyuan-turbo", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=15.00000M, OutputTokenPrice1M=50.00000M, CurrencyCode="RMB", }, - new(){ Id=201, ProviderId=2, Name="hunyuan-pro", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=30.00000M, OutputTokenPrice1M=100.00000M, CurrencyCode="RMB", }, - new(){ Id=202, ProviderId=2, Name="hunyuan-standard-256K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=262144, MaxResponseTokens=6144, TokenizerId=null, InputTokenPrice1M=15.00000M, OutputTokenPrice1M=60.00000M, CurrencyCode="RMB", }, - new(){ Id=203, ProviderId=2, Name="hunyuan-standard", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=2048, TokenizerId=null, InputTokenPrice1M=4.50000M, OutputTokenPrice1M=5.00000M, CurrencyCode="RMB", }, - new(){ Id=204, ProviderId=2, Name="hunyuan-lite", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=262144, MaxResponseTokens=6144, TokenizerId=null, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, - new(){ Id=205, ProviderId=2, Name="hunyuan-role", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=4.00000M, OutputTokenPrice1M=8.00000M, CurrencyCode="RMB", }, - new(){ Id=206, ProviderId=2, Name="hunyuan-functioncall ", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=4.00000M, OutputTokenPrice1M=8.00000M, CurrencyCode="RMB", }, - new(){ Id=207, ProviderId=2, Name="hunyuan-code", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=4.00000M, OutputTokenPrice1M=8.00000M, CurrencyCode="RMB", }, - new(){ Id=208, ProviderId=2, Name="hunyuan-vision", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=true, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=18.00000M, OutputTokenPrice1M=18.00000M, CurrencyCode="RMB", }, - new(){ Id=300, ProviderId=3, Name="yi-lightning", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=16384, MaxResponseTokens=16384, TokenizerId=null, InputTokenPrice1M=0.99000M, OutputTokenPrice1M=0.99000M, CurrencyCode="RMB", }, - new(){ Id=301, ProviderId=3, Name="yi-large", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=16384, TokenizerId=null, InputTokenPrice1M=20.00000M, OutputTokenPrice1M=20.00000M, CurrencyCode="RMB", }, - new(){ Id=302, ProviderId=3, Name="yi-medium", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=16384, MaxResponseTokens=16384, TokenizerId=null, InputTokenPrice1M=2.50000M, OutputTokenPrice1M=2.50000M, CurrencyCode="RMB", }, - new(){ Id=303, ProviderId=3, Name="yi-vision", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=16384, MaxResponseTokens=16384, TokenizerId=null, InputTokenPrice1M=6.00000M, OutputTokenPrice1M=6.00000M, CurrencyCode="RMB", }, - new(){ Id=304, ProviderId=3, Name="yi-medium-200k", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=204800, MaxResponseTokens=16384, TokenizerId=null, InputTokenPrice1M=12.00000M, OutputTokenPrice1M=12.00000M, CurrencyCode="RMB", }, - new(){ Id=305, ProviderId=3, Name="yi-spark", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=16384, MaxResponseTokens=16384, TokenizerId=null, InputTokenPrice1M=1.00000M, OutputTokenPrice1M=1.00000M, CurrencyCode="RMB", }, - new(){ Id=306, ProviderId=3, Name="yi-large-rag", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=16384, MaxResponseTokens=16384, TokenizerId=null, InputTokenPrice1M=25.00000M, OutputTokenPrice1M=25.00000M, CurrencyCode="RMB", }, - new(){ Id=307, ProviderId=3, Name="yi-large-fc", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=16384, TokenizerId=null, InputTokenPrice1M=20.00000M, OutputTokenPrice1M=20.00000M, CurrencyCode="RMB", }, - new(){ Id=308, ProviderId=3, Name="yi-large-turbo", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=16384, MaxResponseTokens=16384, TokenizerId=null, InputTokenPrice1M=12.00000M, OutputTokenPrice1M=12.00000M, CurrencyCode="RMB", }, - new(){ Id=400, ProviderId=4, Name="moonshot-v1-8k", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=12.00000M, OutputTokenPrice1M=12.00000M, CurrencyCode="RMB", }, - new(){ Id=401, ProviderId=4, Name="moonshot-v1-32k", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=32768, TokenizerId=null, InputTokenPrice1M=24.00000M, OutputTokenPrice1M=24.00000M, CurrencyCode="RMB", }, - new(){ Id=402, ProviderId=4, Name="moonshot-v1-128k", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=131072, TokenizerId=null, InputTokenPrice1M=60.00000M, OutputTokenPrice1M=60.00000M, CurrencyCode="RMB", }, - new(){ Id=500, ProviderId=5, Name="gpt-3.5-turbo-0301", ShortName="gpt-3.5-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=1.50000M, OutputTokenPrice1M=2.00000M, CurrencyCode="USD", }, - new(){ Id=501, ProviderId=5, Name="gpt-3.5-turbo-16k-0613", ShortName="gpt-3.5-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=16385, MaxResponseTokens=16385, TokenizerId=1, InputTokenPrice1M=3.00000M, OutputTokenPrice1M=4.00000M, CurrencyCode="USD", }, - new(){ Id=502, ProviderId=5, Name="gpt-3.5-turbo-0613", ShortName="gpt-3.5-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=1.50000M, OutputTokenPrice1M=2.00000M, CurrencyCode="USD", }, - new(){ Id=503, ProviderId=5, Name="gpt-3.5-turbo-1106", ShortName="gpt-3.5-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=1.00000M, OutputTokenPrice1M=2.00000M, CurrencyCode="USD", }, - new(){ Id=504, ProviderId=5, Name="gpt-3.5-turbo-instruct", ShortName="gpt-3.5-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=1.50000M, OutputTokenPrice1M=2.00000M, CurrencyCode="USD", }, - new(){ Id=505, ProviderId=5, Name="gpt-3.5-turbo-0125", ShortName="gpt-3.5-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=0.50000M, OutputTokenPrice1M=1.50000M, CurrencyCode="USD", }, - new(){ Id=506, ProviderId=5, Name="gpt-4-vision-preview", ShortName="gpt-4-vision", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=10.00000M, OutputTokenPrice1M=30.00000M, CurrencyCode="USD", }, - new(){ Id=507, ProviderId=5, Name="gpt-4-1106-preview", ShortName="gpt-4-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=10.00000M, OutputTokenPrice1M=30.00000M, CurrencyCode="USD", }, - new(){ Id=508, ProviderId=5, Name="gpt-4-0125-preview", ShortName="gpt-4-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=10.00000M, OutputTokenPrice1M=30.00000M, CurrencyCode="USD", }, - new(){ Id=509, ProviderId=5, Name="gpt-4-32k", ShortName="gpt-4-32k", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=32768, TokenizerId=1, InputTokenPrice1M=60.00000M, OutputTokenPrice1M=120.00000M, CurrencyCode="USD", }, - new(){ Id=510, ProviderId=5, Name="gpt-4", ShortName="gpt-4", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=8192, TokenizerId=1, InputTokenPrice1M=30.00000M, OutputTokenPrice1M=60.00000M, CurrencyCode="USD", }, - new(){ Id=511, ProviderId=5, Name="gpt-4-turbo-2024-04-09", ShortName="gpt-4-turbo", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=10.00000M, OutputTokenPrice1M=30.00000M, CurrencyCode="USD", }, - new(){ Id=512, ProviderId=5, Name="o1-preview-2024-09-12", ShortName="o1-preview", IsLegacy=false, MinTemperature=1.00M, MaxTemperature=1.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=false, AllowStreaming=false, ContextWindow=128000, MaxResponseTokens=32768, TokenizerId=2, InputTokenPrice1M=15.00000M, OutputTokenPrice1M=60.00000M, CurrencyCode="USD", }, - new(){ Id=513, ProviderId=5, Name="o1-mini-2024-09-12", ShortName="o1-mini", IsLegacy=false, MinTemperature=1.00M, MaxTemperature=1.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=false, AllowStreaming=false, ContextWindow=128000, MaxResponseTokens=65536, TokenizerId=2, InputTokenPrice1M=3.00000M, OutputTokenPrice1M=12.00000M, CurrencyCode="USD", }, - new(){ Id=514, ProviderId=5, Name="gpt-4o-mini-2024-07-18", ShortName="gpt-4o", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=16384, TokenizerId=2, InputTokenPrice1M=0.15000M, OutputTokenPrice1M=0.60000M, CurrencyCode="USD", }, - new(){ Id=515, ProviderId=5, Name="gpt-4o-2024-05-13", ShortName="gpt-4o", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=4096, TokenizerId=2, InputTokenPrice1M=5.00000M, OutputTokenPrice1M=15.00000M, CurrencyCode="USD", }, - new(){ Id=516, ProviderId=5, Name="gpt-4o-2024-08-06", ShortName="gpt-4o", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=16384, TokenizerId=2, InputTokenPrice1M=2.50000M, OutputTokenPrice1M=10.00000M, CurrencyCode="USD", }, - new(){ Id=517, ProviderId=5, Name="gpt-4o-2024-11-20", ShortName="gpt-4o", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=16384, TokenizerId=2, InputTokenPrice1M=2.50000M, OutputTokenPrice1M=10.00000M, CurrencyCode="USD", }, - new(){ Id=600, ProviderId=6, Name="ERNIE-4.0-Turbo-8K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=2048, TokenizerId=null, InputTokenPrice1M=30.00000M, OutputTokenPrice1M=90.00000M, CurrencyCode="RMB", }, - new(){ Id=601, ProviderId=6, Name="ERNIE-4.0-8K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=2048, TokenizerId=null, InputTokenPrice1M=20.00000M, OutputTokenPrice1M=60.00000M, CurrencyCode="RMB", }, - new(){ Id=602, ProviderId=6, Name="ERNIE-3.5-8K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=2048, TokenizerId=null, InputTokenPrice1M=0.80000M, OutputTokenPrice1M=2.00000M, CurrencyCode="RMB", }, - new(){ Id=603, ProviderId=6, Name="ERNIE-3.5-128K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=0.80000M, OutputTokenPrice1M=2.00000M, CurrencyCode="RMB", }, - new(){ Id=604, ProviderId=6, Name="ERNIE-Speed-Pro-128K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=0.30000M, OutputTokenPrice1M=0.60000M, CurrencyCode="RMB", }, - new(){ Id=605, ProviderId=6, Name="ERNIE-Novel-8K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=2048, TokenizerId=null, InputTokenPrice1M=40.00000M, OutputTokenPrice1M=120.00000M, CurrencyCode="RMB", }, - new(){ Id=606, ProviderId=6, Name="ERNIE-Speed-128K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, - new(){ Id=607, ProviderId=6, Name="ERNIE-Speed-8K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=1024, TokenizerId=null, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, - new(){ Id=608, ProviderId=6, Name="ERNIE-Lite-128K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=2048, TokenizerId=null, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, - new(){ Id=609, ProviderId=6, Name="ERNIE-Lite-8K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, - new(){ Id=610, ProviderId=6, Name="ERNIE-Tiny-128K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, - new(){ Id=611, ProviderId=6, Name="ERNIE-Tiny-8K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=2048, TokenizerId=null, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, - new(){ Id=612, ProviderId=6, Name="ERNIE-Character-Fiction-8K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=2048, TokenizerId=null, InputTokenPrice1M=4.00000M, OutputTokenPrice1M=8.00000M, CurrencyCode="RMB", }, - new(){ Id=613, ProviderId=6, Name="ERNIE-Functions-8K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=2048, TokenizerId=null, InputTokenPrice1M=4.00000M, OutputTokenPrice1M=8.00000M, CurrencyCode="RMB", }, - new(){ Id=614, ProviderId=6, Name="ERNIE-Lite-Pro-128K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=0.20000M, OutputTokenPrice1M=0.40000M, CurrencyCode="RMB", }, - new(){ Id=700, ProviderId=7, Name="qwen-max", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=20.00000M, OutputTokenPrice1M=60.00000M, CurrencyCode="RMB", }, - new(){ Id=701, ProviderId=7, Name="qwen-plus", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=0.80000M, OutputTokenPrice1M=2.00000M, CurrencyCode="RMB", }, - new(){ Id=702, ProviderId=7, Name="qwen-turbo", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=0.30000M, OutputTokenPrice1M=0.60000M, CurrencyCode="RMB", }, - new(){ Id=703, ProviderId=7, Name="qwen-long", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=10000000, MaxResponseTokens=6000, TokenizerId=null, InputTokenPrice1M=0.50000M, OutputTokenPrice1M=2.00000M, CurrencyCode="RMB", }, - new(){ Id=704, ProviderId=7, Name="qwen-vl-max", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32000, MaxResponseTokens=2000, TokenizerId=null, InputTokenPrice1M=20.00000M, OutputTokenPrice1M=20.00000M, CurrencyCode="RMB", }, - new(){ Id=705, ProviderId=7, Name="qwen-vl-plus", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8000, MaxResponseTokens=2000, TokenizerId=null, InputTokenPrice1M=8.00000M, OutputTokenPrice1M=8.00000M, CurrencyCode="RMB", }, - new(){ Id=706, ProviderId=7, Name="qwen-math-plus", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=3072, TokenizerId=null, InputTokenPrice1M=4.00000M, OutputTokenPrice1M=12.00000M, CurrencyCode="RMB", }, - new(){ Id=707, ProviderId=7, Name="qwen-math-turbo", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=3072, TokenizerId=null, InputTokenPrice1M=2.00000M, OutputTokenPrice1M=6.00000M, CurrencyCode="RMB", }, - new(){ Id=708, ProviderId=7, Name="qwen-coder-turbo", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=2.00000M, OutputTokenPrice1M=6.00000M, CurrencyCode="RMB", }, - new(){ Id=709, ProviderId=7, Name="qwen2.5-72b-instruct", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=4.00000M, OutputTokenPrice1M=12.00000M, CurrencyCode="RMB", }, - new(){ Id=710, ProviderId=7, Name="qwen2.5-32b-instruct", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=3.50000M, OutputTokenPrice1M=7.00000M, CurrencyCode="RMB", }, - new(){ Id=711, ProviderId=7, Name="qwen2.5-14b-instruct", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=2.00000M, OutputTokenPrice1M=6.00000M, CurrencyCode="RMB", }, - new(){ Id=712, ProviderId=7, Name="qwen2.5-7b-instruct", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=1.00000M, OutputTokenPrice1M=2.00000M, CurrencyCode="RMB", }, - new(){ Id=713, ProviderId=7, Name="qwen2.5-3b-instruct", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, - new(){ Id=714, ProviderId=7, Name="qwen2.5-1.5b-instruct", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, - new(){ Id=715, ProviderId=7, Name="qwen2.5-0.5b-instruct", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, - new(){ Id=716, ProviderId=7, Name="qwen2-vl-7b-instruct", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32000, MaxResponseTokens=2000, TokenizerId=null, InputTokenPrice1M=8.00000M, OutputTokenPrice1M=8.00000M, CurrencyCode="RMB", }, - new(){ Id=717, ProviderId=7, Name="qwen2-vl-2b-instruct", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32000, MaxResponseTokens=2000, TokenizerId=null, InputTokenPrice1M=8.00000M, OutputTokenPrice1M=8.00000M, CurrencyCode="RMB", }, - new(){ Id=718, ProviderId=7, Name="qwen2.5-math-72b-instruct", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=3072, TokenizerId=null, InputTokenPrice1M=4.00000M, OutputTokenPrice1M=12.00000M, CurrencyCode="RMB", }, - new(){ Id=719, ProviderId=7, Name="qwen2.5-math-7b-instruct", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=3072, TokenizerId=null, InputTokenPrice1M=1.00000M, OutputTokenPrice1M=2.00000M, CurrencyCode="RMB", }, - new(){ Id=720, ProviderId=7, Name="qwen2.5-math-1.5b-instruct", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=3072, TokenizerId=null, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, - new(){ Id=721, ProviderId=7, Name="qwen2.5-coder-7b-instruct", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=1.00000M, OutputTokenPrice1M=2.00000M, CurrencyCode="RMB", }, - new(){ Id=722, ProviderId=7, Name="qwen2.5-coder-1.5b-instruct", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, - new(){ Id=800, ProviderId=8, Name="lite", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, - new(){ Id=801, ProviderId=8, Name="generalv3", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=7.00000M, OutputTokenPrice1M=7.00000M, CurrencyCode="RMB", }, - new(){ Id=802, ProviderId=8, Name="pro-128k", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=13.00000M, OutputTokenPrice1M=13.00000M, CurrencyCode="RMB", }, - new(){ Id=803, ProviderId=8, Name="generalv3.5", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=30.00000M, OutputTokenPrice1M=30.00000M, CurrencyCode="RMB", }, - new(){ Id=804, ProviderId=8, Name="max-32k", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=32.00000M, OutputTokenPrice1M=32.00000M, CurrencyCode="RMB", }, - new(){ Id=805, ProviderId=8, Name="4.0Ultra", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=70.00000M, OutputTokenPrice1M=70.00000M, CurrencyCode="RMB", }, - new(){ Id=900, ProviderId=9, Name="glm-4-plus", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=50.00000M, OutputTokenPrice1M=50.00000M, CurrencyCode="RMB", }, - new(){ Id=901, ProviderId=9, Name="glm-4-0520", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=100.00000M, OutputTokenPrice1M=100.00000M, CurrencyCode="RMB", }, - new(){ Id=902, ProviderId=9, Name="glm-4-air", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=1.00000M, OutputTokenPrice1M=1.00000M, CurrencyCode="RMB", }, - new(){ Id=903, ProviderId=9, Name="glm-4-airx", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=10.00000M, OutputTokenPrice1M=10.00000M, CurrencyCode="RMB", }, - new(){ Id=904, ProviderId=9, Name="glm-4-long", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=1048576, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=1.00000M, OutputTokenPrice1M=1.00000M, CurrencyCode="RMB", }, - new(){ Id=905, ProviderId=9, Name="glm-4-flashx", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=0.10000M, OutputTokenPrice1M=0.10000M, CurrencyCode="RMB", }, - new(){ Id=906, ProviderId=9, Name="glm-4-flash", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, - new(){ Id=907, ProviderId=9, Name="glm-4v-plus", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=1024, TokenizerId=null, InputTokenPrice1M=10.00000M, OutputTokenPrice1M=10.00000M, CurrencyCode="RMB", }, - new(){ Id=908, ProviderId=9, Name="glm-4v", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=2048, MaxResponseTokens=1024, TokenizerId=null, InputTokenPrice1M=50.00000M, OutputTokenPrice1M=50.00000M, CurrencyCode="RMB", }, - new(){ Id=1000, ProviderId=10, Name="deepseek-chat", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=64000, MaxResponseTokens=4000, TokenizerId=null, InputTokenPrice1M=1.00000M, OutputTokenPrice1M=2.00000M, CurrencyCode="RMB", } + new(){ Id=0, ProviderId=0, Name="Test", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=2048, MaxResponseTokens=2048, TokenizerId=1, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, + new(){ Id=100, ProviderId=1, Name="gpt-35-turbo-0301", ShortName="gpt-35-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=1.50000M, OutputTokenPrice1M=2.00000M, CurrencyCode="USD", }, + new(){ Id=101, ProviderId=1, Name="gpt-35-turbo-16k-0613", ShortName="gpt-35-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=16385, MaxResponseTokens=16385, TokenizerId=1, InputTokenPrice1M=3.00000M, OutputTokenPrice1M=4.00000M, CurrencyCode="USD", }, + new(){ Id=102, ProviderId=1, Name="gpt-35-turbo-0613", ShortName="gpt-35-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=1.50000M, OutputTokenPrice1M=2.00000M, CurrencyCode="USD", }, + new(){ Id=103, ProviderId=1, Name="gpt-35-turbo-1106", ShortName="gpt-35-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=1.00000M, OutputTokenPrice1M=2.00000M, CurrencyCode="USD", }, + new(){ Id=104, ProviderId=1, Name="gpt-35-turbo-instruct", ShortName="gpt-35-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=1.50000M, OutputTokenPrice1M=2.00000M, CurrencyCode="USD", }, + new(){ Id=105, ProviderId=1, Name="gpt-35-turbo-0125", ShortName="gpt-35-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=0.50000M, OutputTokenPrice1M=1.50000M, CurrencyCode="USD", }, + new(){ Id=106, ProviderId=1, Name="gpt-4-vision-preview", ShortName="gpt-4-vision", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=10.00000M, OutputTokenPrice1M=30.00000M, CurrencyCode="USD", }, + new(){ Id=107, ProviderId=1, Name="gpt-4-1106-preview", ShortName="gpt-4-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=10.00000M, OutputTokenPrice1M=30.00000M, CurrencyCode="USD", }, + new(){ Id=108, ProviderId=1, Name="gpt-4-0125-preview", ShortName="gpt-4-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=10.00000M, OutputTokenPrice1M=30.00000M, CurrencyCode="USD", }, + new(){ Id=109, ProviderId=1, Name="gpt-4-32k", ShortName="gpt-4-32k", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=32768, TokenizerId=1, InputTokenPrice1M=60.00000M, OutputTokenPrice1M=120.00000M, CurrencyCode="USD", }, + new(){ Id=110, ProviderId=1, Name="gpt-4", ShortName="gpt-4", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=8192, TokenizerId=1, InputTokenPrice1M=30.00000M, OutputTokenPrice1M=60.00000M, CurrencyCode="USD", }, + new(){ Id=111, ProviderId=1, Name="gpt-4-turbo-2024-04-09", ShortName="gpt-4-turbo", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=10.00000M, OutputTokenPrice1M=30.00000M, CurrencyCode="USD", }, + new(){ Id=112, ProviderId=1, Name="o1-preview-2024-09-12", ShortName="o1-preview", IsLegacy=false, MinTemperature=1.00M, MaxTemperature=1.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=false, AllowStreaming=false, ContextWindow=128000, MaxResponseTokens=32768, TokenizerId=2, InputTokenPrice1M=15.00000M, OutputTokenPrice1M=60.00000M, CurrencyCode="USD", }, + new(){ Id=113, ProviderId=1, Name="o1-mini-2024-09-12", ShortName="o1-mini", IsLegacy=false, MinTemperature=1.00M, MaxTemperature=1.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=false, AllowStreaming=false, ContextWindow=128000, MaxResponseTokens=65536, TokenizerId=2, InputTokenPrice1M=3.00000M, OutputTokenPrice1M=12.00000M, CurrencyCode="USD", }, + new(){ Id=114, ProviderId=1, Name="gpt-4o-mini-2024-07-18", ShortName="gpt-4o", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=16384, TokenizerId=2, InputTokenPrice1M=0.15000M, OutputTokenPrice1M=0.60000M, CurrencyCode="USD", }, + new(){ Id=115, ProviderId=1, Name="gpt-4o-2024-05-13", ShortName="gpt-4o", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=4096, TokenizerId=2, InputTokenPrice1M=5.00000M, OutputTokenPrice1M=15.00000M, CurrencyCode="USD", }, + new(){ Id=116, ProviderId=1, Name="gpt-4o-2024-08-06", ShortName="gpt-4o", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=16384, TokenizerId=2, InputTokenPrice1M=2.50000M, OutputTokenPrice1M=10.00000M, CurrencyCode="USD", }, + new(){ Id=117, ProviderId=1, Name="gpt-4o-2024-11-20", ShortName="gpt-4o", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=16384, TokenizerId=2, InputTokenPrice1M=2.50000M, OutputTokenPrice1M=10.00000M, CurrencyCode="USD", }, + new(){ Id=200, ProviderId=2, Name="hunyuan-turbo", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=15.00000M, OutputTokenPrice1M=50.00000M, CurrencyCode="RMB", }, + new(){ Id=201, ProviderId=2, Name="hunyuan-pro", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=30.00000M, OutputTokenPrice1M=100.00000M, CurrencyCode="RMB", }, + new(){ Id=202, ProviderId=2, Name="hunyuan-standard-256K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=262144, MaxResponseTokens=6144, TokenizerId=null, InputTokenPrice1M=15.00000M, OutputTokenPrice1M=60.00000M, CurrencyCode="RMB", }, + new(){ Id=203, ProviderId=2, Name="hunyuan-standard", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=2048, TokenizerId=null, InputTokenPrice1M=4.50000M, OutputTokenPrice1M=5.00000M, CurrencyCode="RMB", }, + new(){ Id=204, ProviderId=2, Name="hunyuan-lite", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=262144, MaxResponseTokens=6144, TokenizerId=null, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, + new(){ Id=205, ProviderId=2, Name="hunyuan-role", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=4.00000M, OutputTokenPrice1M=8.00000M, CurrencyCode="RMB", }, + new(){ Id=206, ProviderId=2, Name="hunyuan-functioncall ", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=4.00000M, OutputTokenPrice1M=8.00000M, CurrencyCode="RMB", }, + new(){ Id=207, ProviderId=2, Name="hunyuan-code", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=4.00000M, OutputTokenPrice1M=8.00000M, CurrencyCode="RMB", }, + new(){ Id=208, ProviderId=2, Name="hunyuan-vision", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=true, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=18.00000M, OutputTokenPrice1M=18.00000M, CurrencyCode="RMB", }, + new(){ Id=300, ProviderId=3, Name="yi-lightning", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=16384, MaxResponseTokens=16384, TokenizerId=null, InputTokenPrice1M=0.99000M, OutputTokenPrice1M=0.99000M, CurrencyCode="RMB", }, + new(){ Id=301, ProviderId=3, Name="yi-large", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=16384, TokenizerId=null, InputTokenPrice1M=20.00000M, OutputTokenPrice1M=20.00000M, CurrencyCode="RMB", }, + new(){ Id=302, ProviderId=3, Name="yi-medium", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=16384, MaxResponseTokens=16384, TokenizerId=null, InputTokenPrice1M=2.50000M, OutputTokenPrice1M=2.50000M, CurrencyCode="RMB", }, + new(){ Id=303, ProviderId=3, Name="yi-vision", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=16384, MaxResponseTokens=16384, TokenizerId=null, InputTokenPrice1M=6.00000M, OutputTokenPrice1M=6.00000M, CurrencyCode="RMB", }, + new(){ Id=304, ProviderId=3, Name="yi-medium-200k", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=204800, MaxResponseTokens=16384, TokenizerId=null, InputTokenPrice1M=12.00000M, OutputTokenPrice1M=12.00000M, CurrencyCode="RMB", }, + new(){ Id=305, ProviderId=3, Name="yi-spark", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=16384, MaxResponseTokens=16384, TokenizerId=null, InputTokenPrice1M=1.00000M, OutputTokenPrice1M=1.00000M, CurrencyCode="RMB", }, + new(){ Id=306, ProviderId=3, Name="yi-large-rag", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=16384, MaxResponseTokens=16384, TokenizerId=null, InputTokenPrice1M=25.00000M, OutputTokenPrice1M=25.00000M, CurrencyCode="RMB", }, + new(){ Id=307, ProviderId=3, Name="yi-large-fc", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=16384, TokenizerId=null, InputTokenPrice1M=20.00000M, OutputTokenPrice1M=20.00000M, CurrencyCode="RMB", }, + new(){ Id=308, ProviderId=3, Name="yi-large-turbo", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=16384, MaxResponseTokens=16384, TokenizerId=null, InputTokenPrice1M=12.00000M, OutputTokenPrice1M=12.00000M, CurrencyCode="RMB", }, + new(){ Id=400, ProviderId=4, Name="moonshot-v1-8k", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=12.00000M, OutputTokenPrice1M=12.00000M, CurrencyCode="RMB", }, + new(){ Id=401, ProviderId=4, Name="moonshot-v1-32k", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=32768, TokenizerId=null, InputTokenPrice1M=24.00000M, OutputTokenPrice1M=24.00000M, CurrencyCode="RMB", }, + new(){ Id=402, ProviderId=4, Name="moonshot-v1-128k", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=131072, TokenizerId=null, InputTokenPrice1M=60.00000M, OutputTokenPrice1M=60.00000M, CurrencyCode="RMB", }, + new(){ Id=500, ProviderId=5, Name="gpt-3.5-turbo-0301", ShortName="gpt-3.5-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=1.50000M, OutputTokenPrice1M=2.00000M, CurrencyCode="USD", }, + new(){ Id=501, ProviderId=5, Name="gpt-3.5-turbo-16k-0613", ShortName="gpt-3.5-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=16385, MaxResponseTokens=16385, TokenizerId=1, InputTokenPrice1M=3.00000M, OutputTokenPrice1M=4.00000M, CurrencyCode="USD", }, + new(){ Id=502, ProviderId=5, Name="gpt-3.5-turbo-0613", ShortName="gpt-3.5-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=1.50000M, OutputTokenPrice1M=2.00000M, CurrencyCode="USD", }, + new(){ Id=503, ProviderId=5, Name="gpt-3.5-turbo-1106", ShortName="gpt-3.5-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=1.00000M, OutputTokenPrice1M=2.00000M, CurrencyCode="USD", }, + new(){ Id=504, ProviderId=5, Name="gpt-3.5-turbo-instruct", ShortName="gpt-3.5-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=1.50000M, OutputTokenPrice1M=2.00000M, CurrencyCode="USD", }, + new(){ Id=505, ProviderId=5, Name="gpt-3.5-turbo-0125", ShortName="gpt-3.5-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=0.50000M, OutputTokenPrice1M=1.50000M, CurrencyCode="USD", }, + new(){ Id=506, ProviderId=5, Name="gpt-4-vision-preview", ShortName="gpt-4-vision", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=10.00000M, OutputTokenPrice1M=30.00000M, CurrencyCode="USD", }, + new(){ Id=507, ProviderId=5, Name="gpt-4-1106-preview", ShortName="gpt-4-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=10.00000M, OutputTokenPrice1M=30.00000M, CurrencyCode="USD", }, + new(){ Id=508, ProviderId=5, Name="gpt-4-0125-preview", ShortName="gpt-4-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=10.00000M, OutputTokenPrice1M=30.00000M, CurrencyCode="USD", }, + new(){ Id=509, ProviderId=5, Name="gpt-4-32k", ShortName="gpt-4-32k", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=32768, TokenizerId=1, InputTokenPrice1M=60.00000M, OutputTokenPrice1M=120.00000M, CurrencyCode="USD", }, + new(){ Id=510, ProviderId=5, Name="gpt-4", ShortName="gpt-4", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=8192, TokenizerId=1, InputTokenPrice1M=30.00000M, OutputTokenPrice1M=60.00000M, CurrencyCode="USD", }, + new(){ Id=511, ProviderId=5, Name="gpt-4-turbo-2024-04-09", ShortName="gpt-4-turbo", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=10.00000M, OutputTokenPrice1M=30.00000M, CurrencyCode="USD", }, + new(){ Id=512, ProviderId=5, Name="o1-preview-2024-09-12", ShortName="o1-preview", IsLegacy=false, MinTemperature=1.00M, MaxTemperature=1.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=false, AllowStreaming=false, ContextWindow=128000, MaxResponseTokens=32768, TokenizerId=2, InputTokenPrice1M=15.00000M, OutputTokenPrice1M=60.00000M, CurrencyCode="USD", }, + new(){ Id=513, ProviderId=5, Name="o1-mini-2024-09-12", ShortName="o1-mini", IsLegacy=false, MinTemperature=1.00M, MaxTemperature=1.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=false, AllowStreaming=false, ContextWindow=128000, MaxResponseTokens=65536, TokenizerId=2, InputTokenPrice1M=3.00000M, OutputTokenPrice1M=12.00000M, CurrencyCode="USD", }, + new(){ Id=514, ProviderId=5, Name="gpt-4o-mini-2024-07-18", ShortName="gpt-4o", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=16384, TokenizerId=2, InputTokenPrice1M=0.15000M, OutputTokenPrice1M=0.60000M, CurrencyCode="USD", }, + new(){ Id=515, ProviderId=5, Name="gpt-4o-2024-05-13", ShortName="gpt-4o", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=4096, TokenizerId=2, InputTokenPrice1M=5.00000M, OutputTokenPrice1M=15.00000M, CurrencyCode="USD", }, + new(){ Id=516, ProviderId=5, Name="gpt-4o-2024-08-06", ShortName="gpt-4o", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=16384, TokenizerId=2, InputTokenPrice1M=2.50000M, OutputTokenPrice1M=10.00000M, CurrencyCode="USD", }, + new(){ Id=517, ProviderId=5, Name="gpt-4o-2024-11-20", ShortName="gpt-4o", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=16384, TokenizerId=2, InputTokenPrice1M=2.50000M, OutputTokenPrice1M=10.00000M, CurrencyCode="USD", }, + new(){ Id=600, ProviderId=6, Name="ERNIE-4.0-Turbo-8K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=2048, TokenizerId=null, InputTokenPrice1M=30.00000M, OutputTokenPrice1M=90.00000M, CurrencyCode="RMB", }, + new(){ Id=601, ProviderId=6, Name="ERNIE-4.0-8K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=2048, TokenizerId=null, InputTokenPrice1M=20.00000M, OutputTokenPrice1M=60.00000M, CurrencyCode="RMB", }, + new(){ Id=602, ProviderId=6, Name="ERNIE-3.5-8K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=2048, TokenizerId=null, InputTokenPrice1M=0.80000M, OutputTokenPrice1M=2.00000M, CurrencyCode="RMB", }, + new(){ Id=603, ProviderId=6, Name="ERNIE-3.5-128K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=0.80000M, OutputTokenPrice1M=2.00000M, CurrencyCode="RMB", }, + new(){ Id=604, ProviderId=6, Name="ERNIE-Speed-Pro-128K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=0.30000M, OutputTokenPrice1M=0.60000M, CurrencyCode="RMB", }, + new(){ Id=605, ProviderId=6, Name="ERNIE-Novel-8K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=2048, TokenizerId=null, InputTokenPrice1M=40.00000M, OutputTokenPrice1M=120.00000M, CurrencyCode="RMB", }, + new(){ Id=606, ProviderId=6, Name="ERNIE-Speed-128K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, + new(){ Id=607, ProviderId=6, Name="ERNIE-Speed-8K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=1024, TokenizerId=null, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, + new(){ Id=608, ProviderId=6, Name="ERNIE-Lite-128K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=2048, TokenizerId=null, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, + new(){ Id=609, ProviderId=6, Name="ERNIE-Lite-8K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, + new(){ Id=610, ProviderId=6, Name="ERNIE-Tiny-128K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, + new(){ Id=611, ProviderId=6, Name="ERNIE-Tiny-8K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=2048, TokenizerId=null, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, + new(){ Id=612, ProviderId=6, Name="ERNIE-Character-Fiction-8K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=2048, TokenizerId=null, InputTokenPrice1M=4.00000M, OutputTokenPrice1M=8.00000M, CurrencyCode="RMB", }, + new(){ Id=613, ProviderId=6, Name="ERNIE-Functions-8K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=2048, TokenizerId=null, InputTokenPrice1M=4.00000M, OutputTokenPrice1M=8.00000M, CurrencyCode="RMB", }, + new(){ Id=614, ProviderId=6, Name="ERNIE-Lite-Pro-128K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=0.20000M, OutputTokenPrice1M=0.40000M, CurrencyCode="RMB", }, + new(){ Id=700, ProviderId=7, Name="qwen-max", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=20.00000M, OutputTokenPrice1M=60.00000M, CurrencyCode="RMB", }, + new(){ Id=701, ProviderId=7, Name="qwen-plus", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=0.80000M, OutputTokenPrice1M=2.00000M, CurrencyCode="RMB", }, + new(){ Id=702, ProviderId=7, Name="qwen-turbo", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=0.30000M, OutputTokenPrice1M=0.60000M, CurrencyCode="RMB", }, + new(){ Id=703, ProviderId=7, Name="qwen-long", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=10000000, MaxResponseTokens=6000, TokenizerId=null, InputTokenPrice1M=0.50000M, OutputTokenPrice1M=2.00000M, CurrencyCode="RMB", }, + new(){ Id=704, ProviderId=7, Name="qwen-vl-max", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32000, MaxResponseTokens=2000, TokenizerId=null, InputTokenPrice1M=20.00000M, OutputTokenPrice1M=20.00000M, CurrencyCode="RMB", }, + new(){ Id=705, ProviderId=7, Name="qwen-vl-plus", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8000, MaxResponseTokens=2000, TokenizerId=null, InputTokenPrice1M=8.00000M, OutputTokenPrice1M=8.00000M, CurrencyCode="RMB", }, + new(){ Id=706, ProviderId=7, Name="qwen-math-plus", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=3072, TokenizerId=null, InputTokenPrice1M=4.00000M, OutputTokenPrice1M=12.00000M, CurrencyCode="RMB", }, + new(){ Id=707, ProviderId=7, Name="qwen-math-turbo", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=3072, TokenizerId=null, InputTokenPrice1M=2.00000M, OutputTokenPrice1M=6.00000M, CurrencyCode="RMB", }, + new(){ Id=708, ProviderId=7, Name="qwen-coder-turbo", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=2.00000M, OutputTokenPrice1M=6.00000M, CurrencyCode="RMB", }, + new(){ Id=709, ProviderId=7, Name="qwen2.5-72b-instruct", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=4.00000M, OutputTokenPrice1M=12.00000M, CurrencyCode="RMB", }, + new(){ Id=710, ProviderId=7, Name="qwen2.5-32b-instruct", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=3.50000M, OutputTokenPrice1M=7.00000M, CurrencyCode="RMB", }, + new(){ Id=711, ProviderId=7, Name="qwen2.5-14b-instruct", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=2.00000M, OutputTokenPrice1M=6.00000M, CurrencyCode="RMB", }, + new(){ Id=712, ProviderId=7, Name="qwen2.5-7b-instruct", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=1.00000M, OutputTokenPrice1M=2.00000M, CurrencyCode="RMB", }, + new(){ Id=713, ProviderId=7, Name="qwen2.5-3b-instruct", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, + new(){ Id=714, ProviderId=7, Name="qwen2.5-1.5b-instruct", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, + new(){ Id=715, ProviderId=7, Name="qwen2.5-0.5b-instruct", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, + new(){ Id=716, ProviderId=7, Name="qwen2-vl-7b-instruct", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32000, MaxResponseTokens=2000, TokenizerId=null, InputTokenPrice1M=8.00000M, OutputTokenPrice1M=8.00000M, CurrencyCode="RMB", }, + new(){ Id=717, ProviderId=7, Name="qwen2-vl-2b-instruct", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32000, MaxResponseTokens=2000, TokenizerId=null, InputTokenPrice1M=8.00000M, OutputTokenPrice1M=8.00000M, CurrencyCode="RMB", }, + new(){ Id=718, ProviderId=7, Name="qwen2.5-math-72b-instruct", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=3072, TokenizerId=null, InputTokenPrice1M=4.00000M, OutputTokenPrice1M=12.00000M, CurrencyCode="RMB", }, + new(){ Id=719, ProviderId=7, Name="qwen2.5-math-7b-instruct", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=3072, TokenizerId=null, InputTokenPrice1M=1.00000M, OutputTokenPrice1M=2.00000M, CurrencyCode="RMB", }, + new(){ Id=720, ProviderId=7, Name="qwen2.5-math-1.5b-instruct", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=3072, TokenizerId=null, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, + new(){ Id=721, ProviderId=7, Name="qwen2.5-coder-7b-instruct", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=1.00000M, OutputTokenPrice1M=2.00000M, CurrencyCode="RMB", }, + new(){ Id=722, ProviderId=7, Name="qwen2.5-coder-1.5b-instruct", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, + new(){ Id=800, ProviderId=8, Name="lite", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, + new(){ Id=801, ProviderId=8, Name="generalv3", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=7.00000M, OutputTokenPrice1M=7.00000M, CurrencyCode="RMB", }, + new(){ Id=802, ProviderId=8, Name="pro-128k", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=13.00000M, OutputTokenPrice1M=13.00000M, CurrencyCode="RMB", }, + new(){ Id=803, ProviderId=8, Name="generalv3.5", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=30.00000M, OutputTokenPrice1M=30.00000M, CurrencyCode="RMB", }, + new(){ Id=804, ProviderId=8, Name="max-32k", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=32.00000M, OutputTokenPrice1M=32.00000M, CurrencyCode="RMB", }, + new(){ Id=805, ProviderId=8, Name="4.0Ultra", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=70.00000M, OutputTokenPrice1M=70.00000M, CurrencyCode="RMB", }, + new(){ Id=900, ProviderId=9, Name="glm-4-plus", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=50.00000M, OutputTokenPrice1M=50.00000M, CurrencyCode="RMB", }, + new(){ Id=901, ProviderId=9, Name="glm-4-0520", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=100.00000M, OutputTokenPrice1M=100.00000M, CurrencyCode="RMB", }, + new(){ Id=902, ProviderId=9, Name="glm-4-air", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=1.00000M, OutputTokenPrice1M=1.00000M, CurrencyCode="RMB", }, + new(){ Id=903, ProviderId=9, Name="glm-4-airx", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=10.00000M, OutputTokenPrice1M=10.00000M, CurrencyCode="RMB", }, + new(){ Id=904, ProviderId=9, Name="glm-4-long", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=1048576, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=1.00000M, OutputTokenPrice1M=1.00000M, CurrencyCode="RMB", }, + new(){ Id=905, ProviderId=9, Name="glm-4-flashx", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=0.10000M, OutputTokenPrice1M=0.10000M, CurrencyCode="RMB", }, + new(){ Id=906, ProviderId=9, Name="glm-4-flash", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, + new(){ Id=907, ProviderId=9, Name="glm-4v-plus", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=1024, TokenizerId=null, InputTokenPrice1M=10.00000M, OutputTokenPrice1M=10.00000M, CurrencyCode="RMB", }, + new(){ Id=908, ProviderId=9, Name="glm-4v", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=2048, MaxResponseTokens=1024, TokenizerId=null, InputTokenPrice1M=50.00000M, OutputTokenPrice1M=50.00000M, CurrencyCode="RMB", }, + new(){ Id=1000, ProviderId=10, Name="deepseek-chat", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=64000, MaxResponseTokens=4000, TokenizerId=null, InputTokenPrice1M=1.00000M, OutputTokenPrice1M=2.00000M, CurrencyCode="RMB", }, + new(){ Id=1100, ProviderId=11, Name="grok-beta", ShortName="grok", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=5.00000M, OutputTokenPrice1M=15.00000M, CurrencyCode="USD", }, + new(){ Id=1101, ProviderId=11, Name="grok-vision-beta", ShortName="grok", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=5.00000M, OutputTokenPrice1M=15.00000M, CurrencyCode="USD", }, + new(){ Id=1200, ProviderId=12, Name="AI21-Jamba-1.5-Large", ShortName="AI21-Jamba", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=256000, MaxResponseTokens=4000, TokenizerId=null, InputTokenPrice1M=5.00000M, OutputTokenPrice1M=15.00000M, CurrencyCode="USD", }, + new(){ Id=1201, ProviderId=12, Name="AI21-Jamba-1.5-Mini", ShortName="AI21-Jamba", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=256000, MaxResponseTokens=4000, TokenizerId=null, InputTokenPrice1M=1.00000M, OutputTokenPrice1M=2.00000M, CurrencyCode="USD", }, + new(){ Id=1202, ProviderId=12, Name="Cohere-command-r", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=1.00000M, OutputTokenPrice1M=2.00000M, CurrencyCode="USD", }, + new(){ Id=1203, ProviderId=12, Name="Cohere-command-r-plus", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="USD", }, + new(){ Id=1204, ProviderId=12, Name="Llama-3.2-11B-Vision-Instruct", ShortName="LLaMA", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=4000, TokenizerId=null, InputTokenPrice1M=1.00000M, OutputTokenPrice1M=2.00000M, CurrencyCode="USD", }, + new(){ Id=1205, ProviderId=12, Name="Llama-3.2-90B-Vision-Instruct", ShortName="LLaMA", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=4000, TokenizerId=null, InputTokenPrice1M=5.00000M, OutputTokenPrice1M=15.00000M, CurrencyCode="USD", }, + new(){ Id=1206, ProviderId=12, Name="Meta-Llama-3.1-405B-Instruct", ShortName="LLaMA", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=5.00000M, OutputTokenPrice1M=15.00000M, CurrencyCode="USD", }, + new(){ Id=1207, ProviderId=12, Name="Meta-Llama-3.1-70B-Instruct", ShortName="LLaMA", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=2.50000M, OutputTokenPrice1M=5.00000M, CurrencyCode="USD", }, + new(){ Id=1208, ProviderId=12, Name="Meta-Llama-3.1-8B-Instruct", ShortName="LLaMA", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=1.00000M, OutputTokenPrice1M=2.00000M, CurrencyCode="USD", }, + new(){ Id=1209, ProviderId=12, Name="Mistral-large", ShortName="Mistral", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=5.00000M, OutputTokenPrice1M=15.00000M, CurrencyCode="USD", }, + new(){ Id=1210, ProviderId=12, Name="Mistral-large-2407", ShortName="Mistral", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=5.00000M, OutputTokenPrice1M=15.00000M, CurrencyCode="USD", }, + new(){ Id=1211, ProviderId=12, Name="Mistral-Nemo", ShortName="Mistral", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=1.00000M, OutputTokenPrice1M=2.00000M, CurrencyCode="USD", }, + new(){ Id=1212, ProviderId=12, Name="Mistral-small", ShortName="Mistral", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=1.00000M, OutputTokenPrice1M=2.00000M, CurrencyCode="USD", }, + new(){ Id=1213, ProviderId=12, Name="gpt-4o", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=4096, TokenizerId=2, InputTokenPrice1M=5.00000M, OutputTokenPrice1M=15.00000M, CurrencyCode="USD", }, + new(){ Id=1214, ProviderId=12, Name="gpt-4o-mini", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=4096, TokenizerId=2, InputTokenPrice1M=1.00000M, OutputTokenPrice1M=2.00000M, CurrencyCode="USD", }, + new(){ Id=1215, ProviderId=12, Name="Phi-3.5-MoE-instruct", ShortName="Phi-3.5", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=1.00000M, OutputTokenPrice1M=2.00000M, CurrencyCode="USD", }, + new(){ Id=1216, ProviderId=12, Name="Phi-3.5-mini-instruct", ShortName="Phi-3.5", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=0.50000M, OutputTokenPrice1M=1.00000M, CurrencyCode="USD", }, + new(){ Id=1217, ProviderId=12, Name="Phi-3.5-vision-instruct", ShortName="Phi-3.5", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=1.00000M, OutputTokenPrice1M=2.00000M, CurrencyCode="USD", } ]); } private static void InsertModelProviders(ChatsDB db) { - // Generated from data, hash: 137fb94c0828ca100273aad14b6d69e7f9caef6a1d69cc96c2667a17a4e31ccc + // Generated from data, hash: 918110f3f52c51c8fdebe00ca4e2e9dac5d2f2e7f892ed5c7197be6a7fbcfbdf db.ModelProviders.AddRange( [ new(){ Id=0, Name="Test", InitialHost=null, InitialSecret=null, }, @@ -240,7 +260,9 @@ private static void InsertModelProviders(ChatsDB db) new(){ Id=7, Name="DashScope", InitialHost=null, InitialSecret="", }, new(){ Id=8, Name="Xunfei SparkDesk", InitialHost=null, InitialSecret="""{"appId": "", "apiKey":"", "secret":""}""", }, new(){ Id=9, Name="Zhipu AI", InitialHost=null, InitialSecret="", }, - new(){ Id=10, Name="DeepSeek", InitialHost=null, InitialSecret="", } + new(){ Id=10, Name="DeepSeek", InitialHost=null, InitialSecret="", }, + new(){ Id=11, Name="x.ai", InitialHost=null, InitialSecret="xai-yourkey", }, + new(){ Id=12, Name="Github Models", InitialHost=null, InitialSecret="ghp_yourkey", } ]); } }; \ No newline at end of file From bf4dd80672f179ebe1ef0a596f5106125716c79e Mon Sep 17 00:00:00 2001 From: gray Date: Wed, 11 Dec 2024 15:55:35 +0800 Subject: [PATCH 16/22] update pre-commit --- src/FE/.husky/pre-commit | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/FE/.husky/pre-commit b/src/FE/.husky/pre-commit index b7807b0d..8b6be6cb 100644 --- a/src/FE/.husky/pre-commit +++ b/src/FE/.husky/pre-commit @@ -1 +1,3 @@ +#!/usr/bin/env sh + npm run format \ No newline at end of file From e83feb614cc75f473c631742139018755a88f1ed Mon Sep 17 00:00:00 2001 From: gray Date: Wed, 11 Dec 2024 15:58:47 +0800 Subject: [PATCH 17/22] update pre-commit --- src/FE/.husky/pre-commit | 1 + 1 file changed, 1 insertion(+) diff --git a/src/FE/.husky/pre-commit b/src/FE/.husky/pre-commit index 8b6be6cb..7b2a0748 100644 --- a/src/FE/.husky/pre-commit +++ b/src/FE/.husky/pre-commit @@ -1,3 +1,4 @@ #!/usr/bin/env sh +. "$(dirname "$0")/_/husky.sh" npm run format \ No newline at end of file From 3e265386e89763ff6706793f5805845208cba71a Mon Sep 17 00:00:00 2001 From: gray Date: Wed, 11 Dec 2024 16:01:30 +0800 Subject: [PATCH 18/22] remove useless file --- src/FE/.gitattributes | 1 - 1 file changed, 1 deletion(-) delete mode 100644 src/FE/.gitattributes diff --git a/src/FE/.gitattributes b/src/FE/.gitattributes deleted file mode 100644 index 21256661..00000000 --- a/src/FE/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -* text=auto \ No newline at end of file From 127e235c07d43279734677e3038469be133599ca Mon Sep 17 00:00:00 2001 From: gray Date: Wed, 11 Dec 2024 16:17:06 +0800 Subject: [PATCH 19/22] fixed prompt not format --- src/FE/pages/home/_components/Chat/PromptList.tsx | 2 +- src/FE/pages/home/_components/HomeContent/HomeContent.tsx | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/FE/pages/home/_components/Chat/PromptList.tsx b/src/FE/pages/home/_components/Chat/PromptList.tsx index 52526479..d50b8e34 100644 --- a/src/FE/pages/home/_components/Chat/PromptList.tsx +++ b/src/FE/pages/home/_components/Chat/PromptList.tsx @@ -1,4 +1,4 @@ -import { ForwardedRef, MutableRefObject, forwardRef } from 'react'; +import { MutableRefObject } from 'react'; import { Prompt } from '@/types/prompt'; diff --git a/src/FE/pages/home/_components/HomeContent/HomeContent.tsx b/src/FE/pages/home/_components/HomeContent/HomeContent.tsx index 82aec4ff..251703e9 100644 --- a/src/FE/pages/home/_components/HomeContent/HomeContent.tsx +++ b/src/FE/pages/home/_components/HomeContent/HomeContent.tsx @@ -12,6 +12,7 @@ import { } from '@/utils/chats'; import { getSelectMessages } from '@/utils/message'; import { getStorageModelId, setStorageModelId } from '@/utils/model'; +import { formatPrompt } from '@/utils/promptVariable'; import { getSettings, saveSettings } from '@/utils/settings'; import { Settings } from '@/utils/settings'; import { getLoginUrl, getUserInfo, getUserSession } from '@/utils/user'; @@ -102,7 +103,7 @@ const HomeContent = () => { data.temperature ?? userModelConfig?.temperature ?? DEFAULT_TEMPERATURE, - prompt: data.content, + prompt: formatPrompt(data.content, { model }), }); }); }; From 0d1cab208a41478470bcedd190dc0008920aa215 Mon Sep 17 00:00:00 2001 From: sdcb Date: Wed, 11 Dec 2024 18:53:12 +0800 Subject: [PATCH 20/22] supports xai/github models --- src/BE/DB/Enums/DBModelProvider.cs | 2 ++ src/BE/Services/ChatServices/ChatFactory.cs | 7 ++----- .../ChatServices/ChatServiceExtensions.cs | 4 ---- .../Implementations/Azure/JsonAzureConfig.cs | 18 ------------------ .../Azure/JsonAzureModelConfig.cs | 18 ------------------ .../Implementations/GLM/JsonGLMModelConfig.cs | 15 --------------- .../Hunyuan/JsonHunyuanModelConfig.cs | 15 --------------- .../Kimi/JsonKimiModelConfig.cs | 12 ------------ .../{Azure => OpenAI}/AzureChatService.cs | 3 +-- .../DeepSeekChatService.cs | 3 +-- .../{GLM => OpenAI}/GLMChatService.cs | 3 +-- .../OpenAI/GithubModelsChatService.cs | 5 +++++ .../OpenAI/JsonOpenAIModelConfig.cs | 15 --------------- .../{Kimi => OpenAI}/KimiChatService.cs | 3 +-- .../{LingYi => OpenAI}/LingYiChatService.cs | 3 +-- .../Implementations/OpenAI/XAIChatService.cs | 5 +++++ 16 files changed, 19 insertions(+), 112 deletions(-) delete mode 100644 src/BE/Services/ChatServices/Implementations/Azure/JsonAzureConfig.cs delete mode 100644 src/BE/Services/ChatServices/Implementations/Azure/JsonAzureModelConfig.cs delete mode 100644 src/BE/Services/ChatServices/Implementations/GLM/JsonGLMModelConfig.cs delete mode 100644 src/BE/Services/ChatServices/Implementations/Hunyuan/JsonHunyuanModelConfig.cs delete mode 100644 src/BE/Services/ChatServices/Implementations/Kimi/JsonKimiModelConfig.cs rename src/BE/Services/ChatServices/Implementations/{Azure => OpenAI}/AzureChatService.cs (83%) rename src/BE/Services/ChatServices/Implementations/{DeepSeek => OpenAI}/DeepSeekChatService.cs (51%) rename src/BE/Services/ChatServices/Implementations/{GLM => OpenAI}/GLMChatService.cs (54%) create mode 100644 src/BE/Services/ChatServices/Implementations/OpenAI/GithubModelsChatService.cs delete mode 100644 src/BE/Services/ChatServices/Implementations/OpenAI/JsonOpenAIModelConfig.cs rename src/BE/Services/ChatServices/Implementations/{Kimi => OpenAI}/KimiChatService.cs (51%) rename src/BE/Services/ChatServices/Implementations/{LingYi => OpenAI}/LingYiChatService.cs (52%) create mode 100644 src/BE/Services/ChatServices/Implementations/OpenAI/XAIChatService.cs diff --git a/src/BE/DB/Enums/DBModelProvider.cs b/src/BE/DB/Enums/DBModelProvider.cs index c5f47d14..2c2f90bc 100644 --- a/src/BE/DB/Enums/DBModelProvider.cs +++ b/src/BE/DB/Enums/DBModelProvider.cs @@ -13,4 +13,6 @@ public enum DBModelProvider Sparkdesk = 8, ZhiPuAI = 9, DeepSeek = 10, + xAI = 11, + GithubModels = 12, } diff --git a/src/BE/Services/ChatServices/ChatFactory.cs b/src/BE/Services/ChatServices/ChatFactory.cs index 611642f1..d4f2d4bd 100644 --- a/src/BE/Services/ChatServices/ChatFactory.cs +++ b/src/BE/Services/ChatServices/ChatFactory.cs @@ -1,12 +1,7 @@ using Chats.BE.DB; using Chats.BE.DB.Enums; -using Chats.BE.Services.ChatServices.Implementations.Azure; using Chats.BE.Services.ChatServices.Implementations.DashScope; -using Chats.BE.Services.ChatServices.Implementations.DeepSeek; -using Chats.BE.Services.ChatServices.Implementations.GLM; using Chats.BE.Services.ChatServices.Implementations.Hunyuan; -using Chats.BE.Services.ChatServices.Implementations.Kimi; -using Chats.BE.Services.ChatServices.Implementations.LingYi; using Chats.BE.Services.ChatServices.Implementations.OpenAI; using Chats.BE.Services.ChatServices.Implementations.QianFan; using Chats.BE.Services.ChatServices.Implementations.Test; @@ -32,6 +27,8 @@ public ChatService CreateConversationService(Model model) DBModelProvider.Sparkdesk => throw new NotImplementedException("Spark model is not implemented"), DBModelProvider.LingYi => new LingYiChatService(model), DBModelProvider.DeepSeek => new DeepSeekChatService(model), + DBModelProvider.xAI => new XAIChatService(model), + DBModelProvider.GithubModels => new GithubModelsChatService(model), _ => throw new NotSupportedException($"Unknown model provider: {modelProvider}") }; return cs; diff --git a/src/BE/Services/ChatServices/ChatServiceExtensions.cs b/src/BE/Services/ChatServices/ChatServiceExtensions.cs index dc61f33f..165d2a04 100644 --- a/src/BE/Services/ChatServices/ChatServiceExtensions.cs +++ b/src/BE/Services/ChatServices/ChatServiceExtensions.cs @@ -66,10 +66,6 @@ private ChatMessage[] FEProcessMessages(IReadOnlyList messages, Cha } ChatMessage[] filteredMessage = messages.Select(m => FilterVision(Model.ModelReference.AllowVision, m)).ToArray(); - if (Model.ModelReference.AllowVision) - { - options.MaxOutputTokenCount ??= Model.ModelReference.MaxResponseTokens; - } if (!Model.ModelReference.AllowSearch) { options.RemoveAllowSearch(); diff --git a/src/BE/Services/ChatServices/Implementations/Azure/JsonAzureConfig.cs b/src/BE/Services/ChatServices/Implementations/Azure/JsonAzureConfig.cs deleted file mode 100644 index f3d80fb5..00000000 --- a/src/BE/Services/ChatServices/Implementations/Azure/JsonAzureConfig.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace Chats.BE.Services.ChatServices.Implementations.Azure; - -public record JsonAzureApiConfig -{ - [JsonPropertyName("host")] - public required string Host { get; init; } - - [JsonPropertyName("apiKey")] - public required string ApiKey { get; init; } - - public static JsonAzureApiConfig Parse(string json) - { - return JsonSerializer.Deserialize(json)!; - } -} \ No newline at end of file diff --git a/src/BE/Services/ChatServices/Implementations/Azure/JsonAzureModelConfig.cs b/src/BE/Services/ChatServices/Implementations/Azure/JsonAzureModelConfig.cs deleted file mode 100644 index 15f77097..00000000 --- a/src/BE/Services/ChatServices/Implementations/Azure/JsonAzureModelConfig.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Chats.BE.Services.ChatServices.Implementations.Azure; - -public record JsonAzureModelConfig -{ - [JsonPropertyName("prompt")] - public required string Prompt { get; init; } - - [JsonPropertyName("temperature")] - public float? Temperature { get; init; } - - [JsonPropertyName("version")] - public string? Version { get; init; } - - [JsonPropertyName("deploymentName")] - public required string DeploymentName { get; init; } -} \ No newline at end of file diff --git a/src/BE/Services/ChatServices/Implementations/GLM/JsonGLMModelConfig.cs b/src/BE/Services/ChatServices/Implementations/GLM/JsonGLMModelConfig.cs deleted file mode 100644 index 818a9498..00000000 --- a/src/BE/Services/ChatServices/Implementations/GLM/JsonGLMModelConfig.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Chats.BE.Services.ChatServices.Implementations.GLM; - -public record JsonGLMModelConfig -{ - [JsonPropertyName("prompt")] - public required string Prompt { get; init; } - - [JsonPropertyName("temperature")] - public required double Temperature { get; init; } - - [JsonPropertyName("model")] - public required string Model { get; init; } -} diff --git a/src/BE/Services/ChatServices/Implementations/Hunyuan/JsonHunyuanModelConfig.cs b/src/BE/Services/ChatServices/Implementations/Hunyuan/JsonHunyuanModelConfig.cs deleted file mode 100644 index bb9853e5..00000000 --- a/src/BE/Services/ChatServices/Implementations/Hunyuan/JsonHunyuanModelConfig.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Chats.BE.Services.ChatServices.Implementations.Hunyuan; - -public record JsonHunyuanModelConfig -{ - [JsonPropertyName("prompt")] - public required string Prompt { get; init; } - - [JsonPropertyName("temperature")] - public required float? Temperature { get; init; } - - [JsonPropertyName("model")] - public required string Model { get; init; } -} \ No newline at end of file diff --git a/src/BE/Services/ChatServices/Implementations/Kimi/JsonKimiModelConfig.cs b/src/BE/Services/ChatServices/Implementations/Kimi/JsonKimiModelConfig.cs deleted file mode 100644 index 9e3e13df..00000000 --- a/src/BE/Services/ChatServices/Implementations/Kimi/JsonKimiModelConfig.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Chats.BE.Services.ChatServices.Implementations.Kimi; - -public record JsonKimiModelConfig -{ - [JsonPropertyName("prompt")] - public required string Prompt { get; init; } - - [JsonPropertyName("temperature")] - public required float Temperature { get; init; } -} diff --git a/src/BE/Services/ChatServices/Implementations/Azure/AzureChatService.cs b/src/BE/Services/ChatServices/Implementations/OpenAI/AzureChatService.cs similarity index 83% rename from src/BE/Services/ChatServices/Implementations/Azure/AzureChatService.cs rename to src/BE/Services/ChatServices/Implementations/OpenAI/AzureChatService.cs index 027532f6..d9c911d9 100644 --- a/src/BE/Services/ChatServices/Implementations/Azure/AzureChatService.cs +++ b/src/BE/Services/ChatServices/Implementations/OpenAI/AzureChatService.cs @@ -1,11 +1,10 @@ using Azure.AI.OpenAI; using Chats.BE.DB; -using Chats.BE.Services.ChatServices.Implementations.OpenAI; using OpenAI; using OpenAI.Chat; using System.ClientModel; -namespace Chats.BE.Services.ChatServices.Implementations.Azure; +namespace Chats.BE.Services.ChatServices.Implementations.OpenAI; public class AzureChatService(Model model) : OpenAIChatService(model, CreateChatClient(model)) { diff --git a/src/BE/Services/ChatServices/Implementations/DeepSeek/DeepSeekChatService.cs b/src/BE/Services/ChatServices/Implementations/OpenAI/DeepSeekChatService.cs similarity index 51% rename from src/BE/Services/ChatServices/Implementations/DeepSeek/DeepSeekChatService.cs rename to src/BE/Services/ChatServices/Implementations/OpenAI/DeepSeekChatService.cs index e178ebda..893faa92 100644 --- a/src/BE/Services/ChatServices/Implementations/DeepSeek/DeepSeekChatService.cs +++ b/src/BE/Services/ChatServices/Implementations/OpenAI/DeepSeekChatService.cs @@ -1,6 +1,5 @@ using Chats.BE.DB; -using Chats.BE.Services.ChatServices.Implementations.OpenAI; -namespace Chats.BE.Services.ChatServices.Implementations.DeepSeek; +namespace Chats.BE.Services.ChatServices.Implementations.OpenAI; public class DeepSeekChatService(Model model) : OpenAIChatService(model, new Uri("https://api.deepseek.com/v1")); \ No newline at end of file diff --git a/src/BE/Services/ChatServices/Implementations/GLM/GLMChatService.cs b/src/BE/Services/ChatServices/Implementations/OpenAI/GLMChatService.cs similarity index 54% rename from src/BE/Services/ChatServices/Implementations/GLM/GLMChatService.cs rename to src/BE/Services/ChatServices/Implementations/OpenAI/GLMChatService.cs index 088451e0..0e62e4dc 100644 --- a/src/BE/Services/ChatServices/Implementations/GLM/GLMChatService.cs +++ b/src/BE/Services/ChatServices/Implementations/OpenAI/GLMChatService.cs @@ -1,7 +1,6 @@ using Chats.BE.DB; -using Chats.BE.Services.ChatServices.Implementations.OpenAI; -namespace Chats.BE.Services.ChatServices.Implementations.GLM; +namespace Chats.BE.Services.ChatServices.Implementations.OpenAI; public class GLMChatService(Model model) : OpenAIChatService(model, new Uri("https://open.bigmodel.cn/api/paas/v4/")) { diff --git a/src/BE/Services/ChatServices/Implementations/OpenAI/GithubModelsChatService.cs b/src/BE/Services/ChatServices/Implementations/OpenAI/GithubModelsChatService.cs new file mode 100644 index 00000000..6a948c36 --- /dev/null +++ b/src/BE/Services/ChatServices/Implementations/OpenAI/GithubModelsChatService.cs @@ -0,0 +1,5 @@ +using Chats.BE.DB; + +namespace Chats.BE.Services.ChatServices.Implementations.OpenAI; + +public class GithubModelsChatService(Model model) : OpenAIChatService(model, new Uri("https://models.inference.ai.azure.com")); \ No newline at end of file diff --git a/src/BE/Services/ChatServices/Implementations/OpenAI/JsonOpenAIModelConfig.cs b/src/BE/Services/ChatServices/Implementations/OpenAI/JsonOpenAIModelConfig.cs deleted file mode 100644 index 44e4d4a1..00000000 --- a/src/BE/Services/ChatServices/Implementations/OpenAI/JsonOpenAIModelConfig.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Chats.BE.Services.ChatServices.Implementations.OpenAI; - -public record JsonOpenAIModelConfig -{ - [JsonPropertyName("prompt")] - public required string Prompt { get; init; } - - [JsonPropertyName("temperature")] - public float? Temperature { get; init; } - - [JsonPropertyName("model")] - public required string DeploymentName { get; init; } -} \ No newline at end of file diff --git a/src/BE/Services/ChatServices/Implementations/Kimi/KimiChatService.cs b/src/BE/Services/ChatServices/Implementations/OpenAI/KimiChatService.cs similarity index 51% rename from src/BE/Services/ChatServices/Implementations/Kimi/KimiChatService.cs rename to src/BE/Services/ChatServices/Implementations/OpenAI/KimiChatService.cs index c0a6c907..b909ee68 100644 --- a/src/BE/Services/ChatServices/Implementations/Kimi/KimiChatService.cs +++ b/src/BE/Services/ChatServices/Implementations/OpenAI/KimiChatService.cs @@ -1,6 +1,5 @@ using Chats.BE.DB; -using Chats.BE.Services.ChatServices.Implementations.OpenAI; -namespace Chats.BE.Services.ChatServices.Implementations.Kimi; +namespace Chats.BE.Services.ChatServices.Implementations.OpenAI; public class KimiChatService(Model model) : OpenAIChatService(model, new Uri("https://api.moonshot.cn/v1")); \ No newline at end of file diff --git a/src/BE/Services/ChatServices/Implementations/LingYi/LingYiChatService.cs b/src/BE/Services/ChatServices/Implementations/OpenAI/LingYiChatService.cs similarity index 52% rename from src/BE/Services/ChatServices/Implementations/LingYi/LingYiChatService.cs rename to src/BE/Services/ChatServices/Implementations/OpenAI/LingYiChatService.cs index d777fd27..7380a7fd 100644 --- a/src/BE/Services/ChatServices/Implementations/LingYi/LingYiChatService.cs +++ b/src/BE/Services/ChatServices/Implementations/OpenAI/LingYiChatService.cs @@ -1,6 +1,5 @@ using Chats.BE.DB; -using Chats.BE.Services.ChatServices.Implementations.OpenAI; -namespace Chats.BE.Services.ChatServices.Implementations.LingYi; +namespace Chats.BE.Services.ChatServices.Implementations.OpenAI; public class LingYiChatService(Model model) : OpenAIChatService(model, new Uri("https://api.lingyiwanwu.com/v1")); diff --git a/src/BE/Services/ChatServices/Implementations/OpenAI/XAIChatService.cs b/src/BE/Services/ChatServices/Implementations/OpenAI/XAIChatService.cs new file mode 100644 index 00000000..338018ab --- /dev/null +++ b/src/BE/Services/ChatServices/Implementations/OpenAI/XAIChatService.cs @@ -0,0 +1,5 @@ +using Chats.BE.DB; + +namespace Chats.BE.Services.ChatServices.Implementations.OpenAI; + +public class XAIChatService(Model model) : OpenAIChatService(model, new Uri("https://api.x.ai/v1")); \ No newline at end of file From 16330759d625e73020d0fbae0adc13e7a4f5eecc Mon Sep 17 00:00:00 2001 From: sdcb Date: Wed, 11 Dec 2024 19:01:08 +0800 Subject: [PATCH 21/22] try implement sparkdesk --- src/BE/Chats.BE.csproj | 8 +++--- src/BE/DB/Init/BasicData.cs | 28 +++++++++---------- src/BE/Services/ChatServices/ChatFactory.cs | 2 +- .../ChatServices/ChatServiceExtensions.cs | 4 +-- .../OpenAI/SparkDeskChatService.cs | 18 ++++++++++++ .../2024/20241211-xai-githubmodels.sql | 1 + 6 files changed, 40 insertions(+), 21 deletions(-) create mode 100644 src/BE/Services/ChatServices/Implementations/OpenAI/SparkDeskChatService.cs diff --git a/src/BE/Chats.BE.csproj b/src/BE/Chats.BE.csproj index 22774063..97cb4b4f 100644 --- a/src/BE/Chats.BE.csproj +++ b/src/BE/Chats.BE.csproj @@ -9,7 +9,7 @@ - + @@ -26,12 +26,12 @@ - + - - + + diff --git a/src/BE/DB/Init/BasicData.cs b/src/BE/DB/Init/BasicData.cs index 34f1388a..57fdb52d 100644 --- a/src/BE/DB/Init/BasicData.cs +++ b/src/BE/DB/Init/BasicData.cs @@ -247,22 +247,22 @@ private static void InsertModelReferences(ChatsDB db) private static void InsertModelProviders(ChatsDB db) { - // Generated from data, hash: 918110f3f52c51c8fdebe00ca4e2e9dac5d2f2e7f892ed5c7197be6a7fbcfbdf + // Generated from data, hash: 615290985867eb3467e7889a31c4edf5dcdbd113930d67df8e19b6cd27c955ca db.ModelProviders.AddRange( [ - new(){ Id=0, Name="Test", InitialHost=null, InitialSecret=null, }, - new(){ Id=1, Name="Azure OpenAI", InitialHost="https://.openai.azure.com/", InitialSecret="", }, - new(){ Id=2, Name="Tencent Hunyuan", InitialHost="hunyuan.tencentcloudapi.com", InitialSecret="""{"secretId":"", "secretKey":""}""", }, - new(){ Id=3, Name="01.ai", InitialHost=null, InitialSecret="", }, - new(){ Id=4, Name="Moonshot", InitialHost=null, InitialSecret="", }, - new(){ Id=5, Name="OpenAI", InitialHost="https://api.openai.com/v1", InitialSecret="", }, - new(){ Id=6, Name="Wenxin Qianfan", InitialHost=null, InitialSecret="""{"apiKey":"", "secret":""}""", }, - new(){ Id=7, Name="DashScope", InitialHost=null, InitialSecret="", }, - new(){ Id=8, Name="Xunfei SparkDesk", InitialHost=null, InitialSecret="""{"appId": "", "apiKey":"", "secret":""}""", }, - new(){ Id=9, Name="Zhipu AI", InitialHost=null, InitialSecret="", }, - new(){ Id=10, Name="DeepSeek", InitialHost=null, InitialSecret="", }, - new(){ Id=11, Name="x.ai", InitialHost=null, InitialSecret="xai-yourkey", }, - new(){ Id=12, Name="Github Models", InitialHost=null, InitialSecret="ghp_yourkey", } + new(){ Id=0, Name="Test", InitialHost=null, InitialSecret=null, }, + new(){ Id=1, Name="Azure OpenAI", InitialHost="https://.openai.azure.com/", InitialSecret="", }, + new(){ Id=2, Name="Tencent Hunyuan", InitialHost="hunyuan.tencentcloudapi.com", InitialSecret="""{"secretId":"", "secretKey":""}""", }, + new(){ Id=3, Name="01.ai", InitialHost=null, InitialSecret="", }, + new(){ Id=4, Name="Moonshot", InitialHost=null, InitialSecret="", }, + new(){ Id=5, Name="OpenAI", InitialHost="https://api.openai.com/v1", InitialSecret="", }, + new(){ Id=6, Name="Wenxin Qianfan", InitialHost=null, InitialSecret="""{"apiKey":"", "secret":""}""", }, + new(){ Id=7, Name="DashScope", InitialHost=null, InitialSecret="", }, + new(){ Id=8, Name="Xunfei SparkDesk", InitialHost=null, InitialSecret="", }, + new(){ Id=9, Name="Zhipu AI", InitialHost=null, InitialSecret="", }, + new(){ Id=10, Name="DeepSeek", InitialHost=null, InitialSecret="", }, + new(){ Id=11, Name="x.ai", InitialHost=null, InitialSecret="xai-yourkey", }, + new(){ Id=12, Name="Github Models", InitialHost=null, InitialSecret="ghp_yourkey", } ]); } }; \ No newline at end of file diff --git a/src/BE/Services/ChatServices/ChatFactory.cs b/src/BE/Services/ChatServices/ChatFactory.cs index d4f2d4bd..a08ab5e7 100644 --- a/src/BE/Services/ChatServices/ChatFactory.cs +++ b/src/BE/Services/ChatServices/ChatFactory.cs @@ -24,7 +24,7 @@ public ChatService CreateConversationService(Model model) DBModelProvider.ZhiPuAI => new GLMChatService(model), DBModelProvider.Moonshot => new KimiChatService(model), DBModelProvider.HunYuan => new HunyuanChatService(model), - DBModelProvider.Sparkdesk => throw new NotImplementedException("Spark model is not implemented"), + DBModelProvider.Sparkdesk => new SparkDeskChatService(model), DBModelProvider.LingYi => new LingYiChatService(model), DBModelProvider.DeepSeek => new DeepSeekChatService(model), DBModelProvider.xAI => new XAIChatService(model), diff --git a/src/BE/Services/ChatServices/ChatServiceExtensions.cs b/src/BE/Services/ChatServices/ChatServiceExtensions.cs index 165d2a04..5dcc9c11 100644 --- a/src/BE/Services/ChatServices/ChatServiceExtensions.cs +++ b/src/BE/Services/ChatServices/ChatServiceExtensions.cs @@ -9,7 +9,7 @@ public abstract partial class ChatService { public async IAsyncEnumerable ChatStreamedFEProcessed(IReadOnlyList messages, ChatCompletionOptions options, [EnumeratorCancellation] CancellationToken cancellationToken) { - ChatMessage[] filteredMessage = FEProcessMessages(messages, options); + ChatMessage[] filteredMessage = FEPreprocess(messages, options); await foreach (InternalChatSegment seg in ChatStreamedSimulated(suggestedStreaming: true, filteredMessage, options, cancellationToken)) { @@ -48,7 +48,7 @@ public async IAsyncEnumerable ChatStreamedSimulated(bool su } } - private ChatMessage[] FEProcessMessages(IReadOnlyList messages, ChatCompletionOptions options) + protected virtual ChatMessage[] FEPreprocess(IReadOnlyList messages, ChatCompletionOptions options) { if (!Model.ModelReference.AllowSystemPrompt) { diff --git a/src/BE/Services/ChatServices/Implementations/OpenAI/SparkDeskChatService.cs b/src/BE/Services/ChatServices/Implementations/OpenAI/SparkDeskChatService.cs new file mode 100644 index 00000000..99167ed5 --- /dev/null +++ b/src/BE/Services/ChatServices/Implementations/OpenAI/SparkDeskChatService.cs @@ -0,0 +1,18 @@ +using Chats.BE.DB; +using OpenAI.Chat; + +namespace Chats.BE.Services.ChatServices.Implementations.OpenAI; + +public class SparkDeskChatService(Model model) : OpenAIChatService(model, new Uri("https://spark-api-open.xf-yun.com/v1")) +{ + protected override ChatMessage[] FEPreprocess(IReadOnlyList messages, ChatCompletionOptions options) + { + ChatMessage[] toReturn = base.FEPreprocess(messages, options); + // spark desk enable search is set via tool https://www.xfyun.cn/doc/spark/HTTP%E8%B0%83%E7%94%A8%E6%96%87%E6%A1%A3.html#_3-%E8%AF%B7%E6%B1%82%E8%AF%B4%E6%98%8E + // however unfortunately the tool is not available in OpenAI SDK + // otherwise, the code should be: + // bool enableSearch = options.IsSearchEnabled(); + // options.Tools.Add(MakeSparkDeskSearchTool(enableSearch)); + return toReturn; + } +} \ No newline at end of file diff --git a/src/scripts/db-migration/2024/20241211-xai-githubmodels.sql b/src/scripts/db-migration/2024/20241211-xai-githubmodels.sql index b40fc861..f9e00fb9 100644 --- a/src/scripts/db-migration/2024/20241211-xai-githubmodels.sql +++ b/src/scripts/db-migration/2024/20241211-xai-githubmodels.sql @@ -1,5 +1,6 @@ insert into ModelProvider values(11, 'x.ai', NULL, 'xai-yourkey'); insert into ModelProvider values(12, 'Github Models', NULL, 'ghp_yourkey'); +update ModelProvider set InitialSecret = '' where id = 8; insert into ModelReference values (1100, 11, 'grok-beta', 'grok', 0, 0, 2, 0, 0, 1, 1, 131072, 4096, NULL, 5, 15, 'USD'), From 56532d4f6055fa9bc6d234abd75b2da7efd5892e Mon Sep 17 00:00:00 2001 From: sdcb Date: Wed, 11 Dec 2024 19:15:46 +0800 Subject: [PATCH 22/22] add o1-preview/o1-mini for github models --- src/BE/DB/Init/BasicData.cs | 10 +++++----- .../OpenAI/GithubModelsChatService.cs | 14 ++++++++++++- .../2024/20241211-xai-githubmodels.sql | 20 ++++++++++--------- 3 files changed, 29 insertions(+), 15 deletions(-) diff --git a/src/BE/DB/Init/BasicData.cs b/src/BE/DB/Init/BasicData.cs index 57fdb52d..a93ec198 100644 --- a/src/BE/DB/Init/BasicData.cs +++ b/src/BE/DB/Init/BasicData.cs @@ -107,7 +107,7 @@ private static void InsertTransactionTypes(ChatsDB db) private static void InsertModelReferences(ChatsDB db) { - // Generated from data, hash: 069616f98bbd2020a67c0adc8c5be88728df82ce72f3a3a2245141493c7bdbad + // Generated from data, hash: 50473f0ad8469aee50b0d5d7ed3f13df8fe5cfd80a3c1f1a7aea825865492349 db.ModelReferences.AddRange( [ new(){ Id=0, ProviderId=0, Name="Test", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=2048, MaxResponseTokens=2048, TokenizerId=1, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, @@ -233,10 +233,10 @@ private static void InsertModelReferences(ChatsDB db) new(){ Id=1206, ProviderId=12, Name="Meta-Llama-3.1-405B-Instruct", ShortName="LLaMA", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=5.00000M, OutputTokenPrice1M=15.00000M, CurrencyCode="USD", }, new(){ Id=1207, ProviderId=12, Name="Meta-Llama-3.1-70B-Instruct", ShortName="LLaMA", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=2.50000M, OutputTokenPrice1M=5.00000M, CurrencyCode="USD", }, new(){ Id=1208, ProviderId=12, Name="Meta-Llama-3.1-8B-Instruct", ShortName="LLaMA", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=1.00000M, OutputTokenPrice1M=2.00000M, CurrencyCode="USD", }, - new(){ Id=1209, ProviderId=12, Name="Mistral-large", ShortName="Mistral", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=5.00000M, OutputTokenPrice1M=15.00000M, CurrencyCode="USD", }, - new(){ Id=1210, ProviderId=12, Name="Mistral-large-2407", ShortName="Mistral", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=5.00000M, OutputTokenPrice1M=15.00000M, CurrencyCode="USD", }, - new(){ Id=1211, ProviderId=12, Name="Mistral-Nemo", ShortName="Mistral", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=1.00000M, OutputTokenPrice1M=2.00000M, CurrencyCode="USD", }, - new(){ Id=1212, ProviderId=12, Name="Mistral-small", ShortName="Mistral", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=1.00000M, OutputTokenPrice1M=2.00000M, CurrencyCode="USD", }, + new(){ Id=1209, ProviderId=12, Name="Mistral-large", ShortName="Mistral", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=false, ContextWindow=32768, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=5.00000M, OutputTokenPrice1M=15.00000M, CurrencyCode="USD", }, + new(){ Id=1210, ProviderId=12, Name="Mistral-large-2407", ShortName="Mistral", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=false, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=5.00000M, OutputTokenPrice1M=15.00000M, CurrencyCode="USD", }, + new(){ Id=1211, ProviderId=12, Name="Mistral-Nemo", ShortName="Mistral", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=false, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=1.00000M, OutputTokenPrice1M=2.00000M, CurrencyCode="USD", }, + new(){ Id=1212, ProviderId=12, Name="Mistral-small", ShortName="Mistral", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=false, ContextWindow=32768, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=1.00000M, OutputTokenPrice1M=2.00000M, CurrencyCode="USD", }, new(){ Id=1213, ProviderId=12, Name="gpt-4o", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=4096, TokenizerId=2, InputTokenPrice1M=5.00000M, OutputTokenPrice1M=15.00000M, CurrencyCode="USD", }, new(){ Id=1214, ProviderId=12, Name="gpt-4o-mini", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=4096, TokenizerId=2, InputTokenPrice1M=1.00000M, OutputTokenPrice1M=2.00000M, CurrencyCode="USD", }, new(){ Id=1215, ProviderId=12, Name="Phi-3.5-MoE-instruct", ShortName="Phi-3.5", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=1.00000M, OutputTokenPrice1M=2.00000M, CurrencyCode="USD", }, diff --git a/src/BE/Services/ChatServices/Implementations/OpenAI/GithubModelsChatService.cs b/src/BE/Services/ChatServices/Implementations/OpenAI/GithubModelsChatService.cs index 6a948c36..0b154063 100644 --- a/src/BE/Services/ChatServices/Implementations/OpenAI/GithubModelsChatService.cs +++ b/src/BE/Services/ChatServices/Implementations/OpenAI/GithubModelsChatService.cs @@ -1,5 +1,17 @@ using Chats.BE.DB; +using OpenAI.Chat; namespace Chats.BE.Services.ChatServices.Implementations.OpenAI; -public class GithubModelsChatService(Model model) : OpenAIChatService(model, new Uri("https://models.inference.ai.azure.com")); \ No newline at end of file +public class GithubModelsChatService(Model model) : OpenAIChatService(model, new Uri("https://models.inference.ai.azure.com")) +{ + protected override ChatMessage[] FEPreprocess(IReadOnlyList messages, ChatCompletionOptions options) + { + if (Model.ModelReference.ShortName == "Mistral") + { + // Mistral model does not support end-user ID + options.EndUserId = null; + } + return base.FEPreprocess(messages, options); + } +} \ No newline at end of file diff --git a/src/scripts/db-migration/2024/20241211-xai-githubmodels.sql b/src/scripts/db-migration/2024/20241211-xai-githubmodels.sql index f9e00fb9..77df5dc4 100644 --- a/src/scripts/db-migration/2024/20241211-xai-githubmodels.sql +++ b/src/scripts/db-migration/2024/20241211-xai-githubmodels.sql @@ -14,12 +14,14 @@ insert into ModelReference values (1206, 12, 'Meta-Llama-3.1-405B-Instruct', 'LLaMA', 0, 0, 2, 0, 0, 1, 1, 131072, 4096, NULL, 5, 15, 'USD'), (1207, 12, 'Meta-Llama-3.1-70B-Instruct', 'LLaMA', 0, 0, 2, 0, 0, 1, 1, 131072, 4096, NULL, 2.5, 5, 'USD'), (1208, 12, 'Meta-Llama-3.1-8B-Instruct', 'LLaMA', 0, 0, 2, 0, 0, 1, 1, 131072, 4096, NULL, 1, 2, 'USD'), -(1209, 12, 'Mistral-large', 'Mistral', 1, 0, 2, 0, 0, 1, 1, 32768, 4096, NULL, 5, 15, 'USD'), -(1210, 12, 'Mistral-large-2407', 'Mistral', 0, 0, 2, 0, 0, 1, 1, 131072, 4096, NULL, 5, 15, 'USD'), -(1211, 12, 'Mistral-Nemo', 'Mistral', 0, 0, 2, 0, 0, 1, 1, 131072, 4096, NULL, 1, 2, 'USD'), -(1212, 12, 'Mistral-small', 'Mistral', 1, 0, 2, 0, 0, 1, 1, 32768, 4096, NULL, 1, 2, 'USD'), -(1213, 12, 'gpt-4o', NULL, 0, 0, 2, 0, 1, 1, 1, 128000, 4096, 2, 5, 15, 'USD'), -(1214, 12, 'gpt-4o-mini', NULL, 0, 0, 2, 0, 1, 1, 1, 128000, 4096, 2, 1, 2, 'USD'), -(1215, 12, 'Phi-3.5-MoE-instruct', 'Phi-3.5', 0, 0, 2, 0, 0, 1, 1, 131072, 4096, NULL, 1, 2, 'USD'), -(1216, 12, 'Phi-3.5-mini-instruct', 'Phi-3.5', 0, 0, 2, 0, 0, 1, 1, 131072, 4096, NULL, 0.5, 1, 'USD'), -(1217, 12, 'Phi-3.5-vision-instruct', 'Phi-3.5', 0, 0, 2, 0, 1, 1, 1, 131072, 4096, NULL, 1, 2, 'USD'); +(1209, 12, 'Mistral-large', 'Mistral', 1, 0, 2, 0, 0, 1, 0, 32768, 4096, NULL, 5, 15, 'USD'), +(1210, 12, 'Mistral-large-2407', 'Mistral', 0, 0, 2, 0, 0, 1, 0, 131072, 4096, NULL, 5, 15, 'USD'), +(1211, 12, 'Mistral-Nemo', 'Mistral', 0, 0, 2, 0, 0, 1, 0, 131072, 4096, NULL, 1, 2, 'USD'), +(1212, 12, 'Mistral-small', 'Mistral', 1, 0, 2, 0, 0, 1, 0, 32768, 4096, NULL, 1, 2, 'USD'), +(1213, 12, 'gpt-4o', NULL, 0, 0, 2, 0, 1, 1, 1, 128000, 4096, 2, 5, 15, 'USD'), +(1214, 12, 'gpt-4o-mini', NULL, 0, 0, 2, 0, 1, 1, 1, 128000, 4096, 2, 1, 2, 'USD'), +(1215, 12, 'Phi-3.5-MoE-instruct', 'Phi-3.5', 0, 0, 2, 0, 0, 1, 1, 131072, 4096, NULL, 1, 2, 'USD'), +(1216, 12, 'Phi-3.5-mini-instruct', 'Phi-3.5', 0, 0, 2, 0, 0, 1, 1, 131072, 4096, NULL, 0.5, 1, 'USD'), +(1217, 12, 'Phi-3.5-vision-instruct', 'Phi-3.5', 0, 0, 2, 0, 1, 1, 1, 131072, 4096, NULL, 1, 2, 'USD'), +(1218, 12, 'o1-preview', NULL, 0, 1, 1, 0, 0, 0, 0, 128000, 32768, NULL, 15, 60, 'USD'), +(1219, 12, 'o1-mini', NULL, 0, 1, 1, 0, 0, 0, 0, 128000, 65536, NULL, 3, 12, 'USD');