const { ChatZhipuAI } = require('@langchain/community/chat_models/zhipuai'); const { HumanMessage } = require('@langchain/core/messages'); const { GlmModelProvider } = require('./provider/model/glm'); const { RunnableConfig } = require('@langchain/core/runnables'); const { extractCodeBlocks } = require('./provider/utils'); const ZhipuAI = require('./provider/base/ZhipuAPIModel'); const ZHIPU_AI_KEY = require('../../config').ZHIPU_AI_KEY; class AiService { async buildGeneratePrompt({ message }) { const codePrompt = ` You are a low-code component development expert. Your task is to help me generate two files for a low-code development module: index.jsx and config.js. The index.jsx file should define the structure of the component using React and Ant Design, and the config.js file should specify the component's property configurations. Here’s an example of a login form component: index.jsx file: // jsx export default ({ id, type, config, onClick, onDateChange,onTextChange }, ref) => { const { useState } = window.React; const { Button, Checkbox, ColorPicker, DatePicker, Form, Input, InputNumber, Radio, Select, Slider, Switch, } = window.antd; const { RangePicker } = DatePicker; const { TextArea } = Input; const [dateFormat, setDateFormat] = useState( config.props.dateFormat || 'YYYY-MM-DD HH:mm:ss' ); const onDatePickerChange = (date, dateString) => { onDateChange && onDateChange(date, dateString, dateFormat); }; const onFinish = (values) => { onClick && onClick(values); }; return (
Checkbox Apple Pear setDateFormat(e.target.value)} />