This commit is contained in:
GH Action - Upstream Sync 2023-08-25 01:05:01 +00:00
commit a24b0a7411
7 changed files with 48 additions and 37 deletions

View File

@ -230,8 +230,8 @@ yarn dev
docker pull yidadaa/chatgpt-next-web docker pull yidadaa/chatgpt-next-web
docker run -d -p 3000:3000 \ docker run -d -p 3000:3000 \
-e OPENAI_API_KEY="sk-xxxx" \ -e OPENAI_API_KEY=sk-xxxx \
-e CODE="your-password" \ -e CODE=your-password \
yidadaa/chatgpt-next-web yidadaa/chatgpt-next-web
``` ```
@ -239,9 +239,9 @@ You can start service behind a proxy:
```shell ```shell
docker run -d -p 3000:3000 \ docker run -d -p 3000:3000 \
-e OPENAI_API_KEY="sk-xxxx" \ -e OPENAI_API_KEY=sk-xxxx \
-e CODE="your-password" \ -e CODE=your-password \
-e PROXY_URL="http://localhost:7890" \ -e PROXY_URL=http://localhost:7890 \
yidadaa/chatgpt-next-web yidadaa/chatgpt-next-web
``` ```

View File

@ -135,8 +135,8 @@ BASE_URL=https://chatgpt1.nextweb.fun/api/proxy
docker pull yidadaa/chatgpt-next-web docker pull yidadaa/chatgpt-next-web
docker run -d -p 3000:3000 \ docker run -d -p 3000:3000 \
-e OPENAI_API_KEY="sk-xxxx" \ -e OPENAI_API_KEY=sk-xxxx \
-e CODE="页面访问密码" \ -e CODE=页面访问密码 \
yidadaa/chatgpt-next-web yidadaa/chatgpt-next-web
``` ```
@ -144,10 +144,10 @@ docker run -d -p 3000:3000 \
```shell ```shell
docker run -d -p 3000:3000 \ docker run -d -p 3000:3000 \
-e OPENAI_API_KEY="sk-xxxx" \ -e OPENAI_API_KEY=sk-xxxx \
-e CODE="页面访问密码" \ -e CODE=页面访问密码 \
--net=host \ --net=host \
-e PROXY_URL="http://127.0.0.1:7890" \ -e PROXY_URL=http://127.0.0.1:7890 \
yidadaa/chatgpt-next-web yidadaa/chatgpt-next-web
``` ```

View File

@ -130,8 +130,8 @@ Antes de empezar a escribir código, debe crear uno nuevo en la raíz del proyec
docker pull yidadaa/chatgpt-next-web docker pull yidadaa/chatgpt-next-web
docker run -d -p 3000:3000 \ docker run -d -p 3000:3000 \
-e OPENAI_API_KEY="sk-xxxx" \ -e OPENAI_API_KEY=sk-xxxx \
-e CODE="页面访问密码" \ -e CODE=your-password \
yidadaa/chatgpt-next-web yidadaa/chatgpt-next-web
``` ```
@ -139,10 +139,10 @@ También puede especificar proxy:
```shell ```shell
docker run -d -p 3000:3000 \ docker run -d -p 3000:3000 \
-e OPENAI_API_KEY="sk-xxxx" \ -e OPENAI_API_KEY=sk-xxxx \
-e CODE="页面访问密码" \ -e CODE=your-password \
--net=host \ --net=host \
-e PROXY_URL="http://127.0.0.1:7890" \ -e PROXY_URL=http://127.0.0.1:7890 \
yidadaa/chatgpt-next-web yidadaa/chatgpt-next-web
``` ```

View File

@ -196,8 +196,8 @@ yarn dev
docker pull yidadaa/chatgpt-next-web docker pull yidadaa/chatgpt-next-web
docker run -d -p 3000:3000 \ docker run -d -p 3000:3000 \
-e OPENAI_API_KEY="sk-xxxx" \ -e OPENAI_API_KEY=sk-xxxx \
-e CODE="your-password" \ -e CODE=your-password \
yidadaa/chatgpt-next-web yidadaa/chatgpt-next-web
``` ```
@ -205,9 +205,9 @@ docker run -d -p 3000:3000 \
```shell ```shell
docker run -d -p 3000:3000 \ docker run -d -p 3000:3000 \
-e OPENAI_API_KEY="sk-xxxx" \ -e OPENAI_API_KEY=sk-xxxx \
-e CODE="your-password" \ -e CODE=your-password \
-e PROXY_URL="http://localhost:7890" \ -e PROXY_URL=http://localhost:7890 \
yidadaa/chatgpt-next-web yidadaa/chatgpt-next-web
``` ```

