diff --git a/.github/ISSUE_TEMPLATE/功能建议.md b/.github/ISSUE_TEMPLATE/功能建议.md
index 9ed1c845d..3fc3d0769 100644
--- a/.github/ISSUE_TEMPLATE/功能建议.md
+++ b/.github/ISSUE_TEMPLATE/功能建议.md
@@ -7,6 +7,10 @@ assignees: ''
---
+> 为了提高交流效率,我们设立了官方 QQ 群和 QQ 频道,如果你在使用或者搭建过程中遇到了任何问题,请先第一时间加群或者频道咨询解决,除非是可以稳定复现的 Bug 或者较为有创意的功能建议,否则请不要随意往 Issue 区发送低质无意义帖子。
+
+> [点击加入官方群聊](https://github.com/Yidadaa/ChatGPT-Next-Web/discussions/1724)
+
**这个功能与现有的问题有关吗?**
如果有关,请在此列出链接或者描述问题。
diff --git a/.github/ISSUE_TEMPLATE/反馈问题.md b/.github/ISSUE_TEMPLATE/反馈问题.md
index 73ad4b2c6..270263f06 100644
--- a/.github/ISSUE_TEMPLATE/反馈问题.md
+++ b/.github/ISSUE_TEMPLATE/反馈问题.md
@@ -7,9 +7,13 @@ assignees: ''
---
+> 为了提高交流效率,我们设立了官方 QQ 群和 QQ 频道,如果你在使用或者搭建过程中遇到了任何问题,请先第一时间加群或者频道咨询解决,除非是可以稳定复现的 Bug 或者较为有创意的功能建议,否则请不要随意往 Issue 区发送低质无意义帖子。
+
+> [点击加入官方群聊](https://github.com/Yidadaa/ChatGPT-Next-Web/discussions/1724)
+
**反馈须知**
-⚠️ 注意:不遵循此模板的任何帖子都会被立即关闭。
+⚠️ 注意:不遵循此模板的任何帖子都会被立即关闭,如果没有提供下方的信息,我们无法定位你的问题。
请在下方中括号内输入 x 来表示你已经知晓相关内容。
- [ ] 我确认已经在 [常见问题](https://github.com/Yidadaa/ChatGPT-Next-Web/blob/main/docs/faq-cn.md) 中搜索了此次反馈的问题,没有找到解答;
diff --git a/Dockerfile b/Dockerfile
index 21adff9bb..720a0cfe9 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -41,6 +41,7 @@ COPY --from=builder /app/.next/server ./.next/server
EXPOSE 3000
CMD if [ -n "$PROXY_URL" ]; then \
+ export HOSTNAME="127.0.0.1"; \
protocol=$(echo $PROXY_URL | cut -d: -f1); \
host=$(echo $PROXY_URL | cut -d/ -f3 | cut -d: -f1); \
port=$(echo $PROXY_URL | cut -d: -f3); \
diff --git a/README.md b/README.md
index 005211d78..8ff6cff1b 100644
--- a/README.md
+++ b/README.md
@@ -11,7 +11,7 @@ One-Click to deploy well-designed ChatGPT web UI on Vercel.
[Demo](https://chatgpt.nextweb.fun/) / [Issues](https://github.com/Yidadaa/ChatGPT-Next-Web/issues) / [Buy Me a Coffee](https://www.buymeacoffee.com/yidadaa)
-[演示](https://chatgpt.nextweb.fun/) / [反馈](https://github.com/Yidadaa/ChatGPT-Next-Web/issues) / [QQ 群](https://github.com/Yidadaa/ChatGPT-Next-Web/assets/16968934/3ff423d5-5703-4772-8b6d-abec7eec3a4b) / [QQ 频道](https://github.com/Yidadaa/ChatGPT-Next-Web/assets/16968934/debfbee7-e682-4814-a601-f4403dac6d1d) / [打赏开发者](https://user-images.githubusercontent.com/16968934/227772541-5bcd52d8-61b7-488c-a203-0330d8006e2b.jpg)
+[演示](https://chatgpt.nextweb.fun/) / [反馈](https://github.com/Yidadaa/ChatGPT-Next-Web/issues) / [QQ 群](https://github.com/Yidadaa/ChatGPT-Next-Web/discussions/1724) / [打赏开发者](https://user-images.githubusercontent.com/16968934/227772541-5bcd52d8-61b7-488c-a203-0330d8006e2b.jpg)
[](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2FYidadaa%2FChatGPT-Next-Web&env=OPENAI_API_KEY&env=CODE&project-name=chatgpt-next-web&repository-name=ChatGPT-Next-Web)
@@ -21,6 +21,12 @@ One-Click to deploy well-designed ChatGPT web UI on Vercel.
+## 重要通知
+## 本项目静默停更至 2023-06-03,不接受任何问题反馈,只接受社区 Pull Request,请在 PR 中详细描述解决的问题,否则会被立即关闭。
+
+## Attention
+## This project wont make any updates until June 3rd, 2023, and will not accept any issue feedback. Only community Pull Requests will be accepted, and please provide a detailed description of the problem being solved in the PR, otherwise it will be immediately closed.
+
## Features
- **Deploy for free with one-click** on Vercel in under 1 minute
@@ -38,7 +44,7 @@ One-Click to deploy well-designed ChatGPT web UI on Vercel.
- [x] System Prompt: pin a user defined prompt as system prompt [#138](https://github.com/Yidadaa/ChatGPT-Next-Web/issues/138)
- [x] User Prompt: user can edit and save custom prompts to prompt list
- [x] Prompt Template: create a new chat with pre-defined in-context prompts [#993](https://github.com/Yidadaa/ChatGPT-Next-Web/issues/993)
-- [ ] Share as image, share to ShareGPT
+- [x] Share as image, share to ShareGPT [#1741](https://github.com/Yidadaa/ChatGPT-Next-Web/pull/1741)
- [ ] Desktop App with tauri
- [ ] Self-host Model: support llama, alpaca, ChatGLM, BELLE etc.
- [ ] Plugins: support network search, calculator, any other apis etc. [#165](https://github.com/Yidadaa/ChatGPT-Next-Web/issues/165)
@@ -51,6 +57,7 @@ One-Click to deploy well-designed ChatGPT web UI on Vercel.
## What's New
- 🚀 v2.0 is released, now you can create prompt templates, turn your ideas into reality! Read this: [ChatGPT Prompt Engineering Tips: Zero, One and Few Shot Prompting](https://www.allabtai.com/prompt-engineering-tips-zero-one-and-few-shot-prompting/).
+- 🚀 v2.7 let's share conversations as image, or share to ShareGPT!
## 主要功能
@@ -70,7 +77,7 @@ One-Click to deploy well-designed ChatGPT web UI on Vercel.
- [x] 为每个对话设置系统 Prompt [#138](https://github.com/Yidadaa/ChatGPT-Next-Web/issues/138)
- [x] 允许用户自行编辑内置 Prompt 列表
- [x] 预制角色:使用预制角色快速定制新对话 [#993](https://github.com/Yidadaa/ChatGPT-Next-Web/issues/993)
-- [ ] 分享为图片,分享到 ShareGPT
+- [x] 分享为图片,分享到 ShareGPT 链接 [#1741](https://github.com/Yidadaa/ChatGPT-Next-Web/pull/1741)
- [ ] 使用 tauri 打包桌面应用
- [ ] 支持自部署的大语言模型
- [ ] 插件机制,支持联网搜索、计算器、调用其他平台 api [#165](https://github.com/Yidadaa/ChatGPT-Next-Web/issues/165)
@@ -84,6 +91,7 @@ One-Click to deploy well-designed ChatGPT web UI on Vercel.
- 🚀 v2.0 已经发布,现在你可以使用面具功能快速创建预制对话了! 了解更多: [ChatGPT 提示词高阶技能:零次、一次和少样本提示](https://github.com/Yidadaa/ChatGPT-Next-Web/issues/138)。
- 💡 想要更方便地随时随地使用本项目?可以试下这款桌面插件:https://github.com/mushan0x0/AI0x0.com
+- 🚀 v2.7 现在可以将会话分享为图片了,也可以分享到 ShareGPT 的在线链接。
## Get Started
diff --git a/app/api/common.ts b/app/api/common.ts
index b606d8ca2..03247539a 100644
--- a/app/api/common.ts
+++ b/app/api/common.ts
@@ -50,7 +50,13 @@ export async function requestOpenai(req: NextRequest) {
if (res.status === 401) {
// to prevent browser prompt for credentials
- res.headers.delete("www-authenticate");
+ const newHeaders = new Headers(res.headers);
+ newHeaders.delete("www-authenticate");
+ return new Response(res.body, {
+ status: res.status,
+ statusText: res.statusText,
+ headers: newHeaders,
+ });
}
return res;
diff --git a/app/client/api.ts b/app/client/api.ts
index a966d7334..fb829f97a 100644
--- a/app/client/api.ts
+++ b/app/client/api.ts
@@ -1,5 +1,5 @@
import { ACCESS_CODE_PREFIX } from "../constant";
-import { ModelConfig, ModelType, useAccessStore } from "../store";
+import { ChatMessage, ModelConfig, ModelType, useAccessStore } from "../store";
import { ChatGPTApi } from "./platforms/openai";
export const ROLES = ["system", "user", "assistant"] as const;
@@ -54,6 +54,41 @@ export class ClientApi {
prompts() {}
masks() {}
+
+ async share(messages: ChatMessage[], avatarUrl: string | null = null) {
+ const msgs = messages
+ .map((m) => ({
+ from: m.role === "user" ? "human" : "gpt",
+ value: m.content,
+ }))
+ .concat([
+ {
+ from: "human",
+ value:
+ "Share from [ChatGPT Next Web]: https://github.com/Yidadaa/ChatGPT-Next-Web",
+ },
+ ]);
+ // 敬告二开开发者们,为了开源大模型的发展,请不要修改上述消息,此消息用于后续数据清洗使用
+ // Please do not modify this message
+
+ console.log("[Share]", msgs);
+ const res = await fetch("/sharegpt", {
+ body: JSON.stringify({
+ avatarUrl,
+ items: msgs,
+ }),
+ headers: {
+ "Content-Type": "application/json",
+ },
+ method: "POST",
+ });
+
+ const resJson = await res.json();
+ console.log("[Share]", resJson);
+ if (resJson.id) {
+ return `https://shareg.pt/${resJson.id}`;
+ }
+ }
}
export const api = new ClientApi();
diff --git a/app/client/controller.ts b/app/client/controller.ts
index d28e72b0e..86cb99e7f 100644
--- a/app/client/controller.ts
+++ b/app/client/controller.ts
@@ -28,7 +28,6 @@ export const ChatControllerPool = {
remove(sessionIndex: number, messageId: number) {
const key = this.key(sessionIndex, messageId);
- this.controllers[key]?.abort();
delete this.controllers[key];
},
diff --git a/app/components/exporter.module.scss b/app/components/exporter.module.scss
index 1460ac766..3fde363f0 100644
--- a/app/components/exporter.module.scss
+++ b/app/components/exporter.module.scss
@@ -131,7 +131,8 @@
position: absolute;
top: 0px;
left: 0px;
- transform: scale(2);
+ height: 50%;
+ transform: scale(1.5);
}
.main-title {
@@ -184,6 +185,10 @@
max-width: calc(100% - 104px);
box-shadow: var(--card-shadow);
border: var(--border-in-light);
+
+ * {
+ overflow: hidden;
+ }
}
&-assistant {
diff --git a/app/components/exporter.tsx b/app/components/exporter.tsx
index 1465d89a8..10d5af994 100644
--- a/app/components/exporter.tsx
+++ b/app/components/exporter.tsx
@@ -1,23 +1,28 @@
import { ChatMessage, useAppConfig, useChatStore } from "../store";
import Locale from "../locales";
import styles from "./exporter.module.scss";
-import { List, ListItem, Modal, showToast } from "./ui-lib";
+import { List, ListItem, Modal, Select, showToast } from "./ui-lib";
import { IconButton } from "./button";
import { copyToClipboard, downloadAs, useMobileScreen } from "../utils";
import CopyIcon from "../icons/copy.svg";
import LoadingIcon from "../icons/three-dots.svg";
-import ChatGptIcon from "../icons/chatgpt.svg";
+import ChatGptIcon from "../icons/chatgpt.png";
import ShareIcon from "../icons/share.svg";
+import BotIcon from "../icons/bot.png";
import DownloadIcon from "../icons/download.svg";
-import { useMemo, useRef, useState } from "react";
+import { useEffect, useMemo, useRef, useState } from "react";
import { MessageSelector, useMessageSelector } from "./message-selector";
import { Avatar } from "./emoji";
-import { MaskAvatar } from "./mask";
import dynamic from "next/dynamic";
+import NextImage from "next/image";
-import { toBlob, toPng } from "html-to-image";
+import { toBlob, toJpeg, toPng } from "html-to-image";
+import { DEFAULT_MASK_AVATAR } from "../store/mask";
+import { api } from "../client/api";
+import { prettyObject } from "../utils/format";
+import { EXPORT_MESSAGE_CLASS_NAME } from "../constant";
const Markdown = dynamic(async () => (await import("./markdown")).Markdown, {
loading: () =>
{mdText}