(improvement)(chat-sdk) modify sql field and plugin card width (#1662)

This commit is contained in:
williamhliu
2024-09-12 20:32:01 +08:00
committed by GitHub
parent c99d240b65
commit e07ba7cfdb
2 changed files with 15 additions and 11 deletions

View File

@@ -49,7 +49,7 @@ const SqlItem: React.FC<Props> = ({
return null; return null;
} }
const { schema, linking, priorExts } = llmReq || {}; const { schema, terms, priorExts } = llmReq || {};
const fewShots = (Object.values(llmResp?.sqlRespMap || {})[0] as any)?.fewShots || []; const fewShots = (Object.values(llmResp?.sqlRespMap || {})[0] as any)?.fewShots || [];
@@ -57,9 +57,9 @@ const SqlItem: React.FC<Props> = ({
return ` return `
Schema映射 Schema映射
${schema?.fieldNameList?.length > 0 ? `名称:${schema.fieldNameList.join('、')}` : ''}${ ${schema?.fieldNameList?.length > 0 ? `名称:${schema.fieldNameList.join('、')}` : ''}${
linking?.length > 0 schema?.values?.length > 0
? ` ? `
取值:${linking 取值:${schema.values
.map((item: any) => { .map((item: any) => {
return `${item.fieldName}: ${item.fieldValue}`; return `${item.fieldName}: ${item.fieldValue}`;
}) })
@@ -71,9 +71,9 @@ ${schema?.fieldNameList?.length > 0 ? `名称:${schema.fieldNameList.join('、
附加:${priorExts}` 附加:${priorExts}`
: '' : ''
}${ }${
schema?.terms?.length > 0 terms?.length > 0
? ` ? `
术语:${schema.terms 术语:${terms
.map((item: any) => { .map((item: any) => {
return `${item.name}${item.alias?.length > 0 ? `(${item.alias.join(',')})` : ''}: ${ return `${item.name}${item.alias?.length > 0 ? `(${item.alias.join(',')})` : ''}: ${
item.description item.description
@@ -253,11 +253,11 @@ ${format(sqlInfo.querySQL)}
</div> </div>
</div> </div>
)} )}
{linking?.length > 0 && ( {schema?.values?.length > 0 && (
<div className={`${prefixCls}-schema-row`}> <div className={`${prefixCls}-schema-row`}>
<div className={`${prefixCls}-schema-title`}></div> <div className={`${prefixCls}-schema-title`}></div>
<div className={`${prefixCls}-schema-content`}> <div className={`${prefixCls}-schema-content`}>
{linking {schema.values
.map((item: any) => { .map((item: any) => {
return `${item.fieldName}: ${item.fieldValue}`; return `${item.fieldName}: ${item.fieldValue}`;
}) })
@@ -271,11 +271,11 @@ ${format(sqlInfo.querySQL)}
<div className={`${prefixCls}-schema-content`}>{priorExts}</div> <div className={`${prefixCls}-schema-content`}>{priorExts}</div>
</div> </div>
)} )}
{schema?.terms?.length > 0 && ( {terms?.length > 0 && (
<div className={`${prefixCls}-schema-row`}> <div className={`${prefixCls}-schema-row`}>
<div className={`${prefixCls}-schema-title`}></div> <div className={`${prefixCls}-schema-title`}></div>
<div className={`${prefixCls}-schema-content`}> <div className={`${prefixCls}-schema-content`}>
{schema.terms {terms
.map((item: any) => { .map((item: any) => {
return `${item.name}${ return `${item.name}${
item.alias?.length > 0 ? `(${item.alias.join(',')})` : '' item.alias?.length > 0 ? `(${item.alias.join(',')})` : ''

View File

@@ -1,6 +1,6 @@
import { useCallback, useEffect, useState } from 'react'; import { useCallback, useEffect, useState } from 'react';
import { MsgDataType } from '../../../common/type'; import { MsgDataType } from '../../../common/type';
import { getToken, isProd } from '../../../utils/utils'; import { getToken, isMobile, isProd } from '../../../utils/utils';
import { webPageHost } from '../../../common/env'; import { webPageHost } from '../../../common/env';
type Props = { type Props = {
@@ -111,7 +111,11 @@ const WebPage: React.FC<Props> = ({ id, data }) => {
id={`reportIframe_${id}`} id={`reportIframe_${id}`}
name={`reportIframe_${id}`} name={`reportIframe_${id}`}
src={pluginUrl} src={pluginUrl}
style={{ width: '100%', height, border: 'none' }} style={{
width: isMobile ? 'calc(100vw - 20px)' : 'calc(100vw - 410px)',
height,
border: 'none',
}}
title="reportIframe" title="reportIframe"
allowFullScreen allowFullScreen
/> />