From e07ba7cfdb613e4643592749f7394fd20e16758d Mon Sep 17 00:00:00 2001 From: williamhliu <137068196+williamhliu@users.noreply.github.com> Date: Thu, 12 Sep 2024 20:32:01 +0800 Subject: [PATCH] (improvement)(chat-sdk) modify sql field and plugin card width (#1662) --- .../src/components/ChatItem/SqlItem.tsx | 18 +++++++++--------- .../src/components/ChatMsg/WebPage/index.tsx | 8 ++++++-- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/webapp/packages/chat-sdk/src/components/ChatItem/SqlItem.tsx b/webapp/packages/chat-sdk/src/components/ChatItem/SqlItem.tsx index cc8fa04ce..961b8ae16 100644 --- a/webapp/packages/chat-sdk/src/components/ChatItem/SqlItem.tsx +++ b/webapp/packages/chat-sdk/src/components/ChatItem/SqlItem.tsx @@ -49,7 +49,7 @@ const SqlItem: React.FC = ({ return null; } - const { schema, linking, priorExts } = llmReq || {}; + const { schema, terms, priorExts } = llmReq || {}; const fewShots = (Object.values(llmResp?.sqlRespMap || {})[0] as any)?.fewShots || []; @@ -57,9 +57,9 @@ const SqlItem: React.FC = ({ return ` Schema映射 ${schema?.fieldNameList?.length > 0 ? `名称:${schema.fieldNameList.join('、')}` : ''}${ - linking?.length > 0 + schema?.values?.length > 0 ? ` -取值:${linking +取值:${schema.values .map((item: any) => { return `${item.fieldName}: ${item.fieldValue}`; }) @@ -71,9 +71,9 @@ ${schema?.fieldNameList?.length > 0 ? `名称:${schema.fieldNameList.join('、 附加:${priorExts}` : '' }${ - schema?.terms?.length > 0 + terms?.length > 0 ? ` -术语:${schema.terms +术语:${terms .map((item: any) => { return `${item.name}${item.alias?.length > 0 ? `(${item.alias.join(',')})` : ''}: ${ item.description @@ -253,11 +253,11 @@ ${format(sqlInfo.querySQL)} )} - {linking?.length > 0 && ( + {schema?.values?.length > 0 && (
取值:
- {linking + {schema.values .map((item: any) => { return `${item.fieldName}: ${item.fieldValue}`; }) @@ -271,11 +271,11 @@ ${format(sqlInfo.querySQL)}
{priorExts}
)} - {schema?.terms?.length > 0 && ( + {terms?.length > 0 && (
术语:
- {schema.terms + {terms .map((item: any) => { return `${item.name}${ item.alias?.length > 0 ? `(${item.alias.join(',')})` : '' diff --git a/webapp/packages/chat-sdk/src/components/ChatMsg/WebPage/index.tsx b/webapp/packages/chat-sdk/src/components/ChatMsg/WebPage/index.tsx index f9b7734c1..9a3e2b3f9 100644 --- a/webapp/packages/chat-sdk/src/components/ChatMsg/WebPage/index.tsx +++ b/webapp/packages/chat-sdk/src/components/ChatMsg/WebPage/index.tsx @@ -1,6 +1,6 @@ import { useCallback, useEffect, useState } from 'react'; import { MsgDataType } from '../../../common/type'; -import { getToken, isProd } from '../../../utils/utils'; +import { getToken, isMobile, isProd } from '../../../utils/utils'; import { webPageHost } from '../../../common/env'; type Props = { @@ -111,7 +111,11 @@ const WebPage: React.FC = ({ id, data }) => { id={`reportIframe_${id}`} name={`reportIframe_${id}`} src={pluginUrl} - style={{ width: '100%', height, border: 'none' }} + style={{ + width: isMobile ? 'calc(100vw - 20px)' : 'calc(100vw - 410px)', + height, + border: 'none', + }} title="reportIframe" allowFullScreen />