diff --git a/web/app/components/app/log/empty-element.tsx b/web/app/components/app/log/empty-element.tsx new file mode 100644 index 0000000000..78f32bf922 --- /dev/null +++ b/web/app/components/app/log/empty-element.tsx @@ -0,0 +1,41 @@ +'use client' +import type { FC, SVGProps } from 'react' +import React from 'react' +import Link from 'next/link' +import { Trans, useTranslation } from 'react-i18next' +import { basePath } from '@/utils/var' +import { getRedirectionPath } from '@/utils/app-redirection' +import type { App, AppMode } from '@/types/app' + +const ThreeDotsIcon = ({ className }: SVGProps) => { + return + + +} + +const EmptyElement: FC<{ appDetail: App }> = ({ appDetail }) => { + const { t } = useTranslation() + + const getWebAppType = (appType: AppMode) => { + if (appType !== 'completion' && appType !== 'workflow') + return 'chat' + return appType + } + + return
+
+ {t('appLog.table.empty.element.title')} +
+ , + testLink: , + }} + /> +
+
+
+} + +export default React.memo(EmptyElement) diff --git a/web/app/components/app/log/index.tsx b/web/app/components/app/log/index.tsx index 13be294bef..e556748494 100644 --- a/web/app/components/app/log/index.tsx +++ b/web/app/components/app/log/index.tsx @@ -1,21 +1,19 @@ 'use client' -import type { FC, SVGProps } from 'react' +import type { FC } from 'react' import React, { useState } from 'react' import useSWR from 'swr' -import Link from 'next/link' -import { usePathname } from 'next/navigation' import { useDebounce } from 'ahooks' import { omit } from 'lodash-es' import dayjs from 'dayjs' -import { basePath } from '@/utils/var' -import { Trans, useTranslation } from 'react-i18next' +import { useTranslation } from 'react-i18next' import List from './list' import Filter, { TIME_PERIOD_MAPPING } from './filter' +import EmptyElement from './empty-element' import Pagination from '@/app/components/base/pagination' import Loading from '@/app/components/base/loading' import { fetchChatConversations, fetchCompletionConversations } from '@/service/log' import { APP_PAGE_LIMIT } from '@/config' -import type { App, AppMode } from '@/types/app' +import type { App } from '@/types/app' export type ILogsProps = { appDetail: App } @@ -27,30 +25,6 @@ export type QueryParam = { sort_by?: string } -const ThreeDotsIcon = ({ className }: SVGProps) => { - return - - -} - -const EmptyElement: FC<{ appUrl: string }> = ({ appUrl }) => { - const { t } = useTranslation() - const pathname = usePathname() - const pathSegments = pathname.split('/') - pathSegments.pop() - return
-
- {t('appLog.table.empty.element.title')} -
- , testLink: }} - /> -
-
-
-} - const Logs: FC = ({ appDetail }) => { const { t } = useTranslation() const [queryParams, setQueryParams] = useState({ @@ -78,12 +52,6 @@ const Logs: FC = ({ appDetail }) => { ...omit(debouncedQueryParams, ['period']), } - const getWebAppType = (appType: AppMode) => { - if (appType !== 'completion' && appType !== 'workflow') - return 'chat' - return appType - } - // When the details are obtained, proceed to the next request const { data: chatConversations, mutate: mutateChatList } = useSWR(() => isChatMode ? { @@ -110,7 +78,7 @@ const Logs: FC = ({ appDetail }) => { ? : total > 0 ? - : + : } {/* Show Pagination only if the total is more than the limit */} {(total && total > APP_PAGE_LIMIT) diff --git a/web/app/components/app/workflow-log/index.tsx b/web/app/components/app/workflow-log/index.tsx index f58d387d68..c6f9d985ae 100644 --- a/web/app/components/app/workflow-log/index.tsx +++ b/web/app/components/app/workflow-log/index.tsx @@ -1,23 +1,21 @@ 'use client' -import type { FC, SVGProps } from 'react' +import type { FC } from 'react' import React, { useState } from 'react' import useSWR from 'swr' -import { usePathname } from 'next/navigation' import { useDebounce } from 'ahooks' import { omit } from 'lodash-es' import dayjs from 'dayjs' import utc from 'dayjs/plugin/utc' import timezone from 'dayjs/plugin/timezone' -import { Trans, useTranslation } from 'react-i18next' -import Link from 'next/link' +import { useTranslation } from 'react-i18next' import List from './list' -import { basePath } from '@/utils/var' import Filter, { TIME_PERIOD_MAPPING } from './filter' +import EmptyElement from '@/app/components/app/log/empty-element' import Pagination from '@/app/components/base/pagination' import Loading from '@/app/components/base/loading' import { fetchWorkflowLogs } from '@/service/log' import { APP_PAGE_LIMIT } from '@/config' -import type { App, AppMode } from '@/types/app' +import type { App } from '@/types/app' import { useAppContext } from '@/context/app-context' dayjs.extend(utc) @@ -33,29 +31,6 @@ export type QueryParam = { keyword?: string } -const ThreeDotsIcon = ({ className }: SVGProps) => { - return - - -} -const EmptyElement: FC<{ appUrl: string }> = ({ appUrl }) => { - const { t } = useTranslation() - const pathname = usePathname() - const pathSegments = pathname.split('/') - pathSegments.pop() - return
-
- {t('appLog.table.empty.element.title')} -
- , testLink: }} - /> -
-
-
-} - const Logs: FC = ({ appDetail }) => { const { t } = useTranslation() const { userProfile: { timezone } } = useAppContext() @@ -78,12 +53,6 @@ const Logs: FC = ({ appDetail }) => { ...omit(debouncedQueryParams, ['period', 'status']), } - const getWebAppType = (appType: AppMode) => { - if (appType !== 'completion' && appType !== 'workflow') - return 'chat' - return appType - } - const { data: workflowLogs, mutate } = useSWR({ url: `/apps/${appDetail.id}/workflow-app-logs`, params: query, @@ -101,7 +70,7 @@ const Logs: FC = ({ appDetail }) => { ? : total > 0 ? - : + : } {/* Show Pagination only if the total is more than the limit */} {(total && total > APP_PAGE_LIMIT) diff --git a/web/i18n/zh-Hans/app-log.ts b/web/i18n/zh-Hans/app-log.ts index 26c5c915c5..ee44318d1c 100644 --- a/web/i18n/zh-Hans/app-log.ts +++ b/web/i18n/zh-Hans/app-log.ts @@ -30,7 +30,7 @@ const translation = { noOutput: '无输出', element: { title: '这里有人吗', - content: '在这里观测和标注最终用户和 AI 应用程序之间的交互,以不断提高 AI 的准确性。您可以试试 web app 或分享出去,然后返回此页面。', + content: '在这里观测和标注最终用户和 AI 应用程序之间的交互,以不断提高 AI 的准确性。您可以尝试分享测试此Web应用程序,然后返回此页面。', }, }, }, diff --git a/web/i18n/zh-Hant/app-log.ts b/web/i18n/zh-Hant/app-log.ts index d24b4a1cce..a6bc8fa458 100644 --- a/web/i18n/zh-Hant/app-log.ts +++ b/web/i18n/zh-Hant/app-log.ts @@ -29,7 +29,7 @@ const translation = { noOutput: '無輸出', element: { title: '這裡有人嗎', - content: '在這裡觀測和標註終端使用者和 AI 應用程式之間的互動,以不斷提高 AI 的準確性。您可以試試 web app 或分享出去,然後返回此頁面。', + content: '在這裡觀測和標註終端使用者和 AI 應用程式之間的互動,以不斷提高 AI 的準確性。您可以嘗試分享測試此Web應用程序,然後返回此頁面。', }, }, },