perf: 文本
This commit is contained in:
@@ -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 = []; // 存储最终的结果
|
||||
|
||||
Reference in New Issue
Block a user