Commit d86ef15d authored by JzoNg's avatar JzoNg

add tip for switch

parent fa3eb11b
...@@ -4,6 +4,7 @@ import { useContext, useContextSelector } from 'use-context-selector' ...@@ -4,6 +4,7 @@ import { useContext, useContextSelector } from 'use-context-selector'
import cn from 'classnames' import cn from 'classnames'
import React, { useCallback, useState } from 'react' import React, { useCallback, useState } from 'react'
import AppIcon from '../base/app-icon' import AppIcon from '../base/app-icon'
import s from './style.module.css'
import { import {
PortalToFollowElem, PortalToFollowElem,
PortalToFollowElemContent, PortalToFollowElemContent,
...@@ -39,6 +40,7 @@ const AppInfo = ({ expand }: IAppInfoProps) => { ...@@ -39,6 +40,7 @@ const AppInfo = ({ expand }: IAppInfoProps) => {
const [showEditModal, setShowEditModal] = useState(false) const [showEditModal, setShowEditModal] = useState(false)
const [showDuplicateModal, setShowDuplicateModal] = useState(false) const [showDuplicateModal, setShowDuplicateModal] = useState(false)
const [showConfirmDelete, setShowConfirmDelete] = useState(false) const [showConfirmDelete, setShowConfirmDelete] = useState(false)
const [showSwitchTip, setShowSwitchTip] = useState<string>('')
const mutateApps = useContextSelector( const mutateApps = useContextSelector(
AppsContext, AppsContext,
...@@ -191,7 +193,7 @@ const AppInfo = ({ expand }: IAppInfoProps) => { ...@@ -191,7 +193,7 @@ const AppInfo = ({ expand }: IAppInfoProps) => {
</div> </div>
</PortalToFollowElemTrigger> </PortalToFollowElemTrigger>
<PortalToFollowElemContent className='z-[1002]'> <PortalToFollowElemContent className='z-[1002]'>
<div className='w-[320px] bg-white rounded-2xl shadow-xl'> <div className='relative w-[320px] bg-white rounded-2xl shadow-xl'>
{/* header */} {/* header */}
<div className={cn('flex pl-4 pt-3 pr-3', !appDetail.description && 'pb-2')}> <div className={cn('flex pl-4 pt-3 pr-3', !appDetail.description && 'pb-2')}>
<div className='shrink-0 mr-2'> <div className='shrink-0 mr-2'>
...@@ -232,7 +234,6 @@ const AppInfo = ({ expand }: IAppInfoProps) => { ...@@ -232,7 +234,6 @@ const AppInfo = ({ expand }: IAppInfoProps) => {
<div className='px-4 py-2 text-gray-500 text-xs leading-[18px]'>{appDetail.description}</div> <div className='px-4 py-2 text-gray-500 text-xs leading-[18px]'>{appDetail.description}</div>
)} )}
{/* operations */} {/* operations */}
<div></div>
<Divider className="!my-1" /> <Divider className="!my-1" />
<div className="w-full py-1"> <div className="w-full py-1">
<div className='h-9 py-2 px-3 mx-1 flex items-center hover:bg-gray-50 rounded-lg cursor-pointer' onClick={() => { <div className='h-9 py-2 px-3 mx-1 flex items-center hover:bg-gray-50 rounded-lg cursor-pointer' onClick={() => {
...@@ -241,7 +242,7 @@ const AppInfo = ({ expand }: IAppInfoProps) => { ...@@ -241,7 +242,7 @@ const AppInfo = ({ expand }: IAppInfoProps) => {
}}> }}>
<span className='text-gray-700 text-sm leading-5'>{t('app.editApp')}</span> <span className='text-gray-700 text-sm leading-5'>{t('app.editApp')}</span>
</div> </div>
{appDetail.mode !== 'completion' && ( {appDetail.mode !== 'completion' && appDetail.model_config.prompt_type !== 'advanced' && (
<> <>
<div className='h-9 py-2 px-3 mx-1 flex items-center hover:bg-gray-50 rounded-lg cursor-pointer' onClick={() => { <div className='h-9 py-2 px-3 mx-1 flex items-center hover:bg-gray-50 rounded-lg cursor-pointer' onClick={() => {
setOpen(false) setOpen(false)
...@@ -254,6 +255,19 @@ const AppInfo = ({ expand }: IAppInfoProps) => { ...@@ -254,6 +255,19 @@ const AppInfo = ({ expand }: IAppInfoProps) => {
</div> </div>
</> </>
)} )}
{(appDetail.mode === 'completion' || appDetail.model_config.prompt_type === 'advanced') && (
<>
<Divider className="!my-1" />
<div
className='h-9 py-2 px-3 mx-1 flex items-center hover:bg-gray-50 rounded-lg cursor-pointer'
onMouseEnter={() => setShowSwitchTip(appDetail.mode)}
onMouseLeave={() => setShowSwitchTip('')}
onClick={() => setShowSwitchTip(appDetail.mode)}
>
<span className='text-gray-700 text-sm leading-5'>{t('app.switch')}</span>
</div>
</>
)}
<Divider className="!my-1" /> <Divider className="!my-1" />
<div className='group h-9 py-2 px-3 mx-1 flex items-center hover:bg-red-50 rounded-lg cursor-pointer' onClick={() => { <div className='group h-9 py-2 px-3 mx-1 flex items-center hover:bg-red-50 rounded-lg cursor-pointer' onClick={() => {
setOpen(false) setOpen(false)
...@@ -264,6 +278,24 @@ const AppInfo = ({ expand }: IAppInfoProps) => { ...@@ -264,6 +278,24 @@ const AppInfo = ({ expand }: IAppInfoProps) => {
</span> </span>
</div> </div>
</div> </div>
{/* switch tip */}
<div
className={cn(
'hidden absolute left-[324px] top-0 w-[376px] rounded-xl bg-white border-[0.5px] border-[rgba(0,0,0,0.05)] shadow-lg',
showSwitchTip && '!block',
)}
>
<div className={cn(
'w-full h-[256px] bg-center bg-no-repeat bg-contain',
showSwitchTip === 'chat' && s.expertPic,
showSwitchTip === 'completion' && s.completionPic,
)}/>
<div className='px-4 pb-2'>
<div className='text-gray-700 text-md leading-6 font-semibold'>{t('app.newApp.advanced')}</div>
<div className='text-orange-500 text-xs leading-[18px] font-medium'>{t('app.newApp.advancedFor')}</div>
<div className='mt-1 text-gray-500 text-sm leading-5'>{t('app.newApp.advancedDescription')}</div>
</div>
</div>
</div> </div>
</PortalToFollowElemContent> </PortalToFollowElemContent>
{showEditModal && ( {showEditModal && (
......
.sidebar { .sidebar {
border-right: 1px solid #F3F4F6; border-right: 1px solid #F3F4F6;
}
.completionPic {
background-image: url('./completion.png')
}
.expertPic {
background-image: url('./expert.png')
} }
\ No newline at end of file
...@@ -66,6 +66,7 @@ const translation = { ...@@ -66,6 +66,7 @@ const translation = {
ok: 'OK', ok: 'OK',
cancel: 'Cancel', cancel: 'Cancel',
}, },
switch: 'Switch to Workflow Orchestrate',
} }
export default translation export default translation
...@@ -65,6 +65,7 @@ const translation = { ...@@ -65,6 +65,7 @@ const translation = {
ok: '确认', ok: '确认',
cancel: '取消', cancel: '取消',
}, },
switch: '迁移为工作流编排',
} }
export default translation export default translation
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