#!/bin/bash

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

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

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