fix: message format with imgs, downloading table style
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
import { modelsExpandKeysAtom } from '@/atoms/models';
|
||||
import MoreButton from '@/components/buttons/more';
|
||||
import PageTools from '@/components/page-tools';
|
||||
import { PageAction } from '@/config';
|
||||
import useBodyScroll from '@/hooks/use-body-scroll';
|
||||
import { IS_FIRST_LOGIN, writeState } from '@/utils/localstore/index';
|
||||
import { DoubleRightOutlined, SyncOutlined } from '@ant-design/icons';
|
||||
import { SyncOutlined } from '@ant-design/icons';
|
||||
import { PageContainer } from '@ant-design/pro-components';
|
||||
import { useIntl, useNavigate } from '@umijs/max';
|
||||
import { Button, Input, Pagination, Select, Space, message } from 'antd';
|
||||
@@ -22,18 +23,6 @@ const PageWrapper = styled.div`
|
||||
margin-block: 32px 16px;
|
||||
`;
|
||||
|
||||
const MoreWrapper = styled.div`
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
margin-block: 16px;
|
||||
opacity: 1;
|
||||
transition: opacity 0.3s;
|
||||
&.loading {
|
||||
opacity: 0;
|
||||
transition: opacity 0.3s ease-in-out;
|
||||
}
|
||||
`;
|
||||
|
||||
const Catalog: React.FC = () => {
|
||||
const intl = useIntl();
|
||||
const { saveScrollHeight, restoreScrollHeight } = useBodyScroll();
|
||||
@@ -315,18 +304,11 @@ const Catalog: React.FC = () => {
|
||||
activeId={-1}
|
||||
isFirst={isFirst}
|
||||
></CatalogList>
|
||||
{queryParams.page < dataSource.totalPage && (
|
||||
<MoreWrapper className={dataSource.loading ? 'loading' : ''}>
|
||||
<Button
|
||||
onClick={loadMore}
|
||||
size="middle"
|
||||
type="text"
|
||||
icon={<DoubleRightOutlined rotate={90} />}
|
||||
>
|
||||
{intl.formatMessage({ id: 'common.button.more' })}
|
||||
</Button>
|
||||
</MoreWrapper>
|
||||
)}
|
||||
<MoreButton
|
||||
show={queryParams.page < dataSource.totalPage}
|
||||
loading={dataSource.loading}
|
||||
loadMore={loadMore}
|
||||
></MoreButton>
|
||||
<PageWrapper>
|
||||
<Pagination
|
||||
hideOnSinglePage={queryParams.perPage === 100}
|
||||
|
||||
@@ -139,7 +139,6 @@ const RenderRayactorDownloading = (props: {
|
||||
columns={downloadList}
|
||||
dataSource={[...mainWorker, ...list]}
|
||||
rowKey="worker_name"
|
||||
theme="light"
|
||||
></SimpleTabel>
|
||||
</div>
|
||||
);
|
||||
@@ -162,7 +161,7 @@ const RenderWorkerDownloading = (props: {
|
||||
arrow={true}
|
||||
overlayInnerStyle={{
|
||||
width: 300,
|
||||
backgroundColor: 'var(--color-white-1)'
|
||||
backgroundColor: 'var(--color-spotlight-bg)'
|
||||
}}
|
||||
overlayClassName="light-downloading-tooltip"
|
||||
title={
|
||||
|
||||
@@ -592,6 +592,10 @@ const options = [
|
||||
{
|
||||
label: '--context-shift',
|
||||
value: '--context-shift'
|
||||
},
|
||||
{
|
||||
label: '--v2',
|
||||
value: '--v2'
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { map } from 'lodash';
|
||||
import _, { map } from 'lodash';
|
||||
import { CREAT_IMAGE_API } from '../apis';
|
||||
import { MessageItem } from './types';
|
||||
|
||||
@@ -50,30 +50,33 @@ export const formatMessageParams = (messageList: any[]) => {
|
||||
|
||||
export const generateMessagesByListContent = (messageList: any[]) => {
|
||||
if (!messageList.length) return [];
|
||||
|
||||
return messageList.map((item: MessageItem) => {
|
||||
const content = map(
|
||||
item.imgs,
|
||||
(img: { uid: string | number; dataUrl: string }) => {
|
||||
return {
|
||||
type: 'image_url',
|
||||
image_url: {
|
||||
url: img.dataUrl
|
||||
}
|
||||
};
|
||||
}
|
||||
);
|
||||
if (item.imgs?.length) {
|
||||
const content = map(
|
||||
item.imgs,
|
||||
(img: { uid: string | number; dataUrl: string }) => {
|
||||
return {
|
||||
type: 'image_url',
|
||||
image_url: {
|
||||
url: img.dataUrl
|
||||
}
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
if (item.content) {
|
||||
content.push({
|
||||
type: 'text',
|
||||
text: item.content
|
||||
});
|
||||
if (item.content) {
|
||||
content.push({
|
||||
type: 'text',
|
||||
text: item.content
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
role: item.role,
|
||||
content: content
|
||||
};
|
||||
}
|
||||
return {
|
||||
role: item.role,
|
||||
content: content
|
||||
};
|
||||
return _.omit(item, ['uid', 'imgs']);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user