diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml index 1c9dc413c..9c7b7e6f1 100644 --- a/.github/workflows/sync.yml +++ b/.github/workflows/sync.yml @@ -2,28 +2,29 @@ name: Upstream Sync on: schedule: - - cron: '0 */12 * * *' # every 12 hours - workflow_dispatch: # on button click + - cron: "0 */6 * * *" # every 6 hours + workflow_dispatch: jobs: sync_latest_from_upstream: name: Sync latest commits from upstream repo runs-on: ubuntu-latest + if: ${{ github.event.repository.fork }} steps: - # Step 1: run a standard checkout action, provided by github - - name: Checkout target repo - uses: actions/checkout@v3 + # Step 1: run a standard checkout action, provided by github + - name: Checkout target repo + uses: actions/checkout@v3 - # Step 2: run the sync action - - name: Sync upstream changes - id: sync - uses: aormsby/Fork-Sync-With-Upstream-action@v3.4 - with: - upstream_sync_repo: Yidadaa/ChatGPT-Next-Web - upstream_sync_branch: main - target_sync_branch: main - target_repo_token: ${{ secrets.GITHUB_TOKEN }} # automatically generated, no need to set - - # Set test_mode true to run tests instead of the true action!! - test_mode: false + # Step 2: run the sync action + - name: Sync upstream changes + id: sync + uses: aormsby/Fork-Sync-With-Upstream-action@v3.4 + with: + upstream_sync_repo: Yidadaa/ChatGPT-Next-Web + upstream_sync_branch: main + target_sync_branch: main + target_repo_token: ${{ secrets.GITHUB_TOKEN }} # automatically generated, no need to set + + # Set test_mode true to run tests instead of the true action!! + test_mode: false diff --git a/README.md b/README.md index 23c3d0b84..815aba1af 100644 --- a/README.md +++ b/README.md @@ -182,16 +182,8 @@ docker run -d -p 3000:3000 -e OPENAI_API_KEY="" -e CODE="" yidadaa/chatgpt-next-  -## 捐赠 Donate USDT - -> BNB Smart Chain (BEP 20) - -``` -0x67cD02c7EB62641De576a1fA3EdB32eA0c3ffD89 -``` ## 鸣谢 Special Thanks - ### 捐赠者 Sponsor [@mushan0x0](https://github.com/mushan0x0) diff --git a/app/api/chat-stream/route.ts b/app/api/chat-stream/route.ts index e7bdfc5fb..f33175543 100644 --- a/app/api/chat-stream/route.ts +++ b/app/api/chat-stream/route.ts @@ -8,6 +8,15 @@ async function createStream(req: NextRequest) { const res = await requestOpenai(req); + const contentType = res.headers.get("Content-Type") ?? ""; + if (!contentType.includes("stream")) { + const content = await ( + await res.text() + ).replace(/provided:.*. You/, "provided: ***. You"); + console.log("[Stream] error ", content); + return "```json\n" + content + "```"; + } + const stream = new ReadableStream({ async start(controller) { function onParse(event: any) { diff --git a/app/components/chat.tsx b/app/components/chat.tsx index f94cee9a0..94ae484ce 100644 --- a/app/components/chat.tsx +++ b/app/components/chat.tsx @@ -452,7 +452,7 @@ export function Chat(props: {}) { role: "user", content: userInput, date: new Date().toLocaleString(), - preview: false, + preview: true, }, ] : [], @@ -460,6 +460,12 @@ export function Chat(props: {}) { const [showPromptModal, setShowPromptModal] = useState(false); + // Auto focus + useEffect(() => { + if (sidebarCollapse && isMobileScreen()) return; + inputRef.current?.focus(); + }, [sidebarCollapse]); + return (