refactor: playground rerank layout

This commit is contained in:
jialin
2024-11-22 10:00:34 +08:00
parent 8e7fa486db
commit 1e3957bdd5
12 changed files with 218 additions and 135 deletions
@@ -1,4 +1,4 @@
import { Tooltip } from 'antd';
import { Progress, Tooltip } from 'antd';
import _ from 'lodash';
import React from 'react';
import '../style/content-item.less';
@@ -18,9 +18,6 @@ const RerankMessage: React.FC<RerankMessageProps> = ({ header, dataList }) => {
{dataList.map((item) => {
return (
<div className="content-item" key={item.uid}>
{/* <div className="content-item-role">
<span className="role">{item.title}</span>
</div> */}
<div className="content-item-content">
{Array.isArray(item.content) ? (
<div className="result">
@@ -37,6 +34,33 @@ const RerankMessage: React.FC<RerankMessageProps> = ({ header, dataList }) => {
>
<dd className="text">{sItem.text}</dd>
</Tooltip>
<Progress
format={() => (
<span
style={{
paddingRight: 4,
color: 'var(--ant-color-text-tertiary)'
}}
>
{_.round(sItem.score, 2)}
</span>
)}
size={{
height: 4
}}
type="line"
status="normal"
percentPosition={{ align: 'end', type: 'outer' }}
strokeColor="rgb(22 119 255 / 27%)"
trailColor="transparent"
percent={sItem.normalizValue}
style={{
position: 'absolute',
left: 0,
bottom: 0,
lineHeight: '12px'
}}
></Progress>
</dl>
);
})}