-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
130 changed files
with
3,371 additions
and
2,532 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,81 @@ | ||
# Install dependencies only when needed | ||
FROM node:18.15-alpine AS deps | ||
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed. | ||
RUN apk add --no-cache libc6-compat && npm install -g pnpm | ||
# --------- install dependence ----------- | ||
FROM node:18.17-alpine AS mainDeps | ||
WORKDIR /app | ||
|
||
ARG name | ||
ARG proxy | ||
|
||
RUN [ -z "$proxy" ] || sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories | ||
RUN apk add --no-cache libc6-compat && npm install -g [email protected] | ||
# if proxy exists, set proxy | ||
RUN [ -z "$proxy" ] || pnpm config set registry https://registry.npm.taobao.org | ||
|
||
# copy packages and one project | ||
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./ | ||
COPY pnpm-lock.yaml pnpm-workspace.yaml ./ | ||
COPY ./packages ./packages | ||
COPY ./projects/$name/package.json ./projects/$name/package.json | ||
|
||
RUN [ -f pnpm-lock.yaml ] || (echo "Lockfile not found." && exit 1) | ||
|
||
RUN pnpm install | ||
RUN pnpm i | ||
|
||
# --------- install dependence ----------- | ||
FROM node:18.17-alpine AS workerDeps | ||
WORKDIR /app | ||
|
||
ARG proxy | ||
|
||
# Rebuild the source code only when needed | ||
FROM node:18.15-alpine AS builder | ||
RUN [ -z "$proxy" ] || sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories | ||
RUN apk add --no-cache libc6-compat && npm install -g [email protected] | ||
# if proxy exists, set proxy | ||
RUN [ -z "$proxy" ] || pnpm config set registry https://registry.npm.taobao.org | ||
|
||
COPY ./worker /app/worker | ||
RUN cd /app/worker && pnpm i --production --ignore-workspace | ||
|
||
# --------- builder ----------- | ||
FROM node:18.17-alpine AS builder | ||
WORKDIR /app | ||
|
||
ARG name | ||
ARG proxy | ||
|
||
# copy common node_modules and one project node_modules | ||
COPY package.json pnpm-workspace.yaml ./ | ||
COPY --from=deps /app/node_modules ./node_modules | ||
COPY --from=deps /app/packages ./packages | ||
COPY --from=mainDeps /app/node_modules ./node_modules | ||
COPY --from=mainDeps /app/packages ./packages | ||
COPY ./projects/$name ./projects/$name | ||
COPY --from=deps /app/projects/$name/node_modules ./projects/$name/node_modules | ||
COPY --from=mainDeps /app/projects/$name/node_modules ./projects/$name/node_modules | ||
|
||
# Uncomment the following line in case you want to disable telemetry during the build. | ||
ENV NEXT_TELEMETRY_DISABLED 1 | ||
RUN npm install -g pnpm | ||
RUN pnpm --filter=$name run build | ||
RUN [ -z "$proxy" ] || sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories | ||
|
||
RUN apk add --no-cache libc6-compat && npm install -g pnpm@8.6.0 | ||
RUN pnpm --filter=$name build | ||
|
||
FROM node:18.15-alpine AS runner | ||
# --------- runner ----------- | ||
FROM node:18.17-alpine AS runner | ||
WORKDIR /app | ||
|
||
ARG name | ||
ARG proxy | ||
|
||
# create user and use it | ||
RUN addgroup --system --gid 1001 nodejs | ||
RUN adduser --system --uid 1001 nextjs | ||
|
||
RUN [ -z "$proxy" ] || sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories | ||
RUN apk add --no-cache curl ca-certificates \ | ||
&& update-ca-certificates | ||
|
||
# copy running files | ||
COPY --from=builder /app/projects/$name/public ./projects/$name/public | ||
COPY --from=builder /app/projects/$name/next.config.js ./projects/$name/next.config.js | ||
COPY --from=builder --chown=nextjs:nodejs /app/projects/$name/.next/standalone ./ | ||
COPY --from=builder --chown=nextjs:nodejs /app/projects/$name/.next/static ./projects/$name/.next/static | ||
COPY --from=builder /app/projects/$name/public /app/projects/$name/public | ||
COPY --from=builder /app/projects/$name/next.config.js /app/projects/$name/next.config.js | ||
COPY --from=builder --chown=nextjs:nodejs /app/projects/$name/.next/standalone /app/ | ||
COPY --from=builder --chown=nextjs:nodejs /app/projects/$name/.next/static /app/projects/$name/.next/static | ||
# copy package.json to version file | ||
COPY --from=builder /app/projects/$name/package.json ./package.json | ||
# copy woker | ||
COPY --from=workerDeps /app/worker /app/worker | ||
|
||
ENV NODE_ENV production | ||
ENV NEXT_TELEMETRY_DISABLED 1 | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
title: "自定义反馈" | ||
description: "自定义反馈模块介绍" | ||
icon: "feedback" | ||
draft: false | ||
toc: true | ||
weight: 354 | ||
--- | ||
|
||
该模块为临时模块,后续会针对该模块进行更全面的设计。 | ||
|
||
## 特点 | ||
|
||
- 可重复添加 | ||
- 无外部输入 | ||
- 自动执行 | ||
|
||
|
||
| | | | ||
| --------------------- | --------------------- | | ||
| ![](/imgs/customfeedback1.png) | ![](/imgs/customfeedback2.png) | | ||
| ![](/imgs/customfeedback3.png) | ![](/imgs/customfeedback4.png) | | ||
|
||
|
||
## 介绍 | ||
|
||
自定义反馈模块,可以为你的对话增加一个反馈标记,从而方便在后台更好的分析对话的数据。 | ||
|
||
在调试模式下,不会记录反馈内容,而是直接提示: `自动反馈测试: 反馈内容`。 | ||
|
||
在对话模式(对话、分享窗口、带 chatId 的 API 调用)时,会将反馈内容记录到对话日志中。(会延迟60s记录) | ||
|
||
## 作用 | ||
|
||
自定义反馈模块的功能类似于程序开发的`埋点`,便于你观测的对话中的数据。 |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.