Merge pull request #150 from sijinhui/dev

Dev
This commit is contained in:
sijinhui 2024-08-18 20:45:49 +08:00 committed by GitHub
commit d2b6225ade
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 102 additions and 10 deletions

View File

@ -1,9 +1,9 @@
name: PRO DEPLOY
name: BUILD DOCKER IMAGE
on:
workflow_dispatch:
push:
branches:
- main
# push:
# branches:
# - main
# paths:
# - 'app/**'
# - 'public/**'

View File

@ -1,4 +1,4 @@
FROM sijinhui/chatgpt-next-web:buildcache as deps
FROM sijinhui/chatgpt-next-web:buildcache AS deps
WORKDIR /app

View File

@ -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)
- [ ] 本地知识库
## 最新动态

View File

@ -356,6 +356,12 @@
display: flex;
flex-wrap: nowrap;
}
.chat-model-name {
font-size: 12px;
color: var(--black);
margin-left: 6px;
}
}
.chat-message-container {

View File

@ -1623,6 +1623,11 @@ function _Chat() {
</>
)}
</div>
{!isUser && (
<div className={styles["chat-model-name"]}>
{message.model}
</div>
)}
<div className={styles["chat-message-action-date"]}>
{isContext

View File

@ -156,6 +156,46 @@ export function PreCode(props: { children: any }) {
);
}
function CustomCode(props: { children: any }) {
const ref = useRef<HTMLPreElement>(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 (
<>
<code
ref={ref}
style={{
maxHeight: collapsed ? "400px" : "none",
overflowY: "hidden",
}}
>
{props.children}
{showToggle && collapsed && (
<div
className={`show-hide-button ${
collapsed ? "collapsed" : "expanded"
}`}
>
<button onClick={toggleCollapsed}></button>
</div>
)}
</code>
</>
);
}
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) => <p {...pProps} dir="auto" />,
a: (aProps) => {
const href = aProps.href || "";

View File

@ -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,

View File

@ -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 }];

View File

@ -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({
<GoogleTagManager gtmId={serverConfig.gtmId} />
</>
)}
{serverConfig?.gaId && (
<>
<GoogleAnalytics gaId={serverConfig.gaId} />
</>
)}
</body>
</html>
);

View File

@ -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;

View File

@ -9,7 +9,7 @@
},
"package": {
"productName": "NextChat",
"version": "2.14.1"
"version": "2.14.2"
},
"tauri": {
"allowlist": {