From e22c50ff1ab608800211ff6405afeed33476ea83 Mon Sep 17 00:00:00 2001 From: sijinhui Date: Thu, 26 Sep 2024 10:07:26 +0800 Subject: [PATCH 1/9] enable pm2 start --- ecosystem.config.js | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 ecosystem.config.js diff --git a/ecosystem.config.js b/ecosystem.config.js new file mode 100644 index 000000000..c5b7b6698 --- /dev/null +++ b/ecosystem.config.js @@ -0,0 +1,10 @@ +module.exports = { + apps : [{ + name : "chat", + script : "yarn", + args : "start", + env : { + PORT : 23000 + } + }] +} From aa474d279b9ff907ba787a5eeb54bf3d33f6df94 Mon Sep 17 00:00:00 2001 From: sijinhui Date: Thu, 26 Sep 2024 10:44:11 +0800 Subject: [PATCH 2/9] enable pm2 start --- ecosystem.config.js | 4 +++- next.config.mjs | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ecosystem.config.js b/ecosystem.config.js index c5b7b6698..16dca32d5 100644 --- a/ecosystem.config.js +++ b/ecosystem.config.js @@ -5,6 +5,8 @@ module.exports = { args : "start", env : { PORT : 23000 - } + }, + autorestart: true, + interpreter: '/bin/bash', }] } diff --git a/next.config.mjs b/next.config.mjs index a976454c0..fe8cc0f2c 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -86,7 +86,11 @@ const nextConfig = { }, experimental: { forceSwcTransforms: true, - serverComponentsExternalPackages: ["tiktoken"] + serverComponentsExternalPackages: ["tiktoken"], + // 加速跟踪依赖项 + // turbotrace: { + // logDetail: true, + // }, }, // externals: { // 'sharp': 'commonjs sharp' From ac9e66bff7823d44dffc0d0b30980e4cd8cccfd4 Mon Sep 17 00:00:00 2001 From: sijinhui Date: Thu, 26 Sep 2024 13:48:53 +0800 Subject: [PATCH 3/9] fix add ele --- app/components/chat-list.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/components/chat-list.tsx b/app/components/chat-list.tsx index 6adea1f07..55f26f4eb 100644 --- a/app/components/chat-list.tsx +++ b/app/components/chat-list.tsx @@ -169,10 +169,13 @@ export function ChatList(props: { narrow?: boolean }) { ease={"easeOutQuart"} // "easeInOutQuart" duration={[550, 450]} animConfig={[ - { opacity: [1, 0], translateY: [0, -30] }, + { opacity: [1, 0], translateY: [0, -30], height: [71, 0] }, { height: 0 }, ]} - // TODO:目前仅剩添加元素其他元素平移动画问题 + // TODO:修复添加元素其他元素平移动画问题,但下面的好像不生效全靠指定高度 + onEnd={({ key, type, target }) => { + if (type === "enter") target.style.height = "auto"; + }} // interval={150} > {sessions.map((item, i) => ( From e1ad7c52343c3257737936637d643477c2cba160 Mon Sep 17 00:00:00 2001 From: sijinhui Date: Thu, 26 Sep 2024 16:40:29 +0800 Subject: [PATCH 4/9] fix mobile bug --- app/components/chat-list.tsx | 16 +++++++++++----- app/components/home.module.scss | 7 +++++++ 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/app/components/chat-list.tsx b/app/components/chat-list.tsx index 55f26f4eb..4e584bffc 100644 --- a/app/components/chat-list.tsx +++ b/app/components/chat-list.tsx @@ -22,7 +22,7 @@ import { useMobileScreen } from "../utils"; // motion import QueueAnim from "rc-queue-anim"; -export function ChatItem(props: { +function ChatItem(props: { onClick?: () => void; onDelete?: () => void; title: string; @@ -34,6 +34,7 @@ export function ChatItem(props: { narrow?: boolean; mask: Mask; provided: DraggableProvided; + isMobileScreen: boolean; }) { const draggableRef = useRef(null); useEffect(() => { @@ -57,8 +58,8 @@ export function ChatItem(props: { draggableRef.current = ele; props.provided.innerRef(ele); }} - {...props.provided.draggableProps} - {...props.provided.dragHandleProps} + {...(props.isMobileScreen ? {} : props.provided.draggableProps)} + {...(props.isMobileScreen ? {} : props.provided.dragHandleProps)} title={`${props.title}\n${Locale.ChatItem.ChatItemCount(props.count)}`} > {props.narrow ? ( @@ -84,7 +85,10 @@ export function ChatItem(props: { )}
{ props.onDelete?.(); e.preventDefault(); @@ -155,6 +159,7 @@ export function ChatList(props: { narrow?: boolean }) { narrow={props.narrow} mask={sessions[rubic.source.index].mask} provided={provided} + isMobileScreen={isMobileScreen} /> )} > @@ -172,7 +177,7 @@ export function ChatList(props: { narrow?: boolean }) { { opacity: [1, 0], translateY: [0, -30], height: [71, 0] }, { height: 0 }, ]} - // TODO:修复添加元素其他元素平移动画问题,但下面的好像不生效全靠指定高度 + // TODO:手机端好像还有点问题,先把拖拽关了 onEnd={({ key, type, target }) => { if (type === "enter") target.style.height = "auto"; }} @@ -205,6 +210,7 @@ export function ChatList(props: { narrow?: boolean }) { narrow={props.narrow} mask={item.mask} provided={provided} + isMobileScreen={isMobileScreen} /> )} diff --git a/app/components/home.module.scss b/app/components/home.module.scss index d4e56c799..3ad0f3206 100644 --- a/app/components/home.module.scss +++ b/app/components/home.module.scss @@ -229,6 +229,13 @@ opacity: 1; } +/* 新增类,按钮持续显示 */ +.chat-item > .chat-item-delete-visible { + opacity: 0.5; + transform: translateX(-4px); +} + + .chat-item-info { display: flex; justify-content: space-between; From 06a8c01f12b2fbcdc0e37960a46fb42121820a4f Mon Sep 17 00:00:00 2001 From: sijinhui Date: Thu, 26 Sep 2024 18:22:12 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E5=8A=A0=E5=BF=AB=E4=B8=80=E7=82=B9?= =?UTF-8?q?=E5=8A=A8=E7=94=BB=E9=80=9F=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/components/chat-list.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/components/chat-list.tsx b/app/components/chat-list.tsx index 4e584bffc..815a294f0 100644 --- a/app/components/chat-list.tsx +++ b/app/components/chat-list.tsx @@ -172,7 +172,7 @@ export function ChatList(props: { narrow?: boolean }) { { if (type === "enter") target.style.height = "auto"; }} - // interval={150} + interval={50} > {sessions.map((item, i) => (
From a0e720e5eeaa51f62b6594fbad8f7695722ab8f1 Mon Sep 17 00:00:00 2001 From: sijinhui Date: Thu, 26 Sep 2024 18:42:51 +0800 Subject: [PATCH 6/9] =?UTF-8?q?=E5=B0=9D=E8=AF=95=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E6=9E=84=E5=BB=BA=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../workflows/crontab_cache_to_dockerhub.yml | 9 +++- Dockerfile | 47 ++++++++++--------- cache.build.Dockerfile | 18 +++++++ cache.Dockerfile => cache.install.Dockerfile | 0 4 files changed, 52 insertions(+), 22 deletions(-) create mode 100644 cache.build.Dockerfile rename cache.Dockerfile => cache.install.Dockerfile (100%) diff --git a/.github/workflows/crontab_cache_to_dockerhub.yml b/.github/workflows/crontab_cache_to_dockerhub.yml index a0164149c..17efc24a5 100644 --- a/.github/workflows/crontab_cache_to_dockerhub.yml +++ b/.github/workflows/crontab_cache_to_dockerhub.yml @@ -28,6 +28,13 @@ jobs: uses: docker/build-push-action@v4 with: context: . - file: cache.Dockerfile + file: cache.install.Dockerfile + push: true + tags: sijinhui/chatgpt-next-web:installcache + - name: Build and push Docker image + uses: docker/build-push-action@v4 + with: + context: . + file: cache.build.Dockerfile push: true tags: sijinhui/chatgpt-next-web:buildcache diff --git a/Dockerfile b/Dockerfile index 327739ecd..91607cbd6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,27 +1,32 @@ -FROM sijinhui/chatgpt-next-web:buildcache AS deps - -WORKDIR /app - -COPY package.json yarn.lock ./ - -RUN yarn install - -FROM sijinhui/node:base AS builder - -RUN apk add --no-cache git libc6-compat - -ENV OPENAI_API_KEY="" -ENV GOOGLE_API_KEY="" -ENV CODE="" +#FROM sijinhui/chatgpt-next-web:installcache AS deps +# +#WORKDIR /app +# +#COPY package.json yarn.lock ./ +# +#RUN yarn install +# +#FROM sijinhui/node:base AS builder +# +#RUN apk add --no-cache git libc6-compat +# +#ENV OPENAI_API_KEY="" +#ENV GOOGLE_API_KEY="" +#ENV CODE="" +# +#WORKDIR /app +#COPY . . +#COPY --from=deps /app/node_modules ./node_modules +## 避免下面那个报错 +## RUN mkdir -p "/app/node_modules/tiktoken" && mkdir -p "/app/node_modules/sharp" +## RUN yarn add sharp +## ENV NEXT_SHARP_PATH /app/node_modules/sharp +#RUN yarn build +FROM sijinhui/chatgpt-next-web:buildcache as builder WORKDIR /app COPY . . -COPY --from=deps /app/node_modules ./node_modules -# 避免下面那个报错 -# RUN mkdir -p "/app/node_modules/tiktoken" && mkdir -p "/app/node_modules/sharp" -# RUN yarn add sharp -# ENV NEXT_SHARP_PATH /app/node_modules/sharp -RUN yarn build +RUN yarn install && yarn build FROM sijinhui/node:base AS runner WORKDIR /app diff --git a/cache.build.Dockerfile b/cache.build.Dockerfile new file mode 100644 index 000000000..45420424e --- /dev/null +++ b/cache.build.Dockerfile @@ -0,0 +1,18 @@ +FROM sijinhui/chatgpt-next-web:installcache AS deps + +FROM sijinhui/node:base AS builder + +RUN apk add --no-cache git libc6-compat + +ENV OPENAI_API_KEY="" +ENV GOOGLE_API_KEY="" +ENV CODE="" + +WORKDIR /app +COPY . . +COPY --from=deps /app/node_modules ./node_modules +# 避免下面那个报错 +# RUN mkdir -p "/app/node_modules/tiktoken" && mkdir -p "/app/node_modules/sharp" +# RUN yarn add sharp +# ENV NEXT_SHARP_PATH /app/node_modules/sharp +RUN yarn build diff --git a/cache.Dockerfile b/cache.install.Dockerfile similarity index 100% rename from cache.Dockerfile rename to cache.install.Dockerfile From ad45a8195f0c9aabd5ccb4a5083becf7d7a7bcdb Mon Sep 17 00:00:00 2001 From: sijinhui Date: Thu, 26 Sep 2024 18:47:24 +0800 Subject: [PATCH 7/9] =?UTF-8?q?=E5=B0=9D=E8=AF=95=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E6=9E=84=E5=BB=BA=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- node.Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node.Dockerfile b/node.Dockerfile index fdfc81ba9..823fff4e0 100644 --- a/node.Dockerfile +++ b/node.Dockerfile @@ -1,4 +1,4 @@ -FROM hub.si.icu/library/node:22.1-alpine AS base +FROM node:22.1-alpine AS base RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories RUN apk add --no-cache tzdata # 设置时区环境变量 From 569a731ee8d2a44d6630d852b5760282484bc5b6 Mon Sep 17 00:00:00 2001 From: sijinhui Date: Thu, 26 Sep 2024 18:52:42 +0800 Subject: [PATCH 8/9] =?UTF-8?q?=E5=B0=9D=E8=AF=95=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E6=9E=84=E5=BB=BA=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 91607cbd6..8c4a6edf5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,9 +23,13 @@ ## ENV NEXT_SHARP_PATH /app/node_modules/sharp #RUN yarn build -FROM sijinhui/chatgpt-next-web:buildcache as builder +FROM sijinhui/chatgpt-next-web:buildcache as base + +FROM sijinhui/node:base AS builder WORKDIR /app COPY . . +COPY --from=base /app/.next ./next +COPY --from=base /app/node_modules ./node_modules RUN yarn install && yarn build FROM sijinhui/node:base AS runner From 785fa4ed76ab0e0898a14a9fb8908c09128b552d Mon Sep 17 00:00:00 2001 From: sijinhui Date: Fri, 27 Sep 2024 11:58:15 +0800 Subject: [PATCH 9/9] =?UTF-8?q?=E4=BF=AE=E6=94=B9o1=E6=A8=A1=E5=9E=8B?= =?UTF-8?q?=E8=B0=83=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/constant.ts | 2 +- app/store/config.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/constant.ts b/app/constant.ts index 3a7ea0987..8b4522a17 100644 --- a/app/constant.ts +++ b/app/constant.ts @@ -434,7 +434,7 @@ export const DEFAULT_MODELS = [ // }, // }, { - name: "o1-preview-all", + name: "o1-preview", describe: "GPT,o1,最新模型,目前较贵", available: true, sorted: seq++, diff --git a/app/store/config.ts b/app/store/config.ts index be9db51fb..0ae6b9aec 100644 --- a/app/store/config.ts +++ b/app/store/config.ts @@ -182,7 +182,7 @@ export const useAppConfig = createPersistStore( }), { name: StoreKey.Config, - version: 4.1, + version: 4.2, merge(persistedState, currentState) { const state = persistedState as ChatConfig | undefined; @@ -229,7 +229,7 @@ export const useAppConfig = createPersistStore( state.lastUpdate = Date.now(); } - if (version < 4.1) { + if (version < 4.2) { state.modelConfig.compressModel = DEFAULT_CONFIG.modelConfig.compressModel; state.modelConfig.compressProviderName =