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..8c4a6edf5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,27 +1,36 @@ -FROM sijinhui/chatgpt-next-web:buildcache AS deps +#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 -WORKDIR /app - -COPY package.json yarn.lock ./ - -RUN yarn install +FROM sijinhui/chatgpt-next-web:buildcache as base 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 +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 WORKDIR /app diff --git a/app/components/chat-list.tsx b/app/components/chat-list.tsx index 6adea1f07..815a294f0 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} /> )} > @@ -167,13 +172,16 @@ export function ChatList(props: { narrow?: boolean }) { { + if (type === "enter") target.style.height = "auto"; + }} + interval={50} > {sessions.map((item, i) => (
@@ -202,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; 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 = 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 diff --git a/ecosystem.config.js b/ecosystem.config.js new file mode 100644 index 000000000..16dca32d5 --- /dev/null +++ b/ecosystem.config.js @@ -0,0 +1,12 @@ +module.exports = { + apps : [{ + name : "chat", + script : "yarn", + 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' 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 # 设置时区环境变量