Skip to content

Instantly share code, notes, and snippets.

@capric98
Created February 9, 2025 10:01
Show Gist options
  • Save capric98/ec0e26c257edf6d00ce6d4f0570d5274 to your computer and use it in GitHub Desktop.
Save capric98/ec0e26c257edf6d00ce6d4f0570d5274 to your computer and use it in GitHub Desktop.
#!/bin/bash
THINK_TIMEOUT=20
WORKDIR=/opt
git clone --recurse-submodules https://github.com/ChatGPTNextWeb/NextChat "${WORKDIR}/NextChat"
cd "${WORKDIR}/NextChat"
# change think timeout to 20min
sed -i "s|REQUEST_TIMEOUT_MS \* 5|REQUEST_TIMEOUT_MS \* ${THINK_TIMEOUT}|g" app/constant.ts
cat app/constant.ts | grep REQUEST_TIMEOUT_MS
# mask api key in console log
sed -i "s|api key - \${apiKey}|api key - \${apiKey.slice(0, 20) + '*'.repeat(Math.max(0, apiKey.length - 20))}|g" app/config/server.ts
cat app/config/server.ts | grep "api key -" -C 5
# use think timeout in bytedance since the model name param in bytedance api is deploy name
sed -i "s|REQUEST_TIMEOUT_MS|REQUEST_TIMEOUT_MS_FOR_THINKING|g" app/client/platforms/bytedance.ts
docker build . -t nextchat:$(git log --pretty=format:'%h' -n 1)
cd "${PWD}"
rm -rf "${WORKDIR}/NextChat"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment