#!/bin/bash

set -e

# 确保脚本以root权限运行
if [ "$EUID" -ne 0 ]; then
  echo "请以root权限运行此脚本"
  exit 1
fi

# mkdir /usr/share/asr-llm
cd /usr/share/asr-llm

wget https://archive.spacemit.com/spacemit-ai/gguf/Qwen2.5-0.5B-Instruct-Q4_0.gguf
wget https://archive.spacemit.com/spacemit-ai/modelfile/qwen2.5:0.5b.modelfile
ollama create qwen2.5:0.5b -f qwen2.5:0.5b.modelfile

rm -rf /usr/share/asr-llm/qwen2.5:0.5b.modelfile
rm -rf /usr/share/asr-llm/Qwen2.5-0.5B-Instruct-Q4_0.gguf

wget https://archive.spacemit.com/spacemit-ai/gguf/qwen2.5-0.5b-fc-q4_0.gguf
wget https://archive.spacemit.com/spacemit-ai/modelfile/qwen2.5-0.5b-fc.modelfile
ollama create qwen2.5-0.5b-fc -f qwen2.5-0.5b-fc.modelfile

rm -rf /usr/share/asr-llm/qwen2.5-0.5b-fc-q4_0.gguf
rm -rf /usr/share/asr-llm/qwen2.5-0.5b-fc.modelfile

python3 -m venv .asr-llm

pip3 config set global.index-url https://mirrors.aliyun.com/pypi/simple/
# 配置 pip 使用额外的索引 URL
pip3 config set global.extra-index-url https://git.spacemit.com/api/v4/projects/33/packages/pypi/simple

source .asr-llm/bin/activate
pip3 install -r requirements.txt



exit 0