#ifndef CTAI_SESSION_INFO_H
#define CTAI_SESSION_INFO_H

#include <QHBoxLayout>
#include <QTextEdit>
#include <QPushButton>
#include <QMessageBox>
#include <QLabel>
#include <QSplitter>
#include <QListWidget>
#include <QDir>
#include <QFile>
#include "ctai_switch_control.h"
#include "ctai_curl.h"
#include "ctai_history_widget.h"
class ctai_session_info : public QWidget
{
    Q_OBJECT
public:
    ctai_session_info();
    ~ctai_session_info();
private:
    void init_curl();
    void init_layout();
    void init_sub_layout();
    void init_user_btn_layout();
    void init_user_btn_size_tips(QPushButton &btn, QSize, QString);
    void btn_disable_enable(bool);
private:
    QVBoxLayout* mainLayout;
    QSplitter *splitter;
    QWidget *m_sub_systeam_widget;
    QWidget *m_sub_user_widget;

    //信息输出窗口布局
    QListWidget     *m_list_widget;
    ctai_history_widget   *m_session_systeam_info;
    QVBoxLayout     *m_session_systeam_info_layout;
    //用户询问信息布局
    QTextEdit   *m_session_user_edit_info;
    QVBoxLayout *m_session_user_edit_layout;
    //用户询问信息按钮布局
    std::vector<QPushButton *> m_btns;
    QLabel                    *m_stream_mode_tips;
    QLabel                    *m_info_error_tips;
    ctai_switch_control       *m_stream_switch;
    QHBoxLayout               *m_session_user_btn_layout; 
    QVBoxLayout               *m_session_user_group_layout;
    

    //按钮信息
    QStringList m_user_btn_list = {"btn_user_new_chat",
                                   "btn_user_switch_model",
                                   "btn_user_switch_knowledge",
                                   "btn_user_upload_file",
                                   "btn_user_clear_context",
                                   "btn_user_sending_info"};
    QStringList m_user_btn_tips_list = {tr("新建会话"),
                                        tr("切换模型"),
                                        tr("知识库"),
                                        tr("文件"),
                                        tr("清除上下文"),
                                        tr("发送信息")};
    QStringList m_user_btn_icon_list = {":/res/img/btn/btn_new_chat.png",
                                        ":/res/img/btn/btn_switch_model.png",
                                        ":/res/img/btn/btn_knowledge.png",
                                        ":/res/img/btn/btn_upload_file.png",
                                        ":/res/img/btn/btn_clear_context.png",
                                        ":/res/img/btn/btn_sending_info.png"};
    QSpacerItem *sparcer_item = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Fixed);
    ctai_curl   *m_curl;
    model_data  user_model_data;
    curl_opts   curl_opt;
    std::string current_info_id;
    bool        m_stream_mode = false;
private slots:
    void ctai_session_user_sending();
    void ctai_session_postback_info(model_data resp_data);
    void ctai_session_set_steam_mode(bool);
    void ctai_session_curl_state_tips(std::string);
};
#endif // CTAI_SESSION_TABLE_H
