fix: model markdown parse failed

main
jialin 1 year ago
parent 67febd3e25
commit c8c22b3f22

@ -0,0 +1 @@
src/components/icon-font/iconfont/iconfont.js

@ -18,35 +18,10 @@ export default function createProxyTable(target?: string) {
changeOrigin: true,
secure: false,
ws: true,
buffer: false,
selfHandleResponse: false,
pathRewrite: (pth: string) => pth.replace(`/^/${api}`, `/${api}`),
headers: {
origin: newTarget,
Connection: 'keep-alive',
'Cache-Control': 'no-cache'
},
onProxyRes: (proxyRes: any, req: any, res: any) => {
// let body = '';
// proxyRes.on('data', (chunk) => {
// body += chunk;
// console.log('Received data from target server::::::::::', chunk);
// });
// proxyRes.on('end', () => {
// console.log('Received data from target server=================end');
// console.log(body);
// });
if (req.headers.accept === 'text/event-stream') {
res.writeHead(res.statusCode, {
'Content-Type': 'text/event-stream',
'Cache-Control': 'no-cache',
Connection: 'keep-alive',
'X-Accel-Buffering': 'no',
'Access-Control-Allow-Origin': '*'
});
proxyRes.pipe(res);
}
Connection: 'keep-alive'
}
};
return obj;

