aura-web/src/components/ExternalToolEditor/JsonEditor.tsx

32 lines
943 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

import { Input } from 'antd';
import React from 'react';
interface JsonEditorProps {
/** JSON 文本内容 */
value: string;
/** 内容变化回调 */
onChange: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;
}
/**
* JSON 编辑区域。
* 用户可直接粘贴或编辑完整的工具集配置 JSON修改会自动同步到可视化表单。
*/
export default function JsonEditor({ value, onChange }: JsonEditorProps) {
return (
<div style={{ padding: '4px 0 16px' }}>
<div style={{ marginBottom: 8, color: '#666', fontSize: 12 }}>
JSON
</div>
<Input.TextArea
value={value}
onChange={onChange}
rows={25}
className="agent-editor-code-input"
placeholder="请输入完整的工具集配置 JSON"
style={{ fontFamily: 'monospace' }}
/>
</div>
);
}