diff --git a/webapp/packages/chat-sdk/src/Chat/ChatFooter/index.tsx b/webapp/packages/chat-sdk/src/Chat/ChatFooter/index.tsx index 39e5f9f42..26a3b5376 100644 --- a/webapp/packages/chat-sdk/src/Chat/ChatFooter/index.tsx +++ b/webapp/packages/chat-sdk/src/Chat/ChatFooter/index.tsx @@ -328,9 +328,9 @@ const ChatFooter: ForwardRefRenderFunction = ( className={styles.composerInput} placeholder={ currentAgent - ? `智能助理${ - isMobile ? `[${currentAgent?.name}]` : `【${currentAgent?.name}】` - }将与您对话,输入“/”可切换助理` + ? `【${currentAgent.name}】将与您对话,点击${!isMobile ? '左侧' : ''}【智能助理】${ + !isMobile ? '列表' : '' + }可切换` : '请输入您的问题' } value={inputMsg} diff --git a/webapp/packages/chat-sdk/src/components/ChatItem/SqlItem.tsx b/webapp/packages/chat-sdk/src/components/ChatItem/SqlItem.tsx index b47cd9d85..14e84128f 100644 --- a/webapp/packages/chat-sdk/src/components/ChatItem/SqlItem.tsx +++ b/webapp/packages/chat-sdk/src/components/ChatItem/SqlItem.tsx @@ -9,18 +9,19 @@ import { CheckCircleFilled, UpOutlined } from '@ant-design/icons'; import { SqlInfoType } from '../../common/type'; type Props = { + llmReq?: any; integrateSystem?: string; sqlInfo: SqlInfoType; sqlTimeCost?: number; }; -const SqlItem: React.FC = ({ integrateSystem, sqlInfo, sqlTimeCost }) => { +const SqlItem: React.FC = ({ llmReq, integrateSystem, sqlInfo, sqlTimeCost }) => { const [sqlType, setSqlType] = useState(''); const tipPrefixCls = `${PREFIX_CLS}-item`; const prefixCls = `${PREFIX_CLS}-sql-item`; - const handleCopy = (text, result) => { + const handleCopy = (_: string, result: any) => { result ? message.success('复制SQL成功', 1) : message.error('复制SQL失败', 1); }; @@ -28,10 +29,12 @@ const SqlItem: React.FC = ({ integrateSystem, sqlInfo, sqlTimeCost }) => setSqlType(''); }; - if (!sqlInfo.s2SQL && !sqlInfo.correctS2SQL && !sqlInfo.querySQL) { + if (!llmReq && !sqlInfo.s2SQL && !sqlInfo.correctS2SQL && !sqlInfo.querySQL) { return null; } + const { schema, linking, priorExts } = llmReq || {}; + return (
@@ -49,6 +52,18 @@ const SqlItem: React.FC = ({ integrateSystem, sqlInfo, sqlTimeCost }) => )}
+ {llmReq && ( +
{ + setSqlType(sqlType === 'schemaMap' ? '' : 'schemaMap'); + }} + > + Schema映射 +
+ )} {sqlInfo.s2SQL && (
= ({ integrateSystem, sqlInfo, sqlTimeCost }) => : '' }`} > + {sqlType === 'schemaMap' && ( +
+ {schema?.fieldNameList?.length > 0 && ( +
+
名称:
+
+ {schema.fieldNameList.join('、')} +
+
+ )} + {linking?.length > 0 && ( +
+
取值:
+
+ {linking.map((item: any) => { + return ( + + {item.fieldName}: {item.fieldValue} + + ); + })} +
+
+ )} + {priorExts && ( +
+
附加:
+
{priorExts}
+
+ )} +
+ )} {sqlType && sqlInfo[sqlType] && ( <> = ({ <> {!isMobile && parseInfo?.sqlInfo && isDeveloper && integrateSystem !== 'c2' && ( = ({ onEditAgent, onSaveAgent, }) => { - // const [searchName, setSearchName] = useState(''); const [showAgents, setShowAgents] = useState([]); + const [showType, setShowType] = useState(localStorage.getItem('AGENT_SHOW_TYPE') || 'list'); useEffect(() => { setShowAgents(agents); }, [agents]); + const columns = [ + { + title: '助理名称', + dataIndex: 'name', + key: 'name', + render: (value: string, agent: AgentType) => { + return ( + { + onSelectAgent(agent); + }} + > + {value} + + ); + }, + }, + { + title: '描述', + dataIndex: 'description', + key: 'description', + }, + { + title: '状态', + dataIndex: 'status', + key: 'status', + render: (status: number, agent: AgentType) => { + return ( +
+ {status === 0 ? '已禁用' : 已启用} + { + e.stopPropagation(); + }} + > + { + onSaveAgent({ ...agent, status: value ? 1 : 0 }, true); + }} + /> + +
+ ); + }, + }, + { + title: '更新人', + dataIndex: 'updatedBy', + key: 'updatedBy', + }, + { + title: '更新时间', + dataIndex: 'updatedAt', + key: 'updatedAt', + render: (value: string) => { + return moment(value).format('YYYY-MM-DD HH:mm:ss'); + }, + }, + { + title: '操作', + dataIndex: 'x', + key: 'x', + render: (_: any, agent: AgentType) => { + return ( +
+ { + onSelectAgent(agent); + }} + > + 编辑 + + { + e?.stopPropagation(); + }} + onConfirm={() => { + onDeleteAgent(agent.id!); + }} + > + 删除 + +
+ ); + }, + }, + ]; + return (
- {/*
问答助理
*/}
- {/* { - setSearchName(e.target.value); - }} - onSearch={(value) => { - setShowAgents( - agents.filter((agent) => - agent.name?.trim().toLowerCase().includes(value.trim().toLowerCase()), - ), - ); - }} - /> */} +
+ 切换为卡片 + { + const showTypeValue = value ? 'card' : 'list'; + setShowType(showTypeValue); + localStorage.setItem('AGENT_SHOW_TYPE', showTypeValue); + }} + /> +
-
- {showAgents.map((agent) => { - const agentItemClass = classNames(styles.agentItem, { - [styles.agentActive]: agent.id === currentAgent?.id, - }); - return ( -
{ - onSelectAgent(agent); - }} - > - -
-
-
{agent.name}
-
- { - e.stopPropagation(); - onEditAgent(agent); - }} - /> - { - e?.stopPropagation(); - }} - onConfirm={(e) => { - e?.stopPropagation(); - onDeleteAgent(agent.id!); - }} - > - + ) : ( +
+ {showAgents.map((agent) => { + const agentItemClass = classNames(styles.agentItem, { + [styles.agentActive]: agent.id === currentAgent?.id, + }); + return ( +
{ + onSelectAgent(agent); + }} + > + +
+
+
{agent.name}
+
+ { e.stopPropagation(); + onEditAgent(agent); }} /> - -
-
-
-
- {agent.description} -
-
- {agent.status === 0 ? ( - '已禁用' - ) : ( - 已启用 - )} - { - e.stopPropagation(); - }} - > - { - onSaveAgent({ ...agent, status: value ? 1 : 0 }, true); + { + e?.stopPropagation(); }} - /> - + onConfirm={(e) => { + e?.stopPropagation(); + onDeleteAgent(agent.id!); + }} + > + { + e.stopPropagation(); + }} + /> + +
+
+
+
+ {agent.description} +
+
+ {agent.status === 0 ? ( + '已禁用' + ) : ( + 已启用 + )} + { + e.stopPropagation(); + }} + > + { + onSaveAgent({ ...agent, status: value ? 1 : 0 }, true); + }} + /> + +
-
- ); - })} -
+ ); + })} +
+ )}
); diff --git a/webapp/packages/supersonic-fe/src/pages/Agent/style.less b/webapp/packages/supersonic-fe/src/pages/Agent/style.less index 0e8546bff..41013c9de 100644 --- a/webapp/packages/supersonic-fe/src/pages/Agent/style.less +++ b/webapp/packages/supersonic-fe/src/pages/Agent/style.less @@ -1,5 +1,4 @@ .agent { - // background: #fff; height: calc(100vh - 48px); } @@ -20,7 +19,7 @@ .searchBar { display: flex; align-items: center; - column-gap: 20px; + column-gap: 30px; margin-bottom: 40px; .searchControl { @@ -290,3 +289,16 @@ } } } + +.switchShowTypeLabel { + color: #999; + font-weight: 500; + font-size: 14px; + margin-right: 12px; +} + +.operateIcons { + display: flex; + align-items: center; + column-gap: 12px; +}