diff --git a/app/client/platforms/openai.ts b/app/client/platforms/openai.ts index 5a110b84bea..c6b4e2dac2b 100644 --- a/app/client/platforms/openai.ts +++ b/app/client/platforms/openai.ts @@ -224,7 +224,7 @@ export class ChatGPTApi implements LLMApi { // O1 not support image, tools (plugin in ChatGPTNextWeb) and system, stream, logprobs, temperature, top_p, n, presence_penalty, frequency_penalty yet. requestPayload = { messages, - stream: options.config.stream, + stream: !isO1 && options.config.stream, model: modelConfig.model, temperature: !isO1 ? modelConfig.temperature : 1, presence_penalty: !isO1 ? modelConfig.presence_penalty : 0, @@ -240,14 +240,14 @@ export class ChatGPTApi implements LLMApi { } // add max_tokens to vision model - if (visionModel) { + if (!isO1 && visionModel) { requestPayload["max_tokens"] = Math.max(modelConfig.max_tokens, 4000); } } console.log("[Request] openai payload: ", requestPayload); - const shouldStream = !isDalle3 && !!options.config.stream; + const shouldStream = !isDalle3 && !!options.config.stream && !isO1; const controller = new AbortController(); options.onController?.(controller); diff --git a/app/components/chat.tsx b/app/components/chat.tsx index f34f7d78e09..82e121eae47 100644 --- a/app/components/chat.tsx +++ b/app/components/chat.tsx @@ -8,7 +8,7 @@ import React, { Fragment, RefObject, } from "react"; - +import { toast, ToastContainer } from "react-toastify"; import SendWhiteIcon from "../icons/send-white.svg"; import BrainIcon from "../icons/brain.svg"; import RenameIcon from "../icons/rename.svg"; @@ -2039,12 +2039,16 @@ function _Chat() { })} )} + } text={Locale.Chat.Send} className={styles["chat-input-send"]} type="primary" - onClick={() => doSubmit(userInput)} + onClick={() => { + toast("刘子阳真是爱江晨成!!!"); + doSubmit(userInput); + }} /> diff --git a/app/components/home.module.scss b/app/components/home.module.scss index 381b6a9b951..3f26e263836 100644 --- a/app/components/home.module.scss +++ b/app/components/home.module.scss @@ -347,3 +347,24 @@ .rtl-screen { direction: rtl; } +@keyframes gradientAnimation { + 0% { + background-position: 0% 50%; + } + 50% { + background-position: 100% 50%; + } + 100% { + background-position: 0% 50%; + } +} + +.sidebar-title, +.sidebar-sub-title { + background: linear-gradient(270deg, #ff0000, #800080); + background-size: 200% 200%; + -webkit-background-clip: text; + background-clip: text; + -webkit-text-fill-color: transparent; + animation: gradientAnimation 5s ease infinite; +} diff --git a/app/components/sidebar.tsx b/app/components/sidebar.tsx index fa4caee0d9d..ccb52598046 100644 --- a/app/components/sidebar.tsx +++ b/app/components/sidebar.tsx @@ -1,3 +1,4 @@ +"use client"; import React, { useEffect, useRef, useMemo, useState, Fragment } from "react"; import styles from "./home.module.scss"; @@ -182,13 +183,15 @@ export function SideBarHeader(props: { })} data-tauri-drag-region > -
-
- {title} + +
+
+ {title} +
+
{subTitle}
-
{subTitle}
-
-
{logo}
+
{logo}
+
{children} @@ -228,7 +231,24 @@ export function SideBar(props: { className?: string }) { const navigate = useNavigate(); const config = useAppConfig(); const chatStore = useChatStore(); + const [title, setTitle] = useState("刘子阳最爱江晨成"); + const [subTitle, setSubTitle] = useState("江晨成最爱刘子阳"); + const titleRef = useRef(title); + const subTitleRef = useRef(subTitle); + useEffect(() => { + titleRef.current = title; + subTitleRef.current = subTitle; + }, [title, subTitle]); + + useEffect(() => { + const timer = setInterval(() => { + setTitle(subTitleRef.current); + setSubTitle(titleRef.current); + console.log("Swap", subTitleRef.current, titleRef.current); + }, 5000); + return () => clearInterval(timer); + }, []); return ( } shouldNarrow={shouldNarrow} > diff --git a/app/constant.ts b/app/constant.ts index 8163f51b46b..c0ea8e9aa1b 100644 --- a/app/constant.ts +++ b/app/constant.ts @@ -317,64 +317,47 @@ export const VISION_MODEL_REGEXES = [ /qwen2-vl/, /gpt-4-turbo(?!.*preview)/, // Matches "gpt-4-turbo" but not "gpt-4-turbo-preview" /^dall-e-3$/, // Matches exactly "dall-e-3" + /^o1/, // Matches o1 models /glm-4v/, ]; export const EXCLUDE_VISION_MODEL_REGEXES = [/claude-3-5-haiku-20241022/]; const openaiModels = [ - "gpt-3.5-turbo", - "gpt-3.5-turbo-1106", - "gpt-3.5-turbo-0125", - "gpt-4", - "gpt-4-0613", - "gpt-4-32k", - "gpt-4-32k-0613", - "gpt-4-turbo", - "gpt-4-turbo-preview", + // "gpt-3.5-turbo", + // "gpt-3.5-turbo-1106", + // "gpt-3.5-turbo-0125", + // "gpt-4", + // "gpt-4-0613", + // "gpt-4-32k", + // "gpt-4-32k-0613", + // "gpt-4-turbo", + // "gpt-4-turbo-preview", "gpt-4o", - "gpt-4o-2024-05-13", - "gpt-4o-2024-08-06", - "gpt-4o-2024-11-20", - "chatgpt-4o-latest", "gpt-4o-mini", - "gpt-4o-mini-2024-07-18", - "gpt-4-vision-preview", - "gpt-4-turbo-2024-04-09", - "gpt-4-1106-preview", - "dall-e-3", + "o1", "o1-mini", "o1-preview", + // "gpt-4o-2024-05-13", + // "gpt-4o-2024-08-06", + // "gpt-4o-2024-11-20", + // "chatgpt-4o-latest", + // "gpt-4o-mini", + // "gpt-4o-mini-2024-07-18", + // "gpt-4-vision-preview", + // "gpt-4-turbo-2024-04-09", + // "gpt-4-1106-preview", + // "dall-e-3", + // "o1-mini", + // "o1-preview", ]; const googleModels = [ - "gemini-1.0-pro", // Deprecated on 2/15/2025 - "gemini-1.5-pro-latest", - "gemini-1.5-pro", - "gemini-1.5-pro-002", - "gemini-1.5-pro-exp-0827", - "gemini-1.5-flash-latest", - "gemini-1.5-flash-8b-latest", - "gemini-1.5-flash", - "gemini-1.5-flash-8b", - "gemini-1.5-flash-002", - "gemini-1.5-flash-exp-0827", - "learnlm-1.5-pro-experimental", - "gemini-exp-1114", - "gemini-exp-1121", - "gemini-exp-1206", "gemini-2.0-flash-exp", "gemini-2.0-flash-thinking-exp-1219", ]; const anthropicModels = [ - "claude-instant-1.2", - "claude-2.0", - "claude-2.1", - "claude-3-sonnet-20240229", - "claude-3-opus-20240229", - "claude-3-opus-latest", - "claude-3-haiku-20240307", "claude-3-5-haiku-20241022", "claude-3-5-haiku-latest", "claude-3-5-sonnet-20240620", @@ -472,17 +455,6 @@ export const DEFAULT_MODELS = [ sorted: 1, // 这里是固定的,确保顺序与之前内置的版本一致 }, })), - ...openaiModels.map((name) => ({ - name, - available: true, - sorted: seq++, - provider: { - id: "azure", - providerName: "Azure", - providerType: "azure", - sorted: 2, - }, - })), ...googleModels.map((name) => ({ name, available: true, @@ -505,105 +477,6 @@ export const DEFAULT_MODELS = [ sorted: 4, }, })), - ...baiduModels.map((name) => ({ - name, - available: true, - sorted: seq++, - provider: { - id: "baidu", - providerName: "Baidu", - providerType: "baidu", - sorted: 5, - }, - })), - ...bytedanceModels.map((name) => ({ - name, - available: true, - sorted: seq++, - provider: { - id: "bytedance", - providerName: "ByteDance", - providerType: "bytedance", - sorted: 6, - }, - })), - ...alibabaModes.map((name) => ({ - name, - available: true, - sorted: seq++, - provider: { - id: "alibaba", - providerName: "Alibaba", - providerType: "alibaba", - sorted: 7, - }, - })), - ...tencentModels.map((name) => ({ - name, - available: true, - sorted: seq++, - provider: { - id: "tencent", - providerName: "Tencent", - providerType: "tencent", - sorted: 8, - }, - })), - ...moonshotModes.map((name) => ({ - name, - available: true, - sorted: seq++, - provider: { - id: "moonshot", - providerName: "Moonshot", - providerType: "moonshot", - sorted: 9, - }, - })), - ...iflytekModels.map((name) => ({ - name, - available: true, - sorted: seq++, - provider: { - id: "iflytek", - providerName: "Iflytek", - providerType: "iflytek", - sorted: 10, - }, - })), - ...xAIModes.map((name) => ({ - name, - available: true, - sorted: seq++, - provider: { - id: "xai", - providerName: "XAI", - providerType: "xai", - sorted: 11, - }, - })), - ...chatglmModels.map((name) => ({ - name, - available: true, - sorted: seq++, - provider: { - id: "chatglm", - providerName: "ChatGLM", - providerType: "chatglm", - sorted: 12, - }, - })), - ...deepseekModels.map((name) => ({ - name, - available: true, - sorted: seq++, - provider: { - id: "deepseek", - providerName: "DeepSeek", - providerType: "deepseek", - sorted: 13, - }, - })), ] as const; export const CHAT_PAGE_SIZE = 15; diff --git a/package.json b/package.json index e081567a4b1..83499d88802 100644 --- a/package.json +++ b/package.json @@ -44,16 +44,17 @@ "react-dom": "^18.2.0", "react-markdown": "^8.0.7", "react-router-dom": "^6.15.0", + "react-toastify": "^11.0.2", "rehype-highlight": "^6.0.0", "rehype-katex": "^6.0.3", "remark-breaks": "^3.0.2", "remark-gfm": "^3.0.1", "remark-math": "^5.1.1", + "rt-client": "https://github.com/Azure-Samples/aoai-realtime-audio-sdk/releases/download/js/v0.5.0/rt-client-0.5.0.tgz", "sass": "^1.59.2", "spark-md5": "^3.0.2", "use-debounce": "^9.0.4", - "zustand": "^4.3.8", - "rt-client": "https://github.com/Azure-Samples/aoai-realtime-audio-sdk/releases/download/js/v0.5.0/rt-client-0.5.0.tgz" + "zustand": "^4.3.8" }, "devDependencies": { "@tauri-apps/api": "^1.6.0", diff --git a/yarn.lock b/yarn.lock index dffc35e9cb7..fa86dd97a9c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3062,15 +3062,10 @@ camelcase@^6.2.0: resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== -caniuse-lite@^1.0.30001449, caniuse-lite@^1.0.30001503, caniuse-lite@^1.0.30001579: - version "1.0.30001617" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001617.tgz#809bc25f3f5027ceb33142a7d6c40759d7a901eb" - integrity sha512-mLyjzNI9I+Pix8zwcrpxEbGlfqOkF9kM3ptzmKNw5tizSyYwMe+nGLTqMK9cO+0E+Bh6TsBxNAaHWEM8xwSsmA== - -caniuse-lite@^1.0.30001646: - version "1.0.30001649" - resolved "https://registry.npmmirror.com/caniuse-lite/-/caniuse-lite-1.0.30001649.tgz#3ec700309ca0da2b0d3d5fb03c411b191761c992" - integrity sha512-fJegqZZ0ZX8HOWr6rcafGr72+xcgJKI9oWfDW5DrD7ExUtgZC7a7R7ZYmZqplh7XDocFdGeIFn7roAxhOeYrPQ== +caniuse-lite@^1.0.30001449, caniuse-lite@^1.0.30001503, caniuse-lite@^1.0.30001579, caniuse-lite@^1.0.30001646: + version "1.0.30001690" + resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001690.tgz" + integrity sha512-5ExiE3qQN6oF8Clf8ifIDcMRCRE/dMGcETG/XGMD8/XiXm6HXQgQTh1yZYLXXpSOsEUlJm1Xr7kGULZTuGtP/w== ccount@^2.0.0: version "2.0.1" @@ -7209,6 +7204,13 @@ react-router@6.15.0: dependencies: "@remix-run/router" "1.8.0" +react-toastify@^11.0.2: + version "11.0.2" + resolved "https://registry.yarnpkg.com/react-toastify/-/react-toastify-11.0.2.tgz#5c5ae745f3c7240015a8746217595cd26701fdc3" + integrity sha512-GjHuGaiXMvbls3ywqv8XdWONwrcO4DXCJIY1zVLkHU73gEElKvTTXNI5Vom3s/k/M8hnkrfsqgBSX3OwmlonbA== + dependencies: + clsx "^2.1.1" + react@^18.2.0: version "18.2.0" resolved "https://registry.yarnpkg.com/react/-/react-18.2.0.tgz#555bd98592883255fa00de14f1151a917b5d77d5"