View File

@ -135,8 +135,8 @@ BASE_URL=https://chatgpt1.nextweb.fun/api/proxy
docker pull yidadaa/chatgpt-next-web docker pull yidadaa/chatgpt-next-web
docker run -d -p 3000:3000 \ docker run -d -p 3000:3000 \
-e OPENAI_API_KEY="sk-xxxx" \ -e OPENAI_API_KEY=sk-xxxx \
-e CODE="페이지 접근 비밀번호" \ -e CODE=페이지 접근 비밀번호 \
yidadaa/chatgpt-next-web yidadaa/chatgpt-next-web
``` ```
@ -144,10 +144,10 @@ docker run -d -p 3000:3000 \
```shell ```shell
docker run -d -p 3000:3000 \ docker run -d -p 3000:3000 \
-e OPENAI_API_KEY="sk-xxxx" \ -e OPENAI_API_KEY=sk-xxxx \
-e CODE="페이지 접근 비밀번호" \ -e CODE=페이지 접근 비밀번호 \
--net=host \ --net=host \
-e PROXY_URL="http://127.0.0.1:7890" \ -e PROXY_URL=http://127.0.0.1:7890 \
yidadaa/chatgpt-next-web yidadaa/chatgpt-next-web
``` ```

View File

@ -935,7 +935,7 @@ function _Chat() {
const isTouchTopEdge = e.scrollTop <= edgeThreshold; const isTouchTopEdge = e.scrollTop <= edgeThreshold;
const isTouchBottomEdge = bottomHeight >= e.scrollHeight - edgeThreshold; const isTouchBottomEdge = bottomHeight >= e.scrollHeight - edgeThreshold;
const isHitBottom = bottomHeight >= e.scrollHeight - 10; const isHitBottom = bottomHeight >= e.scrollHeight - (isMobileScreen ? 0 : 10);
const prevPageMsgIndex = msgRenderIndex - CHAT_PAGE_SIZE; const prevPageMsgIndex = msgRenderIndex - CHAT_PAGE_SIZE;
const nextPageMsgIndex = msgRenderIndex + CHAT_PAGE_SIZE; const nextPageMsgIndex = msgRenderIndex + CHAT_PAGE_SIZE;

View File

@ -565,21 +565,32 @@ export function MarkdownPreviewer(props: {
); );
} }
// modified by BackTrackZ now it's looks better
export function JsonPreviewer(props: { export function JsonPreviewer(props: {
messages: ChatMessage[]; messages: ChatMessage[];
topic: string; topic: string;
}) { }) {
const msgs = props.messages.map((m) => ({ const msgs = {
messages: [
{
role: "system",
content: "You are an assistant that " + props.topic,
},
...props.messages.map((m) => ({
role: m.role, role: m.role,
content: m.content, content: m.content,
})); })),
const mdText = "\n" + JSON.stringify(msgs, null, 2) + "\n"; ],
};
const mdText = "```json\n" + JSON.stringify(msgs, null, 2) + "\n```";
const minifiedJson = JSON.stringify(msgs);
const copy = () => { const copy = () => {
copyToClipboard(JSON.stringify(msgs, null, 2)); copyToClipboard(minifiedJson);
}; };
const download = () => { const download = () => {
downloadAs(JSON.stringify(msgs, null, 2), `${props.topic}.json`); downloadAs(JSON.stringify(msgs), `${props.topic}.json`);
}; };
return ( return (
@ -587,11 +598,11 @@ export function JsonPreviewer(props: {
<PreviewActions <PreviewActions
copy={copy} copy={copy}
download={download} download={download}
showCopy={true} showCopy={false}
messages={props.messages} messages={props.messages}
/> />
<div className="markdown-body"> <div className="markdown-body" onClick={copy}>
<pre className={styles["export-content"]}>{mdText}</pre> <Markdown content={mdText} />
</div> </div>
</> </>
); );