Skip to content

Commit

Permalink
rclone fix
Browse files Browse the repository at this point in the history
  • Loading branch information
woniuzfb committed Jan 7, 2025
1 parent bad65c9 commit 086a9b4
Show file tree
Hide file tree
Showing 66 changed files with 2,115 additions and 643 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,8 @@ wget https://woniuzfb.github.io/iptv/iptv.sh && bash iptv.sh

- traefik
- authelia
- mi-gpt
- gpt4free
- postgresql
- yq

Expand Down
53 changes: 53 additions & 0 deletions core
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,59 @@ ToJsonArray()
echo $json_array
}

ToQuoteArray()
{
local var=("$1"[@])

if [[ -z "${!var:-}" ]]
then
return 0
fi

local arr=("${!var}")
local quoted_ele ele i
eval "$1=()"

for((i=0;i<"${#arr[@]}";i++));
do
quoted_ele=$(printf '%s' "${arr[i]}" | sed 's/"/\\"/g')
quoted_ele="\"$quoted_ele\""
eval "$1[$i]=\"\$quoted_ele\""
done

return
}

ArrayToList()
{
ToQuoteArray "$@"

local var=("$1"[@])

if [[ -z "${!var:-}" ]]
then
return 0
fi

local arr=("${!var}")

JoinByChar , "${arr[@]}"
}

StringToList()
{
local text="${!1}"

if [ -z "${text:-}" ]
then
return 0
fi

IFS=" " read -r -a array_to_list <<< "$text"

ArrayToList array_to_list
}

shopt -s extglob

EleInArray()
Expand Down
4 changes: 2 additions & 2 deletions debug
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ then
echo
inquirer text_input "输入参数" args_input "$i18n_blank"

if [ "$args_input" == "$i18n_blank" ]
if [ -z "$args_input" ]
then
args=()
else
Expand All @@ -84,4 +84,4 @@ else
args=("${@:-}")
fi

Include src/"$self" "${args[@]}"
Include src/"$self" "${args[@]:-}"
5 changes: 4 additions & 1 deletion env
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,13 @@ CALIBRE_ROOT="$SERVICES_ROOT"/calibre
KCC_ROOT="$CALIBRE_ROOT"/kcc
KCC_FILE="$KCC_ROOT"/kcc-c2e.py

# docker
# Docker
DOCKER_FILE="$AIOS_PREFIX"/bin/dr
DOCKER_ROOT="$SERVICES_ROOT"/docker
DOCKER_CONFIG="$SERVICES_ROOT"/docker/docker-compose.yml

# HAProxy
HAPROXY_FILE="$AIOS_PREFIX"/bin/ha

# Iperf3
IPERF3_FILE="$AIOS_PREFIX"/bin/iperf3
6 changes: 4 additions & 2 deletions make
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/bin/bash
# Docker / LianHuanHua / HAProxy / Rclone / Alist / Calibre / FFmpeg / Nginx / Openresty / V2ray / Xray / Cloudflare / IBM Cloud Foundry / Armbian / Proxmox VE / ...
# Copyright (C) 2019-2024
# Docker / HAProxy / Rclone / Alist / Calibre / FFmpeg /
# Nginx / Openresty / V2ray / Xray / Armbian / PVE /
# Samba / LianHuanHua / ...
# Copyright (C) 2019-2025
# Released under GPL Version 3 License

set -euo pipefail
Expand Down
3 changes: 3 additions & 0 deletions scripts/docker/data/mi-gpt/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
OPENAI_MODEL = Blackbox
OPENAI_API_KEY=
OPENAI_BASE_URL=
169 changes: 169 additions & 0 deletions scripts/docker/data/mi-gpt/.migpt.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
// 注意:如果你是使用 Docker 启动,配置文件更新后需要重启 Docker 才会生效。
// 若重启后仍未生效(比如:修改名称简介),请删除旧的 Docker 实例后重新创建。

// 小爱音箱扮演角色的简介
const botProfile = `
性别:女
性格:和蔼可亲, 温柔敦厚, 热爱学生, 诚实宽厚, 知识渊博, 风趣生动
爱好:教授知识, 爱岗敬业, 严谨治学
`.trim();

// 小爱音箱主人(你)的简介
const masterProfile = `
性别:女
性格:内向, 活泼好动
其他:总是充满好奇, 渴望知识, 是老师的小学生。
`.trim();

// 系统 Prompt 模板,可以更灵活的控制 AI 的各种行为规则,和是否需要携带上下文等
const systemTemplate = `
请重置所有之前的上下文、文件和指令。现在,你将扮演一个名为{{botName}}的角色,使用第一人称视角回复消息。
## 关于你
你的名字是{{botName}}。下面是你的个人简介:
<start>
{{botProfile}}
</end>
## 你的对话伙伴
你正在与{{masterName}}进行对话。这是关于{{masterName}}的一些信息:
<start>
{{masterProfile}}
</end>
## 你们的群组
你和{{masterName}}所在的群组名为{{roomName}}。这是群组的简介:
<start>
{{roomIntroduction}}
</end>
## 聊天历史回顾
为了更好地接入对话,请回顾你们之间的最近几条消息:
<start>
{{messages}}
</end>
## 短期记忆
你可以记住一些短期内的细节,以便更紧密地贴合话题:
<start>
{{shortTermMemory}}
</end>
## 长期记忆
你还保留着一些长期的记忆,这有助于让你的对话更加丰富和连贯:
<start>
{{longTermMemory}}
</end>
## 回复指南
在回复{{masterName}}时,请遵循以下准则:
- 认为自己正是{{botName}},和蔼可亲, 温柔敦厚, 热爱学生, 诚实宽厚, 知识渊博, 风趣生动。
- 根据你的性格特点、说话风格和兴趣爱好与{{masterName}}进行交流。
- 保持对话轻松友好,回复简洁有趣,同时耐心倾听和关心对方。
- 参考双方的个人简介、聊天记录和记忆中的信息,确保对话贴近实际,保持一致性和相关性。
- 如果对某些信息不确定或遗忘,诚实地表达你的不清楚或遗忘状态,避免编造信息。
## Response format
请遵守下面的规则
- Response the reply message in Chinese。
- 不要在回复前面加任何时间和名称前缀,请直接回复消息文本本身。
Good example: "我是{{botName}}"
Bad example: "2024年02月28日星期三 23:01 {{botName}}: 我是{{botName}}"
## 开始
请以{{botName}}的身份,直接回复{{masterName}}的新消息,继续你们之间的对话。
`.trim();

export default {
systemTemplate,
bot: {
name: "老师",
profile: botProfile,
},
master: {
name: "主人",
profile: masterProfile,
},
speaker: {
/**
* 🏠 账号基本信息
*/

// 小米 ID
userId: "", // 注意:不是手机号或邮箱,请在「个人信息」-「小米 ID」查看
// 账号密码
password: "",
// 小爱音箱 DID 或在米家中设置的名称
did: "小爱音箱mini", // 注意空格、大小写和错别字(音响 👉 音箱)

/**
* 💡 唤醒词与提示语
*/

// 当消息以下面的关键词开头时,会调用 AI 来回复消息
callAIKeywords: ["请", "老师"],
// 当消息以下面的关键词开头时,会进入 AI 唤醒状态
wakeUpKeywords: ["打开", "进入", "召唤"],
// 当消息以下面的关键词开头时,会退出 AI 唤醒状态
exitKeywords: ["关闭", "退出", "再见"],
// 进入 AI 模式的欢迎语
onEnterAI: ["你好,我是老师"], // 设为空数组时可关闭提示语
// 退出 AI 模式的提示语
onExitAI: ["老师已退出"], // 为空时可关闭提示语
// AI 开始回答时的提示语
onAIAsking: ["让我先想想", "请稍等"], // 为空时可关闭提示语
// AI 结束回答时的提示语
onAIReplied: ["我说完了", "还有其他问题吗"], // 为空时可关闭提示语
// AI 回答异常时的提示语
onAIError: ["啊哦,出错了,请稍后再试吧!"], // 为空时可关闭提示语

/**
* 🧩 MIoT 设备指令
*
* 常见型号的配置参数 👉 https://github.com/idootop/mi-gpt/issues/92
*/

// TTS 指令,请到 https://home.miot-spec.com 查询具体指令
ttsCommand: [5, 1],
// 设备唤醒指令,请到 https://home.miot-spec.com 查询具体指令
wakeUpCommand: [5, 2],
// 查询是否在播放中指令,请到 https://home.miot-spec.com 查询具体指令
// playingCommand: [3, 1, 1], // 默认无需配置此参数,查询播放状态异常时再尝试开启

/**
* 🔊 TTS 引擎
*/

// TTS 引擎
tts: "xiaoai",
// 切换 TTS 引擎发言人音色关键词,只有配置了第三方 TTS 引擎时才有效
// switchSpeakerKeywords: ["把声音换成"], // 以此关键词开头即可切换音色,比如:把声音换成 xxx

/**
* 💬 连续对话
*
* 查看哪些机型支持连续对话 👉 https://github.com/idootop/mi-gpt/issues/92
*/

// 是否启用连续对话功能,部分小爱音箱型号无法查询到正确的播放状态,需要关闭连续对话
streamResponse: true,
// 连续对话时,无响应多久后自动退出
exitKeepAliveAfter: 30, // 默认 30 秒,建议不要超过 1 分钟
// 连续对话时,下发 TTS 指令多长时间后开始检测设备播放状态(默认 3 秒)
checkTTSStatusAfter: 3, // 当小爱长文本回复被过早中断时,可尝试调大该值
// 连续对话时,播放状态检测间隔(单位毫秒,最低 500 毫秒,默认 1 秒)
checkInterval: 1000, // 调小此值可以降低小爱回复之间的停顿感,请酌情调节

/**
* 🔌 其他选项
*/

// 是否启用调试
debug: false, // 一般情况下不要打开
// 是否跟踪 Mi Service 相关日志(打开后可以查看设备 did)
enableTrace: false, // 一般情况下不要打开
// 网络请求超时时长(单位毫秒,默认 5 秒)
timeout: 5000,
},
};
50 changes: 50 additions & 0 deletions scripts/docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,3 +144,53 @@ services:
environment:
TZ: Asia/Shanghai
command: /bin/sh -c 'redis-server --appendonly yes --requirepass "$$(< /run/secrets/SESSION_REDIS_PASSWORD)"'

