From fa837b2dfdb0cd4804fcccc78f4f1d909be82ad1 Mon Sep 17 00:00:00 2001 From: zhuhao <37029601+hwzhuhao@users.noreply.github.com> Date: Mon, 30 Sep 2024 17:14:13 +0800 Subject: [PATCH 1/2] fix: fix the issue with the system model configuration update (#8923) --- api/controllers/console/workspace/models.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/api/controllers/console/workspace/models.py b/api/controllers/console/workspace/models.py index dc88f6b812..3138a260b3 100644 --- a/api/controllers/console/workspace/models.py +++ b/api/controllers/console/workspace/models.py @@ -72,8 +72,9 @@ class DefaultModelApi(Resource): provider=model_setting["provider"], model=model_setting["model"], ) - except Exception: - logging.warning(f"{model_setting['model_type']} save error") + except Exception as ex: + logging.exception(f"{model_setting['model_type']} save error: {ex}") + raise ex return {"result": "success"} From 1af4ca344ede6f2ee8d97d0171241f0995200c5e Mon Sep 17 00:00:00 2001 From: KVOJJJin Date: Mon, 30 Sep 2024 17:18:47 +0800 Subject: [PATCH 2/2] Feat: add debounce for search in logs (#8924) --- web/app/components/app/annotation/index.tsx | 8 +++++--- web/app/components/app/log/index.tsx | 14 ++++++++------ web/app/components/app/workflow-log/index.tsx | 10 ++++++---- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/web/app/components/app/annotation/index.tsx b/web/app/components/app/annotation/index.tsx index c66aaef6ce..0bdd12c550 100644 --- a/web/app/components/app/annotation/index.tsx +++ b/web/app/components/app/annotation/index.tsx @@ -3,6 +3,7 @@ import type { FC } from 'react' import React, { useEffect, useState } from 'react' import { useTranslation } from 'react-i18next' import { Pagination } from 'react-headless-pagination' +import { useDebounce } from 'ahooks' import { ArrowLeftIcon, ArrowRightIcon } from '@heroicons/react/24/outline' import Toast from '../../base/toast' import Filter from './filter' @@ -67,10 +68,11 @@ const Annotation: FC = ({ const [queryParams, setQueryParams] = useState({}) const [currPage, setCurrPage] = React.useState(0) + const debouncedQueryParams = useDebounce(queryParams, { wait: 500 }) const query = { page: currPage + 1, limit: APP_PAGE_LIMIT, - keyword: queryParams.keyword || '', + keyword: debouncedQueryParams.keyword || '', } const [controlUpdateList, setControlUpdateList] = useState(Date.now()) @@ -232,8 +234,8 @@ const Annotation: FC = ({ middlePagesSiblingCount={1} setCurrentPage={setCurrPage} totalPages={Math.ceil(total / APP_PAGE_LIMIT)} - truncatableClassName="w-8 px-0.5 text-center" - truncatableText="..." + truncableClassName="w-8 px-0.5 text-center" + truncableText="..." > = ({ appDetail }) => { sort_by: '-created_at', }) const [currPage, setCurrPage] = React.useState(0) + const debouncedQueryParams = useDebounce(queryParams, { wait: 500 }) // Get the app type first const isChatMode = appDetail.mode !== 'completion' @@ -66,14 +68,14 @@ const Logs: FC = ({ appDetail }) => { const query = { page: currPage + 1, limit: APP_PAGE_LIMIT, - ...(queryParams.period !== 'all' + ...(debouncedQueryParams.period !== 'all' ? { - start: dayjs().subtract(queryParams.period as number, 'day').startOf('day').format('YYYY-MM-DD HH:mm'), + start: dayjs().subtract(debouncedQueryParams.period as number, 'day').startOf('day').format('YYYY-MM-DD HH:mm'), end: dayjs().endOf('day').format('YYYY-MM-DD HH:mm'), } : {}), - ...(isChatMode ? { sort_by: queryParams.sort_by } : {}), - ...omit(queryParams, ['period']), + ...(isChatMode ? { sort_by: debouncedQueryParams.sort_by } : {}), + ...omit(debouncedQueryParams, ['period']), } const getWebAppType = (appType: AppMode) => { @@ -119,8 +121,8 @@ const Logs: FC = ({ appDetail }) => { middlePagesSiblingCount={1} setCurrentPage={setCurrPage} totalPages={Math.ceil(total / APP_PAGE_LIMIT)} - truncatableClassName="w-8 px-0.5 text-center" - truncatableText="..." + truncableClassName="w-8 px-0.5 text-center" + truncableText="..." > = ({ appDetail }) => { const { t } = useTranslation() const [queryParams, setQueryParams] = useState({ status: 'all' }) const [currPage, setCurrPage] = React.useState(0) + const debouncedQueryParams = useDebounce(queryParams, { wait: 500 }) const query = { page: currPage + 1, limit: APP_PAGE_LIMIT, - ...(queryParams.status !== 'all' ? { status: queryParams.status } : {}), - ...(queryParams.keyword ? { keyword: queryParams.keyword } : {}), + ...(debouncedQueryParams.status !== 'all' ? { status: debouncedQueryParams.status } : {}), + ...(debouncedQueryParams.keyword ? { keyword: debouncedQueryParams.keyword } : {}), } const getWebAppType = (appType: AppMode) => { @@ -93,8 +95,8 @@ const Logs: FC = ({ appDetail }) => { middlePagesSiblingCount={1} setCurrentPage={setCurrPage} totalPages={Math.ceil(total / APP_PAGE_LIMIT)} - truncatableClassName="w-8 px-0.5 text-center" - truncatableText="..." + truncableClassName="w-8 px-0.5 text-center" + truncableText="..." >