feat: 增加AI按钮
This commit is contained in:
@@ -1,5 +1,32 @@
|
||||
import React from 'react'
|
||||
import {amisRender, commonInfo, horizontalFormOptions} from '../util/amis.tsx'
|
||||
import {type Schema, uuid} from 'amis'
|
||||
|
||||
const aiToolbar = (component: Schema): Schema[] => {
|
||||
const id = uuid()
|
||||
return [
|
||||
{
|
||||
...component,
|
||||
componentId: id,
|
||||
},
|
||||
{
|
||||
className: 'text-right',
|
||||
type: 'button-toolbar',
|
||||
buttons: [
|
||||
{
|
||||
type: 'action',
|
||||
label: 'AI 生成',
|
||||
icon: 'fa fa-brain',
|
||||
},
|
||||
{
|
||||
type: 'action',
|
||||
label: 'AI 润色',
|
||||
icon: 'fa fa-edit',
|
||||
},
|
||||
],
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
function Creator() {
|
||||
return (
|
||||
@@ -16,7 +43,7 @@ function Creator() {
|
||||
wrapWithPanel: false,
|
||||
canAccessSuperData: false,
|
||||
body: [
|
||||
{
|
||||
...aiToolbar({
|
||||
type: 'textarea',
|
||||
name: 'outline',
|
||||
label: '故事概述',
|
||||
@@ -24,8 +51,8 @@ function Creator() {
|
||||
required: true,
|
||||
trimContents: true,
|
||||
showCounter: true,
|
||||
},
|
||||
{
|
||||
}),
|
||||
...aiToolbar({
|
||||
type: 'textarea',
|
||||
name: 'world',
|
||||
label: '世界观',
|
||||
@@ -33,7 +60,7 @@ function Creator() {
|
||||
required: true,
|
||||
trimContents: true,
|
||||
showCounter: true,
|
||||
},
|
||||
}),
|
||||
{
|
||||
type: 'input-tag',
|
||||
name: 'tags',
|
||||
@@ -58,18 +85,14 @@ function Creator() {
|
||||
leftFixed: 'sm',
|
||||
},
|
||||
items: [
|
||||
{
|
||||
type: 'uuid',
|
||||
name: 'id',
|
||||
},
|
||||
{
|
||||
...aiToolbar({
|
||||
type: 'input-text',
|
||||
name: 'name',
|
||||
label: '名称',
|
||||
clearable: true,
|
||||
required: true,
|
||||
trimContents: true,
|
||||
},
|
||||
}),
|
||||
{
|
||||
type: 'select',
|
||||
name: 'sex',
|
||||
@@ -95,7 +118,7 @@ function Creator() {
|
||||
precision: 0,
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
...aiToolbar({
|
||||
type: 'textarea',
|
||||
name: 'appearance',
|
||||
label: '外形',
|
||||
@@ -103,8 +126,9 @@ function Creator() {
|
||||
required: true,
|
||||
trimContents: true,
|
||||
showCounter: true,
|
||||
},
|
||||
{
|
||||
}),
|
||||
...aiToolbar({
|
||||
componentId: 'd8eecb59-153d-4f5e-97b7-a52f4dc2dc58',
|
||||
type: 'textarea',
|
||||
name: 'disposition',
|
||||
label: '性格',
|
||||
@@ -112,31 +136,31 @@ function Creator() {
|
||||
required: true,
|
||||
trimContents: true,
|
||||
showCounter: true,
|
||||
},
|
||||
{
|
||||
}),
|
||||
...aiToolbar({
|
||||
type: 'textarea',
|
||||
name: 'clothes',
|
||||
label: '衣着',
|
||||
clearable: true,
|
||||
trimContents: true,
|
||||
showCounter: true,
|
||||
},
|
||||
{
|
||||
}),
|
||||
...aiToolbar({
|
||||
type: 'textarea',
|
||||
name: 'experience',
|
||||
label: '经历',
|
||||
clearable: true,
|
||||
trimContents: true,
|
||||
showCounter: true,
|
||||
},
|
||||
{
|
||||
}),
|
||||
...aiToolbar({
|
||||
type: 'textarea',
|
||||
name: 'family',
|
||||
label: '家庭',
|
||||
clearable: true,
|
||||
trimContents: true,
|
||||
showCounter: true,
|
||||
},
|
||||
}),
|
||||
{
|
||||
type: 'input-kvs',
|
||||
name: 'extra2',
|
||||
@@ -152,8 +176,7 @@ function Creator() {
|
||||
leftFixed: 'sm',
|
||||
},
|
||||
},
|
||||
valueItems: [
|
||||
{
|
||||
valueItems: aiToolbar({
|
||||
type: 'textarea',
|
||||
name: 'value',
|
||||
label: '属性内容',
|
||||
@@ -165,8 +188,7 @@ function Creator() {
|
||||
horizontal: {
|
||||
leftFixed: 'sm',
|
||||
},
|
||||
},
|
||||
],
|
||||
}),
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user