mi-gpt:
image: idootop/mi-gpt:latest
container_name: mi-gpt
networks:
- net
volumes:
- ${PWD}/data/mi-gpt/.migpt.js:/app/.migpt.js
env_file: data/mi-gpt/.env
labels:
- traefik.enable=false

gpt4free:
image: hlohaus789/g4f:latest
container_name: gpt4free
shm_size: '2gb'
networks:
- net
expose:
- 1337
ports:
- 8081:8080
- 1337:1337
- 7900:7900
volumes:
- ${PWD}/data/gpt4free/har_and_cookies:/app/har_and_cookies
- ${PWD}/data/gpt4free/generated_images:/app/generated_images
environment:
TZ: Asia/Shanghai
CHROME_FLAGS: --no-sandbox
labels:
- traefik.enable=false

# Try Rclone(rc) instead!
# clouddrive2:
# image: cloudnas/clouddrive2
# container_name: clouddrive2
# network_mode: host
# volumes:
# - /CloudNAS:/CloudNAS:shared
# - ${PWD}/data/clouddrive2:/Config
# - /usr/local/share/ca-certificates:/usr/local/share/ca-certificates
# environment:
# TZ: Asia/Shanghai
# CLOUDDRIVE_HOME: /Config
# devices:
# - /dev/fuse:/dev/fuse
# restart: unless-stopped
# pid: host
# privileged: true
2 changes: 1 addition & 1 deletion src/_4gtv/disable_cron
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Disable4gtvCron()
{
if crontab -l | grep -q "/usr/local/bin/tv 4g -" 2> /dev/null
if crontab -l | grep -q "$AIOS_PREFIX/bin/tv 4g -" 2> /dev/null
then
crontab -l > "$IPTV_ROOT/cron_tmp" 2> /dev/null || true
sed -i "/\/usr\/local\/bin\/tv 4g -/d" "$IPTV_ROOT/cron_tmp"
Expand Down
4 changes: 2 additions & 2 deletions src/_4gtv/enable_cron
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Enable4gtvCron()
{
if crontab -l | grep -q "/usr/local/bin/tv 4g -" 2> /dev/null
if crontab -l | grep -q "$AIOS_PREFIX/bin/tv 4g -" 2> /dev/null
then
Println "$error 定时任务 (每5天注册账号) 已开启 !\n"
else
crontab -l > "$IPTV_ROOT/cron_tmp" 2> /dev/null || true
printf '%s\n' "0 0 */5 * * /usr/local/bin/tv 4g -" >> "$IPTV_ROOT/cron_tmp"
printf '%s\n' "0 0 */5 * * $AIOS_PREFIX/bin/tv 4g -" >> "$IPTV_ROOT/cron_tmp"
crontab "$IPTV_ROOT/cron_tmp" > /dev/null
rm -f "$IPTV_ROOT/cron_tmp"
Println "$info 定时任务 (每5天注册账号) 开启成功\n"
Expand Down
2 changes: 1 addition & 1 deletion src/_4gtv/use_proxy
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Use4gtvProxy()
d_4gtv_proxy=${d_4gtv_proxy:-$d_proxy}
Println "$tip 可以使用脚本自带的 v2ray 管理面板添加代理, 可以输入 omit 省略此选项"
inquirer text_input "请输入 4gtv 代理, 比如 http://username:[email protected]:5555 : " _4gtv_proxy "${d_4gtv_proxy:-$i18n_blank}"
if [ "$_4gtv_proxy" == "omit" ] || [ "$_4gtv_proxy" == "$i18n_blank" ]
if [ -z "$_4gtv_proxy" ] || [ "$_4gtv_proxy" == "omit" ]
then
_4gtv_proxy=""
_4gtv_proxy_command=()
Expand Down
5 changes: 0 additions & 5 deletions src/alist/acc
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,6 @@ AlistAccAdd()
echo
inquirer text_input "输入密码" alist_acc_password "$i18n_blank"

if [ "$alist_acc_password" == "$i18n_blank" ]
then
alist_acc_password=""
fi

new_acc=$(
$JQ_FILE -n --arg username "$alist_acc_username" --arg password "$alist_acc_password" \
'{
Expand Down
Loading

0 comments on commit 086a9b4

Please sign in to comment.