/* * Copyright 2025 coze-dev Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import React, { type ComponentProps, Suspense, forwardRef, lazy } from 'react'; import classNames from 'classnames'; import { I18n } from '@coze-arch/i18n'; import { type BotSpace, SpaceType, type DraftBot, } from '@coze-arch/bot-api/developer_api'; import { type UploadValue } from '@coze-common/biz-components/picture-upload'; import { IconTeamDefault } from '@coze-arch/bot-icons'; import { botInputLengthService } from '@coze-agent-ide/bot-input-length-limit'; import { FormTextArea, FormInput, Tag, Form, FormSelect, Avatar, Typography, } from '@coze-arch/coze-design'; import { FormSwitch } from './form-switch'; import s from './index.module.less'; const { Text } = Typography; const LazyReactMarkdown = lazy(() => import('react-markdown')); const ReactMarkdown = (props: ComponentProps) => ( ); export type AgentInfoFormValue = Partial<{ bot_uri: UploadValue; name: string; target: string; spaceId?: string; enableMonetize?: boolean; }>; export interface AgentInfoFormProps { className?: string; mode: 'add' | 'update'; showSpace: boolean; initialValues: Partial; spacesList: BotSpace[]; currentSpaceId?: string; // Current space ID from store hideOperation?: boolean; // hide_operation from store checkErr: boolean; errMsg: string; onValuesChange: (values: AgentInfoFormValue) => void; slot?: React.ReactNode; } export const AgentInfoForm = forwardRef< Form, AgentInfoFormProps >( // eslint-disable-next-line complexity ( { className, mode, showSpace, initialValues, spacesList, currentSpaceId, hideOperation, checkErr, errMsg, onValuesChange, slot, }, ref, ) => ( ref={ref} showValidateIcon={false} className={classNames(s['upload-form'], className)} // Ensure class name is correct onValueChange={values => { onValuesChange(values); }} > botInputLengthService.getValueLength(reactText) } /> {IS_OVERSEA && mode === 'add' ? ( ) : null} {showSpace && mode === 'add' ? ( (
{optionNode.name} {optionNode.name}
)} > {spacesList ?.filter(t => !t.hide_operation) ?.map(item => (
{item.icon_url ? ( ) : ( )}
{item.name}
{item.space_type === SpaceType.Team && ( {I18n.t('develop_team_team')} )}
))}
) : null} {slot} {checkErr ? (
{errMsg ?? I18n.t('publish_audit_pop7')}
) : null} ), );