easyai-plugin-dev-kit/composables/worklfow/node/Markdown2HtmlNode.ts
2025-10-06 16:08:44 +08:00

53 lines
1.6 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { NodeCategoryEnum, PluginBaseNode } from "./PluginBaseNode";
import {
Markdown2Html
} from '#components'
import { NodeTypeEnum } from "~/composables/worklfow/node/node.interface";
export default class Markdown2HtmlNode extends PluginBaseNode {
static override nodeType = NodeTypeEnum.Markdown2Html // 节点类型
static override getNodeList() {
return [
{
type: Markdown2HtmlNode.nodeType, // 节点类型
label: 'Markdown转HTML', // 标签
description: 'Markdown转HTML', // 描述
category: NodeCategoryEnum.BASE, // 分类
icon: 'material-symbols-light:markdown-paste' // 图标
}
]
}
initData() {
// 数据类型 IApiPluginNodeData
return {
method: 'POST', // 请求方法
url: 'http://localhost:3200/plugins/api/markdown2html', // 请求地址,节点的业务逻辑,需要在接口中完成
body: {
markdown: '' // 接口请求体内容输入的markdown内容
},
headers: {
'Content-Type': 'application/json'
// 依据接口自行扩展,认证等信息
}
} // 初始化数据
}
/**
* 输入信息关联父节点产出的数据类型及数据路径
*/
override createOutputSpec(): INodeOutputSpec {
return {
type: 'text', // 文本类型
defaultPath: ['output_content', '*', 'content'] // 数据路径,文本为 ['output_content', '*', 'content'],媒体类型为 ['output_content', '*', 'url']
}
}
// 画布节点 UI
static override renderNode() {
return Markdown2Html // 节点组件
}
}