#ifndef CHATOPERATOR_H
#define CHATOPERATOR_H

#include <memory>
#include <QObject>

#include <kylin-ai/ai-base/nlp.h>
#include <kylin-ai/ai-base/modelconfig.h>

enum TartgetType{
    RECVMSG = 0,
    SUMMARY
};

class ChatOperator : public QObject
{
    Q_OBJECT
public:
    explicit ChatOperator(QObject *parent = nullptr);
    ~ChatOperator();

    bool reInitSession();
    void clearSession();
    void stopChat();
    bool sendMessage(const QString &message);
    TartgetType target = RECVMSG;

    void notifyUI(const QString &message, bool is_end, int index);
    void notifySummary(const QString &message, bool is_end);

    void setActor(int actorId);

signals:
    void reply(const QString &message, bool is_end, int index);
    void sigSendMessageError();
    void sigSessionCompleted();
    void sigGenerateSummary(const QString &message, bool is_end, int index);

private:
    class Private;
    std::shared_ptr<Private> d;


    bool initModelVendor();
    bool initSession();
    void closeSession();
};

#endif // CHATOPERATOR_H
