fix(style): markdown viewer text-intent
This commit is contained in:
+1
-1
@@ -14,7 +14,7 @@ const isProduction = env === 'production';
|
|||||||
const t = Date.now();
|
const t = Date.now();
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
proxy: {
|
proxy: {
|
||||||
...proxy()
|
...proxy('http://192.168.50.166:8080')
|
||||||
},
|
},
|
||||||
history: {
|
history: {
|
||||||
type: 'hash'
|
type: 'hash'
|
||||||
|
|||||||
@@ -93,6 +93,10 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.flex-wrap {
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
.flex-gap-2 {
|
.flex-gap-2 {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 2px;
|
gap: 2px;
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
.markdown-viewer {
|
.markdown-viewer {
|
||||||
font-family: var(--font-family) !important;
|
font-family: var(--font-family) !important;
|
||||||
white-space: pre-wrap;
|
|
||||||
|
|
||||||
.hr {
|
.hr {
|
||||||
border: none;
|
border: none;
|
||||||
|
|||||||
@@ -6,6 +6,8 @@
|
|||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
height: 68px;
|
height: 68px;
|
||||||
word-break: break-word;
|
word-break: break-word;
|
||||||
|
min-width: 20px;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
.cell-content {
|
.cell-content {
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import { WatchEventType } from '@/config';
|
import { WatchEventType } from '@/config';
|
||||||
import _ from 'lodash';
|
|
||||||
import { useEffect, useRef } from 'react';
|
import { useEffect, useRef } from 'react';
|
||||||
|
|
||||||
interface ChunkedCollection {
|
interface ChunkedCollection {
|
||||||
@@ -19,6 +18,7 @@ export function useUpdateChunkedList(options: {
|
|||||||
}) {
|
}) {
|
||||||
const cacheDataListRef = useRef<any[]>(options.dataList || []);
|
const cacheDataListRef = useRef<any[]>(options.dataList || []);
|
||||||
const timerRef = useRef<any>(null);
|
const timerRef = useRef<any>(null);
|
||||||
|
const countRef = useRef<number>(0);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
cacheDataListRef.current = [...(options.dataList || [])];
|
cacheDataListRef.current = [...(options.dataList || [])];
|
||||||
@@ -30,74 +30,71 @@ export function useUpdateChunkedList(options: {
|
|||||||
options.setDataList?.([...cacheDataListRef.current]);
|
options.setDataList?.([...cacheDataListRef.current]);
|
||||||
}, 80);
|
}, 80);
|
||||||
};
|
};
|
||||||
const updateChunkedList = (
|
const updateChunkedList = (data: ChunkedCollection) => {
|
||||||
data: ChunkedCollection,
|
|
||||||
dataList?: { id: string | number }[]
|
|
||||||
) => {
|
|
||||||
console.log('updateChunkedList=====', {
|
console.log('updateChunkedList=====', {
|
||||||
ids: data?.ids,
|
ids: data?.ids,
|
||||||
type: data?.type,
|
type: data?.type,
|
||||||
collection: data?.collection.length,
|
collection: data?.collection
|
||||||
dataList: _.map(dataList, (o: any) => o.id)
|
|
||||||
});
|
});
|
||||||
let collections = data?.collection || [];
|
let collections = data?.collection || [];
|
||||||
if (options?.computedID) {
|
if (options?.computedID) {
|
||||||
collections = _.map(collections, (item: any) => {
|
collections = collections?.map((item: any) => {
|
||||||
item.id = options?.computedID?.(item);
|
item.id = options?.computedID?.(item);
|
||||||
return item;
|
return item;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (options?.filterFun) {
|
if (options?.filterFun) {
|
||||||
collections = _.filter(data?.collection, options?.filterFun);
|
collections = data?.collection?.filter(options?.filterFun);
|
||||||
}
|
}
|
||||||
if (options?.mapFun) {
|
if (options?.mapFun) {
|
||||||
collections = _.map(data?.collection, options?.mapFun);
|
collections = data?.collection?.map(options?.mapFun);
|
||||||
}
|
}
|
||||||
const ids = data?.ids || [];
|
const ids = data?.ids || [];
|
||||||
// CREATE
|
// CREATE
|
||||||
if (data?.type === WatchEventType.CREATE) {
|
if (data?.type === WatchEventType.CREATE) {
|
||||||
const newDataList: any[] = [];
|
const newDataList = collections.reduce((acc: any[], item: any) => {
|
||||||
_.each(collections, (item: any) => {
|
const updateIndex = cacheDataListRef.current?.findIndex(
|
||||||
const updateIndex = _.findIndex(
|
|
||||||
cacheDataListRef.current,
|
|
||||||
(sItem: any) => sItem.id === item.id
|
(sItem: any) => sItem.id === item.id
|
||||||
);
|
);
|
||||||
|
const updateItem = { ...item };
|
||||||
if (updateIndex === -1) {
|
if (updateIndex === -1) {
|
||||||
const updateItem = _.cloneDeep(item);
|
acc.push(updateItem);
|
||||||
newDataList.push(updateItem);
|
} else {
|
||||||
|
cacheDataListRef.current[updateIndex] = updateItem;
|
||||||
}
|
}
|
||||||
console.log('create=========', updateIndex, collections);
|
|
||||||
});
|
return acc;
|
||||||
cacheDataListRef.current = [...newDataList, ...cacheDataListRef.current];
|
}, []);
|
||||||
// options.setDataList?.([...cacheDataListRef.current]);
|
cacheDataListRef.current = [
|
||||||
|
...newDataList,
|
||||||
|
...cacheDataListRef.current
|
||||||
|
].slice(0, 10);
|
||||||
}
|
}
|
||||||
// DELETE
|
// DELETE
|
||||||
if (data?.type === WatchEventType.DELETE) {
|
if (data?.type === WatchEventType.DELETE) {
|
||||||
cacheDataListRef.current = _.filter(
|
cacheDataListRef.current = cacheDataListRef.current?.filter(
|
||||||
cacheDataListRef.current,
|
|
||||||
(item: any) => {
|
(item: any) => {
|
||||||
return !_.includes(ids, item.id);
|
return !ids?.includes(item.id);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
options.setDataList?.([...cacheDataListRef.current]);
|
options.setDataList?.([...cacheDataListRef.current]);
|
||||||
}
|
}
|
||||||
// UPDATE
|
// UPDATE
|
||||||
if (data?.type === WatchEventType.UPDATE) {
|
if (data?.type === WatchEventType.UPDATE) {
|
||||||
_.each(collections, (item: any) => {
|
collections?.forEach((item: any) => {
|
||||||
const updateIndex = _.findIndex(
|
const updateIndex = cacheDataListRef.current?.findIndex(
|
||||||
cacheDataListRef.current,
|
|
||||||
(sItem: any) => sItem.id === item.id
|
(sItem: any) => sItem.id === item.id
|
||||||
);
|
);
|
||||||
|
const updateItem = { ...item };
|
||||||
if (updateIndex > -1) {
|
if (updateIndex > -1) {
|
||||||
const updateItem = _.cloneDeep(item);
|
|
||||||
cacheDataListRef.current[updateIndex] = updateItem;
|
cacheDataListRef.current[updateIndex] = updateItem;
|
||||||
} else if (updateIndex === -1) {
|
} else if (updateIndex === -1) {
|
||||||
const updateItem = _.cloneDeep(item);
|
cacheDataListRef.current = [
|
||||||
cacheDataListRef.current.push(updateItem);
|
updateItem,
|
||||||
|
...cacheDataListRef.current.slice(0, 9)
|
||||||
|
];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
console.log('updateChunkedList=====update', cacheDataListRef.current);
|
|
||||||
// options.setDataList?.([...cacheDataListRef.current]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
debounceUpdateChunckedList();
|
debounceUpdateChunckedList();
|
||||||
|
|||||||
@@ -46,5 +46,5 @@ export default {
|
|||||||
'playground.compare.applytoall': 'Apply to all models',
|
'playground.compare.applytoall': 'Apply to all models',
|
||||||
'playground.model.noavailable': 'No available models.',
|
'playground.model.noavailable': 'No available models.',
|
||||||
'playground.model.noavailable.tips':
|
'playground.model.noavailable.tips':
|
||||||
'Please deploy a model first, and it is not an Embedding Only model.'
|
'Please deploy a model first, and it should not be an embedding-only model.'
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -46,5 +46,5 @@ export default {
|
|||||||
'playground.compare.applytoall': '应用到所有模型',
|
'playground.compare.applytoall': '应用到所有模型',
|
||||||
'playground.model.noavailable': '无可用模型',
|
'playground.model.noavailable': '无可用模型',
|
||||||
'playground.model.noavailable.tips':
|
'playground.model.noavailable.tips':
|
||||||
'请先部署模型,且不是 Embedding Only 模型'
|
'请先部署模型,且不是 Embedding Only 的模型'
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -519,17 +519,20 @@ const Models: React.FC<ModelsProps> = ({
|
|||||||
span={5}
|
span={5}
|
||||||
render={(text, record: ListItem) => {
|
render={(text, record: ListItem) => {
|
||||||
return (
|
return (
|
||||||
<span className="flex-center" style={{ maxWidth: '100%' }}>
|
<span
|
||||||
<AutoTooltip className="m-r-5" ghost>
|
className="flex-center flex-wrap"
|
||||||
{text}
|
style={{ maxWidth: '100%' }}
|
||||||
|
>
|
||||||
|
<AutoTooltip ghost>
|
||||||
|
<span className="m-r-5">{text}</span>
|
||||||
</AutoTooltip>
|
</AutoTooltip>
|
||||||
<span>
|
{record.embedding_only && (
|
||||||
{record.embedding_only && (
|
<span>
|
||||||
<Tag style={{ marginTop: 6 }} color="geekblue">
|
<Tag style={{ margin: 0 }} color="geekblue">
|
||||||
Embedding Only
|
Embedding Only
|
||||||
</Tag>
|
</Tag>
|
||||||
)}
|
</span>
|
||||||
</span>
|
)}
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -1,12 +1,7 @@
|
|||||||
import IconFont from '@/components/icon-font';
|
import IconFont from '@/components/icon-font';
|
||||||
import HotKeys, { KeyMap } from '@/config/hotkeys';
|
import HotKeys, { KeyMap } from '@/config/hotkeys';
|
||||||
import { platformCall } from '@/utils';
|
import { platformCall } from '@/utils';
|
||||||
import {
|
import { ClearOutlined, SendOutlined, SwapOutlined } from '@ant-design/icons';
|
||||||
ClearOutlined,
|
|
||||||
ControlOutlined,
|
|
||||||
SendOutlined,
|
|
||||||
SwapOutlined
|
|
||||||
} from '@ant-design/icons';
|
|
||||||
import { useIntl } from '@umijs/max';
|
import { useIntl } from '@umijs/max';
|
||||||
import { Button, Divider, Input, Select, Tooltip } from 'antd';
|
import { Button, Divider, Input, Select, Tooltip } from 'antd';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
@@ -351,7 +346,7 @@ const MessageInput: React.FC<MessageInputProps> = ({
|
|||||||
></Button>
|
></Button>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
|
||||||
<Tooltip
|
{/* <Tooltip
|
||||||
title={intl.formatMessage({ id: 'playground.toolbar.prompts' })}
|
title={intl.formatMessage({ id: 'playground.toolbar.prompts' })}
|
||||||
>
|
>
|
||||||
<Button
|
<Button
|
||||||
@@ -360,7 +355,7 @@ const MessageInput: React.FC<MessageInputProps> = ({
|
|||||||
size="middle"
|
size="middle"
|
||||||
onClick={handleOpenPrompt}
|
onClick={handleOpenPrompt}
|
||||||
></Button>
|
></Button>
|
||||||
</Tooltip>
|
</Tooltip> */}
|
||||||
{updateLayout && (
|
{updateLayout && (
|
||||||
<>
|
<>
|
||||||
<Divider type="vertical" style={{ margin: 0 }} />
|
<Divider type="vertical" style={{ margin: 0 }} />
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
|
import useOverlayScroller from '@/hooks/use-overlay-scroller';
|
||||||
import { useIntl } from '@umijs/max';
|
import { useIntl } from '@umijs/max';
|
||||||
import { Button, Modal, Typography } from 'antd';
|
import { Button, Modal, Typography } from 'antd';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import SimpleBar from 'simplebar-react';
|
|
||||||
import 'simplebar-react/dist/simplebar.min.css';
|
import 'simplebar-react/dist/simplebar.min.css';
|
||||||
import promptList from '../config/prompt';
|
import promptList from '../config/prompt';
|
||||||
import '../style/prompt-modal.less';
|
import '../style/prompt-modal.less';
|
||||||
@@ -15,6 +15,15 @@ type ViewModalProps = {
|
|||||||
const AddWorker: React.FC<ViewModalProps> = (props) => {
|
const AddWorker: React.FC<ViewModalProps> = (props) => {
|
||||||
const { open, onCancel } = props || {};
|
const { open, onCancel } = props || {};
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
|
const { initialize } = useOverlayScroller();
|
||||||
|
const scrollerRef = React.useRef<any>(null);
|
||||||
|
|
||||||
|
React.useEffect(() => {
|
||||||
|
if (scrollerRef.current) {
|
||||||
|
initialize(scrollerRef.current);
|
||||||
|
}
|
||||||
|
}, [scrollerRef.current, initialize]);
|
||||||
|
|
||||||
const handleSelect = (item: {
|
const handleSelect = (item: {
|
||||||
title: string;
|
title: string;
|
||||||
data: { role: string; content: string }[];
|
data: { role: string; content: string }[];
|
||||||
@@ -45,7 +54,7 @@ const AddWorker: React.FC<ViewModalProps> = (props) => {
|
|||||||
}}
|
}}
|
||||||
footer={null}
|
footer={null}
|
||||||
>
|
>
|
||||||
<SimpleBar style={{ maxHeight: '550px' }}>
|
<div ref={scrollerRef} style={{ maxHeight: '550px', overflow: 'auto' }}>
|
||||||
<div className="prompt-wrapper">
|
<div className="prompt-wrapper">
|
||||||
{promptList.map((item, index) => {
|
{promptList.map((item, index) => {
|
||||||
return (
|
return (
|
||||||
@@ -83,7 +92,7 @@ const AddWorker: React.FC<ViewModalProps> = (props) => {
|
|||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
</SimpleBar>
|
</div>
|
||||||
</Modal>
|
</Modal>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user