feisi
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

README

对外提供的方法

run(content: string, context: IPromptExample[]): Promise<IRunResult>;

类型声明

/**
 * @description: 节点类型定义
 */
declare enum EnumFolwNodeType {
    /**
     * 开始节点
     * @example 开始节点
     */
    start = 1000,
    /**
     * 逻辑判断节点
     */
    logic = 1001,
    /**
     * 流程处理节点
     */
    process = 1002,
    /**
     * 分类节点
     */
    classify = 1003,
    /**
     * 随机回复节点
     */
    randomReplyNode = 1004,
    /**
     * 自定义格式节点
     */
    customFormatNode = 1005,
    /**
     * 结束节点
     */
    end = 2000,
    /**
     * 异常节点
     */
    error = 3000,
    /**
     * 多语言节点
     */
    multiLanguage = 4000,
    /**
     * 人工节点
     */
    manual = 5000
}

interface IPromptExample {
    question: string;
    answer: string;
}

interface IClassifyFlowNode {
    text: string;
    nextStep: number;
}

interface IFlowNode {
    /**
     * 节点名称
     * @example 开始节点
     */
    name: string;
    /**
     * 节点类型
     * @example 1000
     */
    type: EnumFolwNodeType;
    /**
     * 节点编码
     * @example 1000
     */
    code: number;
    /**
     * 节点提示文本,用于 AI 提示词
     * @example 请问这段代码的时间复杂度是多少?
     */
    promptText: string;
    /**
     * 下一步节点编码
     * @example 1001
     */
    nextSetp?: number;
    /**
     * 异常节点编码
     * @example 3000
     */
    errorSetp: number;
    /**
     * 是节点编码
     * @example 1002
     */
    yesStep?: number;
    /**
     * 否节点编码
     * @example 3000
     */
    noStep?: number;
    /**
     * 随机回复列表
     * @example ['https://www.google.com','https://www.baidu.com']
     */
    replyList?: string[];
    /**
     * 自定义格式
     * @example {{content}} https://www.google.com
     */
    format?: string;
    /**
     * 分类节点列表
     * @example [{text:'寒暄',nextStep:10002},{text:'提现',nextStep:10003},{text:'其他',nextStep:10004}]
     */
    list?: IClassifyFlowNode[];
    /**
     * 示例
     */
    examples?: IPromptExample[];
    /***
     * 进入了人工节点的提示文本
     */
    manualPromptText?: string;
    /**
     * 是否带上下文
     */
    withContext: boolean;
}

interface ISetp {
    lang: string;
    flowNode: IFlowNode;
    question: string;
    answer: string;
    nextSetpId: number;
}
interface IRunResult {
    code: 200 | 500;
    answer: string;
    setps: ISetp[];
}

Readme

Keywords

none

Package Sidebar

Install

npm i feisi

Weekly Downloads

678

Version

1.0.3

License

MIT

Unpacked Size

53.1 kB

Total Files

8

Last publish

Collaborators

  • pengfeizheng