From d86ef15d9a14a31eeb03357863bdb36417612418 Mon Sep 17 00:00:00 2001 From: JzoNg Date: Thu, 7 Mar 2024 21:39:15 +0800 Subject: [PATCH] add tip for switch --- web/app/components/app-sidebar/app-info.tsx | 38 ++++++++++++++++-- .../{switch-modal => }/completion.png | Bin .../app-sidebar/{switch-modal => }/expert.png | Bin .../components/app-sidebar/style.module.css | 8 ++++ web/i18n/en-US/app.ts | 1 + web/i18n/zh-Hans/app.ts | 1 + 6 files changed, 45 insertions(+), 3 deletions(-) rename web/app/components/app-sidebar/{switch-modal => }/completion.png (100%) rename web/app/components/app-sidebar/{switch-modal => }/expert.png (100%) diff --git a/web/app/components/app-sidebar/app-info.tsx b/web/app/components/app-sidebar/app-info.tsx index 567f9796a9..314429f317 100644 --- a/web/app/components/app-sidebar/app-info.tsx +++ b/web/app/components/app-sidebar/app-info.tsx @@ -4,6 +4,7 @@ import { useContext, useContextSelector } from 'use-context-selector' import cn from 'classnames' import React, { useCallback, useState } from 'react' import AppIcon from '../base/app-icon' +import s from './style.module.css' import { PortalToFollowElem, PortalToFollowElemContent, @@ -39,6 +40,7 @@ const AppInfo = ({ expand }: IAppInfoProps) => { const [showEditModal, setShowEditModal] = useState(false) const [showDuplicateModal, setShowDuplicateModal] = useState(false) const [showConfirmDelete, setShowConfirmDelete] = useState(false) + const [showSwitchTip, setShowSwitchTip] = useState('') const mutateApps = useContextSelector( AppsContext, @@ -191,7 +193,7 @@ const AppInfo = ({ expand }: IAppInfoProps) => { -
+
{/* header */}
@@ -232,7 +234,6 @@ const AppInfo = ({ expand }: IAppInfoProps) => {
{appDetail.description}
)} {/* operations */} -
{ @@ -241,7 +242,7 @@ const AppInfo = ({ expand }: IAppInfoProps) => { }}> {t('app.editApp')}
- {appDetail.mode !== 'completion' && ( + {appDetail.mode !== 'completion' && appDetail.model_config.prompt_type !== 'advanced' && ( <>
{ setOpen(false) @@ -254,6 +255,19 @@ const AppInfo = ({ expand }: IAppInfoProps) => {
)} + {(appDetail.mode === 'completion' || appDetail.model_config.prompt_type === 'advanced') && ( + <> + +
setShowSwitchTip(appDetail.mode)} + onMouseLeave={() => setShowSwitchTip('')} + onClick={() => setShowSwitchTip(appDetail.mode)} + > + {t('app.switch')} +
+ + )}
{ setOpen(false) @@ -264,6 +278,24 @@ const AppInfo = ({ expand }: IAppInfoProps) => {
+ {/* switch tip */} +
+
+
+
{t('app.newApp.advanced')}
+
{t('app.newApp.advancedFor')}
+
{t('app.newApp.advancedDescription')}
+
+
{showEditModal && ( diff --git a/web/app/components/app-sidebar/switch-modal/completion.png b/web/app/components/app-sidebar/completion.png similarity index 100% rename from web/app/components/app-sidebar/switch-modal/completion.png rename to web/app/components/app-sidebar/completion.png diff --git a/web/app/components/app-sidebar/switch-modal/expert.png b/web/app/components/app-sidebar/expert.png similarity index 100% rename from web/app/components/app-sidebar/switch-modal/expert.png rename to web/app/components/app-sidebar/expert.png diff --git a/web/app/components/app-sidebar/style.module.css b/web/app/components/app-sidebar/style.module.css index 77570ef376..722b35bc71 100644 --- a/web/app/components/app-sidebar/style.module.css +++ b/web/app/components/app-sidebar/style.module.css @@ -1,3 +1,11 @@ .sidebar { border-right: 1px solid #F3F4F6; +} + +.completionPic { +background-image: url('./completion.png') +} + +.expertPic { +background-image: url('./expert.png') } \ No newline at end of file diff --git a/web/i18n/en-US/app.ts b/web/i18n/en-US/app.ts index 933a02a6ef..3bcd636457 100644 --- a/web/i18n/en-US/app.ts +++ b/web/i18n/en-US/app.ts @@ -66,6 +66,7 @@ const translation = { ok: 'OK', cancel: 'Cancel', }, + switch: 'Switch to Workflow Orchestrate', } export default translation diff --git a/web/i18n/zh-Hans/app.ts b/web/i18n/zh-Hans/app.ts index 70bdf279e6..3946c99730 100644 --- a/web/i18n/zh-Hans/app.ts +++ b/web/i18n/zh-Hans/app.ts @@ -65,6 +65,7 @@ const translation = { ok: '确认', cancel: '取消', }, + switch: '迁移为工作流编排', } export default translation