Commit 42e12d7d by archer

perf: 文本

parent 249ed18d
......@@ -11,6 +11,7 @@
"format": "prettier --config \"./.prettierrc.js\" --write \"./src/**/*.{ts,tsx,scss}\""
},
"dependencies": {
"@alicloud/alinlp20200629": "^2.0.2",
"@chakra-ui/icons": "^2.0.17",
"@chakra-ui/react": "^2.5.1",
"@emotion/react": "^11.10.6",
......
......@@ -53,7 +53,7 @@ const ScrollData = ({
}, [elementRef, nextPage]);
return (
<Box {...props} ref={elementRef} overflow={'auto'} position={'relative'}>
<Box {...props} ref={elementRef} overflowY={'auto'} position={'relative'}>
{children}
<Box
mt={2}
......
......@@ -44,6 +44,9 @@ export const introPage = `
`;
export const chatProblem = `
**模型问题**
一般情况下,请直接选择 chatGPT 模型,价格低效果好。
**代理出错**
服务器代理不稳定,可以过一会儿再尝试。
......
......@@ -122,7 +122,7 @@ const DataList = () => {
训练数据管理
</Box>
<Box fontSize={'xs'} color={'blackAlpha.600'}>
允许你将任意文本数据拆分成 QA 的形式。你可以使用这些 QA 去微调你的对话模型
允许你将任意文本数据拆分成 QA 形式,或者进行文本摘要总结
</Box>
</Box>
<Button variant={'outline'} onClick={onOpenCreateDataModal}>
......
......@@ -12,7 +12,7 @@ export async function generateAbstract(next = false): Promise<any> {
const systemPrompt: ChatCompletionRequestMessage = {
role: 'system',
content: `请从长文本中总结出5至15个摘要,尽量详细,请务必按以下格式返回: "(1):"\n"(2):"\n"(3):"\n`
content: `请从长文本中总结出5至15个摘要,尽量详细,并按以下格式返回: "A:"\n"A:"\n"A:"\n`
};
let dataItem: DataItemSchema | null = null;
......@@ -97,7 +97,7 @@ export async function generateAbstract(next = false): Promise<any> {
console.log('获取词向量错误: ', item);
return {
abstract: splitContents[i].abstract,
abstractVector: ''
abstractVector: []
};
}
return {
......@@ -120,7 +120,7 @@ export async function generateAbstract(next = false): Promise<any> {
// 计费
!userApiKey &&
vectorResponse.length > 0 &&
splitContents.length > 0 &&
pushSplitDataBill({
userId: dataItem.userId,
type: 'abstract',
......@@ -134,7 +134,7 @@ export async function generateAbstract(next = false): Promise<any> {
'生成摘要成功,time:',
`${(Date.now() - startTime) / 1000}s`,
'摘要数量:',
vectorResponse.length
splitContents.length
);
} catch (error: any) {
console.log('error: 生成摘要错误', dataItem?._id);
......@@ -157,7 +157,7 @@ export async function generateAbstract(next = false): Promise<any> {
* 检查文本是否按格式返回
*/
function splitText(text: string) {
const regex = /\(\d+\):(\s*)(.*)(\s*)/g;
const regex = /A:(\s*)(.*)(\s*)/g;
const matches = text.matchAll(regex); // 获取所有匹配到的结果
const result = []; // 存储最终的结果
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment