Merge pull request #10 from sijinhui/dev

Dev
This commit is contained in:
sijinhui 2024-01-28 02:06:16 +08:00 committed by GitHub
commit 4032a2c9a5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 56 additions and 24 deletions

View File

@ -1,11 +0,0 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: "npm" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"

View File

@ -33,6 +33,7 @@ jobs:
deploy: deploy:
name: 部署到dev服务器 name: 部署到dev服务器
runs-on: z4 runs-on: z4
needs: build
steps: steps:
- name: Check out the repo - name: Check out the repo
uses: actions/checkout@v3 uses: actions/checkout@v3
@ -47,6 +48,7 @@ jobs:
- name: Sync repository to tx - name: Sync repository to tx
run: | run: |
yes | docker image prune yes | docker image prune
ssh root@tx.xiaosi.cc 'mkdir -p /data/test/ChatGPT-Next-Web'
rsync -az -e 'ssh -o StrictHostKeyChecking=no' --delete $GITHUB_WORKSPACE/ root@tx.xiaosi.cc:/data/test/ChatGPT-Next-Web rsync -az -e 'ssh -o StrictHostKeyChecking=no' --delete $GITHUB_WORKSPACE/ root@tx.xiaosi.cc:/data/test/ChatGPT-Next-Web
- name: deploy-to-tx - name: deploy-to-tx
uses: appleboy/ssh-action@master uses: appleboy/ssh-action@master

View File

@ -50,7 +50,8 @@ jobs:
- name: Sync repository to ty - name: Sync repository to ty
run: | run: |
yes | docker image prune yes | docker image prune
rsync -az -e 'ssh -o StrictHostKeyChecking=no' --delete $GITHUB_WORKSPACE/ root@ty.xiaosi.cc:/data/ChatGPT-Next-Web ssh root@ty.xiaosi.cc 'mkdir -p /data/ChatGPT-Next-Web'
rsync -az -e 'ssh -o StrictHostKeyChecking=no' --delete $GITHUB_WORKSPACE/ root@ty.xiaosi.cc:/data/ChatGPT-Next-Web/
- name: deploy-to-ty - name: deploy-to-ty
uses: appleboy/ssh-action@master uses: appleboy/ssh-action@master
env: env:
@ -73,6 +74,7 @@ jobs:
- name: Sync repository to tx - name: Sync repository to tx
run: | run: |
yes | docker image prune yes | docker image prune
ssh root@tx.xiaosi.cc 'mkdir -p /data/ChatGPT-Next-Web'
rsync -az -e 'ssh -o StrictHostKeyChecking=no' --delete $GITHUB_WORKSPACE/ root@tx.xiaosi.cc:/data/ChatGPT-Next-Web rsync -az -e 'ssh -o StrictHostKeyChecking=no' --delete $GITHUB_WORKSPACE/ root@tx.xiaosi.cc:/data/ChatGPT-Next-Web
- name: deploy-to-tx - name: deploy-to-tx
uses: appleboy/ssh-action@master uses: appleboy/ssh-action@master

View File

@ -1,5 +1,5 @@
#FROM registry.cn-hangzhou.aliyuncs.com/sijinhui/node:18-alpine AS base #FROM registry.cn-hangzhou.aliyuncs.com/sijinhui/node:18-alpine AS base
FROM node:20-alpine AS base FROM hub.siji.ci/library/node:20-alpine AS base
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories
RUN apk update && apk add --no-cache git tzdata RUN apk update && apk add --no-cache git tzdata
# 设置时区环境变量 # 设置时区环境变量

View File

@ -40,4 +40,4 @@ export const POST = handle;
export const GET = handle; export const GET = handle;
export const OPTIONS = handle; export const OPTIONS = handle;
export const runtime = "nodejs"; export const runtime = "edge";

View File

@ -101,19 +101,14 @@ export const POST = handle;
export const runtime = "edge"; export const runtime = "edge";
export const preferredRegion = [ export const preferredRegion = [
"arn1",
"bom1", "bom1",
"cdg1",
"cle1", "cle1",
"cpt1", "cpt1",
"dub1",
"fra1",
"gru1", "gru1",
"hnd1", "hnd1",
"iad1", "iad1",
"icn1", "icn1",
"kix1", "kix1",
"lhr1",
"pdx1", "pdx1",
"sfo1", "sfo1",
"sin1", "sin1",

View File

@ -95,6 +95,8 @@ export const getServerSideConfig = () => {
googleApiKey: process.env.GOOGLE_API_KEY, googleApiKey: process.env.GOOGLE_API_KEY,
googleUrl: process.env.GOOGLE_URL, googleUrl: process.env.GOOGLE_URL,
gtmId: process.env.GTM_ID,
needCode: ACCESS_CODES.size > 0, needCode: ACCESS_CODES.size > 0,
code: process.env.CODE, code: process.env.CODE,
codes: ACCESS_CODES, codes: ACCESS_CODES,

View File

@ -111,7 +111,9 @@ export const SUMMARIZE_MODEL = "gpt-3.5-turbo-1106";
export const KnowledgeCutOffDate: Record<string, string> = { export const KnowledgeCutOffDate: Record<string, string> = {
default: "2021-09", default: "2021-09",
"gpt-4-turbo-preview": "2023-04",
"gpt-4-1106-preview": "2023-04", "gpt-4-1106-preview": "2023-04",
"gpt-4-0125-preview": "2023-04",
"gpt-4-vision-preview": "2023-04", "gpt-4-vision-preview": "2023-04",
"gemini-pro": "2021-04", "gemini-pro": "2021-04",
}; };

View File

@ -6,7 +6,7 @@ import { getClientConfig } from "./config/client";
import { type Metadata } from "next"; import { type Metadata } from "next";
import { SpeedInsights } from "@vercel/speed-insights/next"; import { SpeedInsights } from "@vercel/speed-insights/next";
import { getServerSideConfig } from "./config/server"; import { getServerSideConfig } from "./config/server";
import { GoogleTagManager } from "@next/third-parties/google";
const serverConfig = getServerSideConfig(); const serverConfig = getServerSideConfig();
import { Providers } from "@/app/providers"; import { Providers } from "@/app/providers";
import { Viewport } from "next"; import { Viewport } from "next";
@ -49,6 +49,11 @@ export default function RootLayout({
<SpeedInsights /> <SpeedInsights />
</> </>
)} )}
{serverConfig?.gtmId && (
<>
<GoogleTagManager gtmId={serverConfig.gtmId} />
</>
)}
</body> </body>
</html> </html>
); );

