Commit fa3eb11b authored by JzoNg's avatar JzoNg

old app do not support duplicate and export dsl

parent beff31b0
...@@ -177,7 +177,7 @@ const AppCard = ({ app, onRefresh }: AppCardProps) => { ...@@ -177,7 +177,7 @@ const AppCard = ({ app, onRefresh }: AppCardProps) => {
<span className={s.actionName}>{t('common.operation.settings')}</span> <span className={s.actionName}>{t('common.operation.settings')}</span>
</button> </button>
<Divider className="!my-1" /> <Divider className="!my-1" />
{app.mode !== 'completion' && ( {(app.mode === 'workflow' || app.mode === 'agent-chat' || app.mode === 'advanced-chat' || (app.mode === 'chat' && detailState.detail?.model_config.prompt_type === 'simple')) && (
<> <>
<button className={s.actionItem} onClick={onClickDuplicate} disabled={detailState.loading}> <button className={s.actionItem} onClick={onClickDuplicate} disabled={detailState.loading}>
<span className={s.actionName}>{t('app.duplicate')}</span> <span className={s.actionName}>{t('app.duplicate')}</span>
...@@ -221,6 +221,10 @@ const AppCard = ({ app, onRefresh }: AppCardProps) => { ...@@ -221,6 +221,10 @@ const AppCard = ({ app, onRefresh }: AppCardProps) => {
<div className={style.listItemHeadingContent}>{app.name}</div> <div className={style.listItemHeadingContent}>{app.name}</div>
</div> </div>
{isCurrentWorkspaceManager && <CustomPopover {isCurrentWorkspaceManager && <CustomPopover
onTriggerClick={() => {
if (app.mode === 'chat' && !detailState.detail)
getAppDetail()
}}
htmlContent={<Operations />} htmlContent={<Operations />}
position="br" position="br"
trigger="click" trigger="click"
......
...@@ -177,7 +177,10 @@ const AppInfo = ({ expand }: IAppInfoProps) => { ...@@ -177,7 +177,10 @@ const AppInfo = ({ expand }: IAppInfoProps) => {
</> </>
)} )}
{appDetail.mode === 'completion' && ( {appDetail.mode === 'completion' && (
<div className='shrink-0 px-1 border bg-white border-[rgba(0,0,0,0.08)] rounded-[5px] truncate'>{t('app.types.completion').toUpperCase()}</div> <>
<div className='shrink-0 px-1 border bg-white border-[rgba(0,0,0,0.08)] rounded-[5px] truncate'>{t('app.types.completion').toUpperCase()}</div>
<div title={t('app.newApp.basic') || ''} className='px-1 border bg-white border-[rgba(0,0,0,0.08)] rounded-[5px] truncate'>{(t('app.newApp.basic').toUpperCase())}</div>
</>
)} )}
{appDetail.mode === 'workflow' && ( {appDetail.mode === 'workflow' && (
<div className='shrink-0 px-1 border bg-white border-[rgba(0,0,0,0.08)] rounded-[5px] truncate'>{t('app.types.workflow').toUpperCase()}</div> <div className='shrink-0 px-1 border bg-white border-[rgba(0,0,0,0.08)] rounded-[5px] truncate'>{t('app.types.workflow').toUpperCase()}</div>
...@@ -213,7 +216,10 @@ const AppInfo = ({ expand }: IAppInfoProps) => { ...@@ -213,7 +216,10 @@ const AppInfo = ({ expand }: IAppInfoProps) => {
</> </>
)} )}
{appDetail.mode === 'completion' && ( {appDetail.mode === 'completion' && (
<div className='shrink-0 px-1 border bg-white border-[rgba(0,0,0,0.08)] rounded-[5px] truncate'>{t('app.types.completion').toUpperCase()}</div> <>
<div className='shrink-0 px-1 border bg-white border-[rgba(0,0,0,0.08)] rounded-[5px] truncate'>{t('app.types.completion').toUpperCase()}</div>
<div title={t('app.newApp.basic') || ''} className='px-1 border bg-white border-[rgba(0,0,0,0.08)] rounded-[5px] truncate'>{(t('app.newApp.basic').toUpperCase())}</div>
</>
)} )}
{appDetail.mode === 'workflow' && ( {appDetail.mode === 'workflow' && (
<div className='shrink-0 px-1 border bg-white border-[rgba(0,0,0,0.08)] rounded-[5px] truncate'>{t('app.types.workflow').toUpperCase()}</div> <div className='shrink-0 px-1 border bg-white border-[rgba(0,0,0,0.08)] rounded-[5px] truncate'>{t('app.types.workflow').toUpperCase()}</div>
......
...@@ -441,7 +441,7 @@ const Configuration: FC = () => { ...@@ -441,7 +441,7 @@ const Configuration: FC = () => {
model_id: model.name, model_id: model.name,
mode: model.mode, mode: model.mode,
configs: { configs: {
prompt_template: modelConfig.pre_prompt, prompt_template: modelConfig.pre_prompt || '',
prompt_variables: userInputsFormToPromptVariables( prompt_variables: userInputsFormToPromptVariables(
[ [
...modelConfig.user_input_form, ...modelConfig.user_input_form,
......
...@@ -17,6 +17,7 @@ type IPopover = { ...@@ -17,6 +17,7 @@ type IPopover = {
btnElement?: string | React.ReactNode btnElement?: string | React.ReactNode
btnClassName?: string | ((open: boolean) => string) btnClassName?: string | ((open: boolean) => string)
manualClose?: boolean manualClose?: boolean
onTriggerClick?: () => void
} }
const timeoutDuration = 100 const timeoutDuration = 100
...@@ -30,6 +31,7 @@ export default function CustomPopover({ ...@@ -30,6 +31,7 @@ export default function CustomPopover({
className, className,
btnClassName, btnClassName,
manualClose, manualClose,
onTriggerClick,
}: IPopover) { }: IPopover) {
const buttonRef = useRef<HTMLButtonElement>(null) const buttonRef = useRef<HTMLButtonElement>(null)
const timeOutRef = useRef<NodeJS.Timeout | null>(null) const timeOutRef = useRef<NodeJS.Timeout | null>(null)
...@@ -66,6 +68,10 @@ export default function CustomPopover({ ...@@ -66,6 +68,10 @@ export default function CustomPopover({
? btnClassName ? btnClassName
: btnClassName?.(open) : btnClassName?.(open)
}`} }`}
onClick={() => {
if (!open)
onTriggerClick && onTriggerClick()
}}
> >
{btnElement} {btnElement}
</Popover.Button> </Popover.Button>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment