diff --git a/client/src/index.tsx b/client/src/index.tsx index 590a8ad..127fcf3 100644 --- a/client/src/index.tsx +++ b/client/src/index.tsx @@ -7,6 +7,7 @@ import Test from './pages/Test.tsx' import Bookshelf from './pages/book/Bookshelf.tsx' import Book from './pages/book/Book.tsx' import Chapter from './pages/book/Chapter.tsx' +import Creator from './pages/Creator.tsx' const routes: RouteObject[] = [ { @@ -34,6 +35,10 @@ const routes: RouteObject[] = [ }, ], }, + { + path: 'creator', + Component: Creator, + }, { path: 'test', Component: Test, diff --git a/client/src/pages/Creator.tsx b/client/src/pages/Creator.tsx new file mode 100644 index 0000000..185fd49 --- /dev/null +++ b/client/src/pages/Creator.tsx @@ -0,0 +1,182 @@ +import React from 'react' +import {amisRender, commonInfo, horizontalFormOptions} from '../util/amis.tsx' + +function Creator() { + return ( +
+ {amisRender( + { + type: 'page', + title: 'AI创作', + body: [ + { + debug: true, + type: 'form', + ...horizontalFormOptions(), + wrapWithPanel: false, + canAccessSuperData: false, + body: [ + { + type: 'textarea', + name: 'outline', + label: '故事概述', + clearable: true, + required: true, + trimContents: true, + showCounter: true, + }, + { + type: 'textarea', + name: 'world', + label: '世界观', + clearable: true, + required: true, + trimContents: true, + showCounter: true, + }, + { + type: 'input-tag', + name: 'tags', + label: '标签', + placeholder: '', + clearable: true, + source: `${commonInfo.baseUrl}/book/tags`, + max: 10, + joinValues: false, + extractValue: true, + }, + { + type: 'combo', + name: 'characters', + label: '故事人物', + multiLine: true, + addable: true, + removable: true, + multiple: true, + subFormMode: 'horizontal', + subFormHorizontal: { + leftFixed: 'sm', + }, + items: [ + { + type: 'uuid', + name: 'id', + }, + { + type: 'input-text', + name: 'name', + label: '名称', + clearable: true, + required: true, + trimContents: true, + }, + { + type: 'select', + name: 'sex', + label: '性别', + required: true, + options: [ + { + label: '男', + value: 'male', + }, + { + label: '女', + value: 'female', + }, + ], + }, + { + type: 'input-number', + name: 'age', + label: '年龄', + min: 10, + step: 1, + precision: 0, + required: true, + }, + { + type: 'textarea', + name: 'appearance', + label: '外形', + clearable: true, + required: true, + trimContents: true, + showCounter: true, + }, + { + type: 'textarea', + name: 'disposition', + label: '性格', + clearable: true, + required: true, + trimContents: true, + showCounter: true, + }, + { + type: 'textarea', + name: 'clothes', + label: '衣着', + clearable: true, + trimContents: true, + showCounter: true, + }, + { + type: 'textarea', + name: 'experience', + label: '经历', + clearable: true, + trimContents: true, + showCounter: true, + }, + { + type: 'textarea', + name: 'family', + label: '家庭', + clearable: true, + trimContents: true, + showCounter: true, + }, + { + type: 'input-kvs', + name: 'extra2', + label: '更多信息', + draggable: false, + keyItem: { + type: 'input-text', + label: '属性名称', + clearable: true, + trimContents: true, + mode: 'horizontal', + horizontal: { + leftFixed: 'sm', + }, + }, + valueItems: [ + { + type: 'textarea', + name: 'value', + label: '属性内容', + clearable: true, + required: true, + trimContents: true, + showCounter: true, + mode: 'horizontal', + horizontal: { + leftFixed: 'sm', + }, + }, + ], + }, + ], + }, + ], + }, + ], + }, + )} +
+ ) +} + +export default React.memo(Creator) \ No newline at end of file diff --git a/client/src/pages/Root.tsx b/client/src/pages/Root.tsx index 8ccf863..403ccba 100644 --- a/client/src/pages/Root.tsx +++ b/client/src/pages/Root.tsx @@ -1,4 +1,4 @@ -import {BookOutlined, DeploymentUnitOutlined, InfoCircleOutlined} from '@ant-design/icons' +import {BookOutlined, DeploymentUnitOutlined, EditOutlined, InfoCircleOutlined} from '@ant-design/icons' import {type AppItemProps, ProLayout} from '@ant-design/pro-components' import {ConfigProvider} from 'antd' import React, {useMemo} from 'react' @@ -30,6 +30,11 @@ const menus = { name: '书架', icon: , }, + { + path: '/creator', + name: '创作', + icon: , + }, { path: '/test', name: '测试',