1 Star 0 Fork 11

倪庆/AgentGPT

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
setup.sh 1017 Bytes
一键复制 编辑 原始数据 按行查看 历史
matt! 提交于 2023-04-17 20:13 . Key validation (#219)
#!/bin/bash
cd "$(dirname "$0")" || exit
is_valid_sk_key() {
local api_key=$1
local pattern="^sk-[a-zA-Z0-9]{48}$"
[[ $api_key =~ $pattern ]] && return 0 || return 1
}
echo -n "Enter your OpenAI Key (eg: sk...) or press enter to continue with no key: "
read OPENAI_API_KEY
if is_valid_sk_key $OPENAI_API_KEY || [ -z "$OPENAI_API_KEY" ]; then
echo "Valid API key"
else
echo "Invalid API key. Please ensure that you have billing set up on your OpenAI account"
exit
fi
NEXTAUTH_SECRET=$(openssl rand -base64 32)
ENV="NODE_ENV=development\n\
NEXTAUTH_SECRET=$NEXTAUTH_SECRET\n\
NEXTAUTH_URL=http://localhost:3000\n\
OPENAI_API_KEY=$OPENAI_API_KEY\n\
DATABASE_URL=file:../db/db.sqlite\n"
printf $ENV > .env
if [ "$1" = "--docker" ]; then
printf $ENV > .env.docker
source .env.docker
docker build --build-arg NODE_ENV=$NODE_ENV -t agentgpt .
docker run -d --name agentgpt -p 3000:3000 -v $(pwd)/db:/app/db agentgpt
else
printf $ENV > .env
./prisma/useSqlite.sh
npm install
npm run dev
fi
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
TypeScript
1
https://gitee.com/niqing123/AgentGPT.git
git@gitee.com:niqing123/AgentGPT.git
niqing123
AgentGPT
AgentGPT
main

搜索帮助