package com.education.workflow;

import com.education.workflow.iface.IContext;
import com.education.workflow.iface.IPromptOptimizer;
import org.nustaq.serialization.annotations.Serialize;
import org.springframework.stereotype.Component;

import java.io.Serializable;
import java.util.List;

@Component
public class DefPromptOptimizer implements IPromptOptimizer {

    //优化提示词
    @Override
    public List<IContext> optimize(List<IContext> ctx, String prompt) {
       Serializable s =  prompt;
        ctx.add((IContext) s);
        return ctx;
    }

    @Override
    public IContext flat(List<IContext> ctx) {
        StringBuffer sb = new StringBuffer();
        for (IContext c : ctx) {
            sb.append(c);
        }
        Serializable c = sb.toString();
        return (IContext) c;
    }
}
