#!/bin/bash

# 获取当前脚本所在的绝对路径
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

# 检查是否已经存在名为xinference的screen会话
if screen -ls | grep "intent_recognition_api"; then
    echo "Screen session 'intent_recognition_api' already exists."
else
    # 启动一个名为intent_recognition_api的screen会话，并在其中执行后续命令
    screen -dmS intent_recognition_api bash -c "
        cd \"$SCRIPT_DIR\"
        uv run uvicorn rag2_0.dify.intent_recognition_api:app --host 0.0.0.0 --port 8001 --workers 25
    "

    # 输出提示信息
    echo "Started screen session 'intent_recognition_api' and executed the command."
fi