View File

@ -28,9 +28,9 @@ export enum Theme {
} }
export const DEFAULT_CONFIG = { export const DEFAULT_CONFIG = {
submitKey: SubmitKey.Enter as SubmitKey,
lastUpdate: Date.now(), // timestamp, to merge state lastUpdate: Date.now(), // timestamp, to merge state
submitKey: SubmitKey.Enter,
// submitKey: isMacOS() ? SubmitKey.MetaEnter : SubmitKey.CtrlEnter, // submitKey: isMacOS() ? SubmitKey.MetaEnter : SubmitKey.CtrlEnter,
avatar: "1f603", avatar: "1f603",
fontSize: 14, fontSize: 14,
@ -137,7 +137,7 @@ export const useAppConfig = createPersistStore(
}), }),
{ {
name: StoreKey.Config, name: StoreKey.Config,
version: 3.893, version: 3.894,
migrate(persistedState, version) { migrate(persistedState, version) {
const state = persistedState as ChatConfig; const state = persistedState as ChatConfig;
@ -168,7 +168,7 @@ export const useAppConfig = createPersistStore(
if (version < 3.8) { if (version < 3.8) {
state.lastUpdate = Date.now(); state.lastUpdate = Date.now();
} }
if (version < 3.893) { if (version < 3.894) {
state.lastUpdate = Date.now(); state.lastUpdate = Date.now();
return { ...DEFAULT_CONFIG }; return { ...DEFAULT_CONFIG };
} }

View File

@ -18,6 +18,7 @@
"dependencies": { "dependencies": {
"@fortaine/fetch-event-source": "^3.0.6", "@fortaine/fetch-event-source": "^3.0.6",
"@hello-pangea/dnd": "^16.5.0", "@hello-pangea/dnd": "^16.5.0",
"@next/third-parties": "^14.1.0",
"@next-auth/prisma-adapter": "^1.0.7", "@next-auth/prisma-adapter": "^1.0.7",
"@prisma/client": "^5.7.0", "@prisma/client": "^5.7.0",
"@svgr/webpack": "^8.1.0", "@svgr/webpack": "^8.1.0",

View File

@ -0,0 +1,34 @@
#!/bin/bash
# Set the pipefail option.
set -o pipefail
# Get the Vercel API endpoints.
GET_DEPLOYMENTS_ENDPOINT="https://api.vercel.com/v6/deployments"
DELETE_DEPLOYMENTS_ENDPOINT="https://api.vercel.com/v13/deployments"
# Create a list of deployments.
deployments=$(curl -s -X GET "$GET_DEPLOYMENTS_ENDPOINT/?projectId=$VERCEL_PROJECT_ID&teamId=$VERCEL_ORG_ID" -H "Authorization: Bearer $VERCEL_TOKEN ")
#deployments=$(curl -s -X GET "$GET_DEPLOYMENTS_ENDPOINT/?projectId=$VERCEL_PROJECT_ID" -H "Authorization: Bearer $VERCEL_TOKEN ")
# Filter the deployments list by meta.base_hash === meta tag.
filtered_deployments=$(echo -E $deployments | jq --arg META_TAG "$META_TAG" '[.deployments[] | select(.meta.base_hash | type == "string" and contains($META_TAG)) | .uid] | join(",")')
filtered_deployments="${filtered_deployments//\"/}" # Remove double quotes
# Clears the values from filtered_deployments
IFS=',' read -ra values <<<"$filtered_deployments"
echo "META_TAG ${META_TAG}"
echo "Filtered deployments ${filtered_deployments}"
# Iterate over the filtered deployments list.
for uid in "${values[@]}"; do
echo "Deleting ${uid}"
delete_url="${DELETE_DEPLOYMENTS_ENDPOINT}/${uid}?teamId=${VERCEL_ORG_ID}"
echo $delete_url
# Make DELETE a request to the /v13/deployments/{id} endpoint.
curl -X DELETE $delete_url -H "Authorization: Bearer $VERCEL_TOKEN"
echo "Deleted!"
done

View File

@ -20,4 +20,4 @@ rsync -az --delete ./.next/server/ ${OUT_DIR}/.next/server
rsync -az --delete ./.next/server/ ${OUT_DIR}/.next/server rsync -az --delete ./.next/server/ ${OUT_DIR}/.next/server
rsync -az --delete "./node_modules/tiktoken/" ${OUT_DIR}/node_modules/tiktoken rsync -az --delete "./node_modules/tiktoken/" ${OUT_DIR}/node_modules/tiktoken
docker network create chatgpt-ns > /dev/null 2>&1 docker network ls | grep -qw chatgpt-ns || docker network create chatgpt-ns