diff --git a/.github/workflows/dockerToHub.yml b/.github/workflows/dockerToHub.yml index 7d689b86d..1e3d40d41 100644 --- a/.github/workflows/dockerToHub.yml +++ b/.github/workflows/dockerToHub.yml @@ -1,9 +1,9 @@ -name: PRO DEPLOY +name: BUILD DOCKER IMAGE on: workflow_dispatch: - push: - branches: - - main +# push: +# branches: +# - main # paths: # - 'app/**' # - 'public/**' diff --git a/Dockerfile b/Dockerfile index a3408e8ad..187226af7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM sijinhui/chatgpt-next-web:buildcache as deps +FROM sijinhui/chatgpt-next-web:buildcache AS deps WORKDIR /app diff --git a/README.md b/README.md index c9f195771..da1adb6a5 100644 --- a/README.md +++ b/README.md @@ -91,7 +91,8 @@ For enterprise inquiries, please contact: **business@nextchat.dev** - [x] Artifacts: Easily preview, copy and share generated content/webpages through a separate window [#5092](https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web/pull/5092) - [x] Plugins: support artifacts, network search, calculator, any other apis etc. [#165](https://github.com/Yidadaa/ChatGPT-Next-Web/issues/165) - [x] artifacts - - [ ] network search, network search, calculator, any other apis etc. [#165](https://github.com/Yidadaa/ChatGPT-Next-Web/issues/165) + - [ ] network search, calculator, any other apis etc. [#165](https://github.com/Yidadaa/ChatGPT-Next-Web/issues/165) +- [ ] local knowledge base ## What's New @@ -128,6 +129,7 @@ For enterprise inquiries, please contact: **business@nextchat.dev** - [x] 插件机制,支持 artifacts,联网搜索、计算器、调用其他平台 api [#165](https://github.com/Yidadaa/ChatGPT-Next-Web/issues/165) - [x] artifacts - [ ] 支持联网搜索、计算器、调用其他平台 api [#165](https://github.com/Yidadaa/ChatGPT-Next-Web/issues/165) + - [ ] 本地知识库 ## 最新动态 diff --git a/app/components/chat.module.scss b/app/components/chat.module.scss index fa932bc3f..286b9a286 100644 --- a/app/components/chat.module.scss +++ b/app/components/chat.module.scss @@ -356,6 +356,12 @@ display: flex; flex-wrap: nowrap; } + + .chat-model-name { + font-size: 12px; + color: var(--black); + margin-left: 6px; + } } .chat-message-container { diff --git a/app/components/chat.tsx b/app/components/chat.tsx index b508a09d4..183e37c76 100644 --- a/app/components/chat.tsx +++ b/app/components/chat.tsx @@ -1623,6 +1623,11 @@ function _Chat() { )} + {!isUser && ( +
+ {message.model} +
+ )}
{isContext diff --git a/app/components/markdown.tsx b/app/components/markdown.tsx index 9929342a1..03da5b47f 100644 --- a/app/components/markdown.tsx +++ b/app/components/markdown.tsx @@ -156,6 +156,46 @@ export function PreCode(props: { children: any }) { ); } +function CustomCode(props: { children: any }) { + const ref = useRef(null); + const [collapsed, setCollapsed] = useState(true); + const [showToggle, setShowToggle] = useState(false); + + useEffect(() => { + if (ref.current) { + const codeHeight = ref.current.scrollHeight; + setShowToggle(codeHeight > 400); + ref.current.scrollTop = ref.current.scrollHeight; + } + }, [props.children]); + + const toggleCollapsed = () => { + setCollapsed((collapsed) => !collapsed); + }; + return ( + <> + + {props.children} + {showToggle && collapsed && ( +
+ +
+ )} +
+ + ); +} + function escapeDollarNumber(text: string) { let escapedText = ""; @@ -211,6 +251,7 @@ function _MarkDownContent(props: { content: string }) { ]} components={{ pre: PreCode as any, + code: CustomCode as any, p: (pProps) =>

, a: (aProps) => { const href = aProps.href || ""; diff --git a/app/config/server.ts b/app/config/server.ts index 0daaa8c3a..098e4a9aa 100644 --- a/app/config/server.ts +++ b/app/config/server.ts @@ -1,5 +1,5 @@ import md5 from "spark-md5"; -import { DEFAULT_MODELS } from "../constant"; +import { DEFAULT_MODELS, DEFAULT_GA_ID } from "../constant"; declare global { namespace NodeJS { @@ -219,6 +219,7 @@ export const getServerSideConfig = () => { cloudflareKVTTL: process.env.CLOUDFLARE_KV_TTL, gtmId: process.env.GTM_ID, + gaId: process.env.GA_ID || DEFAULT_GA_ID, needCode: ACCESS_CODES.size > 0, code: process.env.CODE, diff --git a/app/constant.ts b/app/constant.ts index c74cdbb22..67d2d410a 100644 --- a/app/constant.ts +++ b/app/constant.ts @@ -483,4 +483,5 @@ export const internalAllowedWebDavEndpoints = [ "https://app.koofr.net/dav/Koofr", ]; +export const DEFAULT_GA_ID = "G-89WN60ZK2E"; export const PLUGINS = [{ name: "Stable Diffusion", path: Path.Sd }]; diff --git a/app/layout.tsx b/app/layout.tsx index 711850236..46f6ca8ba 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -6,7 +6,7 @@ import { getClientConfig } from "./config/client"; import type { Metadata, Viewport } from "next"; import { SpeedInsights } from "@vercel/speed-insights/next"; import { getServerSideConfig } from "./config/server"; -import { GoogleTagManager } from "@next/third-parties/google"; +import { GoogleTagManager, GoogleAnalytics } from "@next/third-parties/google"; const serverConfig = getServerSideConfig(); import { Providers } from "@/app/providers"; // import { Viewport } from "next"; @@ -92,6 +92,11 @@ export default function RootLayout({ )} + {serverConfig?.gaId && ( + <> + + + )} ); diff --git a/app/styles/globals.scss b/app/styles/globals.scss index 71de3194b..744b8758f 100644 --- a/app/styles/globals.scss +++ b/app/styles/globals.scss @@ -272,7 +272,7 @@ div.math { pre { position: relative; - + &:hover .copy-code-button { pointer-events: all; transform: translateX(0px); @@ -304,6 +304,37 @@ pre { } } +code{ + .show-hide-button { + border-radius: 10px; + position: absolute; + inset: 0 0 auto 0; + width: 100%; + margin: auto; + height: fit-content; + display: inline-flex; + justify-content: center; + button{ + margin-top: 3em; + margin-bottom: 4em; + padding: 5px 16px; + border: 0; + cursor: pointer; + border-radius: 14px; + text-align: center; + color: white; + background: #464e4e; + } + } + + .expanded { + background-image: none; + } + .collapsed { + background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.06)); + } +} + .clickable { cursor: pointer; diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 245254eff..120ab9b5a 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -9,7 +9,7 @@ }, "package": { "productName": "NextChat", - "version": "2.14.1" + "version": "2.14.2" }, "tauri": { "allowlist": {