@ -0,0 +1,155 @@
@font-face {
font-family: iconfont; /* Project id 4613488 */
src:
url('iconfont.woff2?t=1732245003614') format('woff2'),
url('iconfont.woff?t=1732245003614') format('woff'),
url('iconfont.ttf?t=1732245003614') format('truetype');
}
.iconfont {
font-family: iconfont !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.icon-stop2::before {
content: '\e8db';
}
.icon-stop::before {
content: '\e60b';
}
.icon-image::before {
content: '\e62c';
}
.icon-stopcircle-fill::before {
content: '\e7cc';
}
.icon-playcircle-fill::before {
content: '\e7cd';
}
.icon-SpeakerSlash::before {
content: '\e661';
}
.icon-SpeakerHigh::before {
content: '\e670';
}
.icon-user_voice::before {
content: '\e667';
}
.icon-audio::before {
content: '\e985';
}
.icon-hard-disk::before {
content: '\eb1d';
}
.icon-new::before {
content: '\e612';
}
.icon-tu2::before {
content: '\e607';
}
.icon-robot::before {
content: '\e634';
}
.icon-robot1::before {
content: '\e602';
}
.icon-aizhineng::before {
content: '\e672';
}
.icon-copy::before {
content: '\e720';
}
.icon-AIzhineng::before {
content: '\e608';
}
.icon-cols_6::before {
content: '\e651';
}
.icon-cols_3::before {
content: '\e650';
}
.icon-cols_2::before {
content: '\e64e';
}
.icon-cols_4::before {
content: '\e64d';
}
.icon-clear::before {
content: '\e60a';
}
.icon-keyboard::before {
content: '\e61b';
}
.icon-networkerror::before {
content: '\e624';
}
.icon-external-link::before {
content: '\e66b';
}
.icon-huggingface::before {
content: '\e7d1';
}
.icon-ollama::before {
content: '\e601';
}
.icon-a-layout6-line::before {
content: '\e9ef';
}
.icon-a-Layout5::before {
content: '\e610';
}
.icon-English::before {
content: '\e8b3';
}
.icon-chinese::before {
content: '\e611';
}
.icon-yingguo::before {
content: '\e606';
}
.icon-code::before {
content: '\e84f';
}
.icon-stop1::before {
content: '\e783';
}
.icon-command::before {
content: '\e600';
}

File diff suppressed because one or more lines are too long

@ -0,0 +1,254 @@
{
"id": "4613488",
"name": "gpustack",
"font_family": "iconfont",
"css_prefix_text": "icon-",
"description": "",
"glyphs": [
{
"icon_id": "15617444",
"name": "stop",
"font_class": "stop2",
"unicode": "e8db",
"unicode_decimal": 59611
},
{
"icon_id": "8327181",
"name": "stop",
"font_class": "stop",
"unicode": "e60b",
"unicode_decimal": 58891
},
{
"icon_id": "714031",
"name": "image",
"font_class": "image",
"unicode": "e62c",
"unicode_decimal": 58924
},
{
"icon_id": "6151140",
"name": "stop circle-fill",
"font_class": "stopcircle-fill",
"unicode": "e7cc",
"unicode_decimal": 59340
},
{
"icon_id": "6151141",
"name": "play circle-fill",
"font_class": "playcircle-fill",
"unicode": "e7cd",
"unicode_decimal": 59341
},
{
"icon_id": "23563264",
"name": "SpeakerSlash",
"font_class": "SpeakerSlash",
"unicode": "e661",
"unicode_decimal": 58977
},
{
"icon_id": "23563318",
"name": "SpeakerHigh",
"font_class": "SpeakerHigh",
"unicode": "e670",
"unicode_decimal": 58992
},
{
"icon_id": "41955357",
"name": " user_voice",
"font_class": "user_voice",
"unicode": "e667",
"unicode_decimal": 58983
},
{
"icon_id": "29174196",
"name": "audio",
"font_class": "audio",
"unicode": "e985",
"unicode_decimal": 59781
},
{
"icon_id": "40073465",
"name": "hard-disk",
"font_class": "hard-disk",
"unicode": "eb1d",
"unicode_decimal": 60189
},
{
"icon_id": "12717507",
"name": "new",
"font_class": "new",
"unicode": "e612",
"unicode_decimal": 58898
},
{
"icon_id": "36135335",
"name": "mdp-template-modelscope",
"font_class": "tu2",
"unicode": "e607",
"unicode_decimal": 58887
},
{
"icon_id": "10710692",
"name": "robot",
"font_class": "robot",
"unicode": "e634",
"unicode_decimal": 58932
},
{
"icon_id": "12070718",
"name": "robot",
"font_class": "robot1",
"unicode": "e602",
"unicode_decimal": 58882
},
{
"icon_id": "10791813",
"name": "ai智能",
"font_class": "aizhineng",
"unicode": "e672",
"unicode_decimal": 58994
},
{
"icon_id": "19418384",
"name": "copy",
"font_class": "copy",
"unicode": "e720",
"unicode_decimal": 59168
},
{
"icon_id": "40757798",
"name": "AI智能",
"font_class": "AIzhineng",
"unicode": "e608",
"unicode_decimal": 58888
},
{
"icon_id": "41755257",
"name": "cols_6",
"font_class": "cols_6",
"unicode": "e651",
"unicode_decimal": 58961
},
{
"icon_id": "41755178",
"name": "cols_3",
"font_class": "cols_3",
"unicode": "e650",
"unicode_decimal": 58960
},
{
"icon_id": "41754685",
"name": "cols_2",
"font_class": "cols_2",
"unicode": "e64e",
"unicode_decimal": 58958
},
{
"icon_id": "41754565",
"name": "cols_4",
"font_class": "cols_4",
"unicode": "e64d",
"unicode_decimal": 58957
},
{
"icon_id": "36263088",
"name": "clear",
"font_class": "clear",
"unicode": "e60a",
"unicode_decimal": 58890
},
{
"icon_id": "5297059",
"name": "keyboard",
"font_class": "keyboard",
"unicode": "e61b",
"unicode_decimal": 58907
},
{
"icon_id": "11539157",
"name": "network error",
"font_class": "networkerror",
"unicode": "e624",
"unicode_decimal": 58916
},
{
"icon_id": "14465073",
"name": "external-link",
"font_class": "external-link",
"unicode": "e66b",
"unicode_decimal": 58987
},
{
"icon_id": "38465464",
"name": "huggingface",
"font_class": "huggingface",
"unicode": "e7d1",
"unicode_decimal": 59345
},
{
"icon_id": "40568411",
"name": "ollama",
"font_class": "ollama",
"unicode": "e601",
"unicode_decimal": 58881
},
{
"icon_id": "24341846",
"name": "layout 6-line",
"font_class": "a-layout6-line",
"unicode": "e9ef",
"unicode_decimal": 59887
},
{
"icon_id": "31345353",
"name": "a-Layout5",
"font_class": "a-Layout5",
"unicode": "e610",
"unicode_decimal": 58896
},
{
"icon_id": "10031665",
"name": "English",
"font_class": "English",
"unicode": "e8b3",
"unicode_decimal": 59571
},
{
"icon_id": "9134244",
"name": "chinese",
"font_class": "chinese",
"unicode": "e611",
"unicode_decimal": 58897
},
{
"icon_id": "12176725",
"name": "english",
"font_class": "yingguo",
"unicode": "e606",
"unicode_decimal": 58886
},
{
"icon_id": "34453176",
"name": "code",
"font_class": "code",
"unicode": "e84f",
"unicode_decimal": 59471
},
{
"icon_id": "12579515",
"name": "stop",
"font_class": "stop1",
"unicode": "e783",
"unicode_decimal": 59267
},
{
"icon_id": "1842082",
"name": "command",
"font_class": "command",
"unicode": "e600",
"unicode_decimal": 58880
}
]
}

@ -1,7 +1,8 @@
import { createFromIconfontCN } from '@ant-design/icons';
import './iconfont/iconfont.js';
const IconFont = createFromIconfontCN({
scriptUrl: '//at.alicdn.com/t/c/font_4613488_f5wastzhj2w.js'
scriptUrl: ''
});
export default IconFont;

@ -1,4 +1,3 @@
import { isHTMLDocumentString } from '@/utils';
import { EyeOutlined } from '@ant-design/icons';
import { Checkbox, Image, Typography } from 'antd';
import { unescape } from 'lodash';
@ -200,16 +199,14 @@ const MarkdownViewer: React.FC<MarkdownViewerProps> = ({
return (
<>
{isHTMLDocumentString(content) ? (
<div dangerouslySetInnerHTML={{ __html: content }} style={{ height }} />
) : (
<div
style={{ height }}
className="markdown-viewer custom-scrollbar-horizontal"
>
{renderTokens(tokens)}
</div>
)}
(
<div
style={{ height }}
className="markdown-viewer custom-scrollbar-horizontal"
>
{renderTokens(tokens)}
</div>
)
</>
);
};

@ -74,5 +74,6 @@ export default {
'playground.rerank.query': 'Query',
'playground.rerank.rank': 'Rank',
'playground.rerank.score': 'Score',
'playground.rerank.query.holder': 'Input your query'
'playground.rerank.query.holder': 'Input your query',
'playground.image.prompt': 'Input Prompt'
};

@ -74,5 +74,6 @@ export default {
'playground.rerank.query': '查询',
'playground.rerank.rank': '排序',
'playground.rerank.score': '分数',
'playground.rerank.query.holder': '输入查询'
'playground.rerank.query.holder': '输入查询',
'playground.image.prompt': '输入提示'
};

@ -34,7 +34,6 @@ const SEARCH_SOURCE = [
];
const UpdateModal: React.FC<AddModalProps> = (props) => {
console.log('addmodel====');
const { title, action, open, onOk, onCancel } = props || {};
const [form] = Form.useForm();
const intl = useIntl();
@ -261,6 +260,13 @@ const UpdateModal: React.FC<AddModalProps> = (props) => {
};
const handleOk = (formdata: FormData) => {
let obj = {};
if (formdata.backend === backendOptionsMap.vllm) {
obj = {
distributed_inference_across_workers: false,
cpu_offloading: false
};
}
if (formdata.scheduleType === 'manual') {
const gpu = _.find(gpuOptions, (item: any) => {
return item.value === formdata.gpu_selector;
@ -275,12 +281,14 @@ const UpdateModal: React.FC<AddModalProps> = (props) => {
gpu_index: gpu.index,
worker_name: gpu.worker_name
}
: null
: null,
...obj
});
} else {
onOk({
..._.omit(formdata, ['scheduleType']),
gpu_selector: null
gpu_selector: null,
...obj
});
}
};

@ -480,6 +480,11 @@ const GroundImages: React.FC<MessageProps> = forwardRef((props, ref) => {
handleAbortFetch={handleStopConversation}
shouldResetMessage={false}
clearAll={handleClear}
tools={
<span className="p-l-8 font-600">
{intl.formatMessage({ id: 'playground.image.prompt' })}
</span>
}
/>
</div>
</div>

@ -128,12 +128,8 @@ export const cosineSimilarity = (vec1: number[], vec2: number[]) => {
return dotProduct / (magnitudeA * magnitudeB);
};
const htmlSpecialTags = /^<html>(.|\n|\r)*<\/html>$/i;
export const isHTMLDocumentString = (str: string) => {
try {
const parser = new DOMParser();
const doc = parser.parseFromString(str, 'text/html');
return doc.documentElement.tagName.toLowerCase() === 'html';
} catch (e) {
return false;
}
return htmlSpecialTags.test(str?.trim());
};

Loading…
Cancel
Save