#ifndef SERVICES_ASSISTANT_FILE_INFERENCE_INTERFACE_H
#define SERVICES_ASSISTANT_FILE_INFERENCE_INTERFACE_H

#include <future>
#include <string>

#include "assistant/intentdialoguemanager/dialoguemessage.h"

class FileInferenceInterface {
public:
    virtual ~FileInferenceInterface() = default;

    virtual std::future<DialogueData::FileSearchIdentifier> ragSearchText(const std::string& knowledgeBaseName,
                                                                          const std::string& text, bool useDefault) = 0;

    // 解析文件内容
    virtual DialogueData::CallSuccessIdentifier fileContent(const std::string& knowledgeBaseName,
                                                            const std::string& docFilePath) = 0;

    // 创建知识库
    virtual std::future<std::string> createFileKnowledgeBase() = 0;

    // 删除知识库
    virtual void deleteFileKnowledgeBase(const std::string& knowledgeBaseName) = 0;

    // 更新知识库
    virtual DialogueData::FileSearchIdentifier updateFileKnowledgeBase(const std::string& knowledgeBaseName,
                                                                       const std::string& docFilePath) = 0;
};

class TextEmbeddingInterface {
public:
    virtual ~TextEmbeddingInterface() = default;

    // 文本向量化接口
    virtual DialogueCallback::TextEmbeddingResult textVectorization(const std::string& textStr) = 0;

    void setTextEmbeddingCallback(const DialogueCallback::TextEmbeddingCallback& callback) {
        textEmbeddingCallback_ = callback;
    }

protected:
    void callTextEmbeddingCallback(const DialogueCallback::TextEmbeddingResult& textEmbedding) {
        if (textEmbeddingCallback_ != nullptr) {
            textEmbeddingCallback_(textEmbedding);
        }
    }

protected:
    DialogueCallback::TextEmbeddingCallback textEmbeddingCallback_{nullptr};
};

#endif  // SERVICES_ASSISTANT_FILE_INFERENCE_INTERFACE_H
