Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
赵月辉
/
fastgpt-migrated
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Unverified
Commit
881c3654
authored
Apr 06, 2023
by
archer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perf: 连续手动输入数据
parent
f88c6031
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
8 deletions
+12
-8
src/pages/model/detail/components/InputDataModal.tsx
+7
-4
src/service/events/generateQA.ts
+5
-4
No files found.
src/pages/model/detail/components/InputDataModal.tsx
View file @
881c3654
...
@@ -35,7 +35,7 @@ const InputDataModal = ({
...
@@ -35,7 +35,7 @@ const InputDataModal = ({
const
[
importing
,
setImporting
]
=
useState
(
false
);
const
[
importing
,
setImporting
]
=
useState
(
false
);
const
{
toast
}
=
useToast
();
const
{
toast
}
=
useToast
();
const
{
register
,
handleSubmit
}
=
useForm
<
FormData
>
({
const
{
register
,
handleSubmit
,
reset
}
=
useForm
<
FormData
>
({
defaultValues
defaultValues
});
});
...
@@ -64,14 +64,17 @@ const InputDataModal = ({
...
@@ -64,14 +64,17 @@ const InputDataModal = ({
title
:
res
===
0
?
'导入数据成功,需要一段时间训练'
:
'数据导入异常'
,
title
:
res
===
0
?
'导入数据成功,需要一段时间训练'
:
'数据导入异常'
,
status
:
res
===
0
?
'success'
:
'warning'
status
:
res
===
0
?
'success'
:
'warning'
});
});
onClose
();
reset
({
text
:
''
,
q
:
''
});
onSuccess
();
onSuccess
();
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
log
(
err
);
console
.
log
(
err
);
}
}
setImporting
(
false
);
setImporting
(
false
);
},
},
[
modelId
,
on
Close
,
onSuccess
,
toast
]
[
modelId
,
on
Success
,
reset
,
toast
]
);
);
const
updateData
=
useCallback
(
const
updateData
=
useCallback
(
...
@@ -91,7 +94,7 @@ const InputDataModal = ({
...
@@ -91,7 +94,7 @@ const InputDataModal = ({
onClose
();
onClose
();
onSuccess
();
onSuccess
();
},
},
[
defaultValues
.
q
,
onClose
,
onSuccess
,
toast
]
[
defaultValues
,
onClose
,
onSuccess
,
toast
]
);
);
return
(
return
(
...
...
src/service/events/generateQA.ts
View file @
881c3654
...
@@ -97,18 +97,19 @@ export async function generateQA(next = false): Promise<any> {
...
@@ -97,18 +97,19 @@ export async function generateQA(next = false): Promise<any> {
}
}
)
)
.
then
((
res
)
=>
{
.
then
((
res
)
=>
{
const
rawContent
=
res
?.
data
.
choices
[
0
].
message
?.
content
||
''
;
const
rawContent
=
res
?.
data
.
choices
[
0
].
message
?.
content
||
''
;
// chatgpt 原本的回复
const
result
=
splitText
(
res
?.
data
.
choices
[
0
].
message
?.
content
||
''
);
// 格式化后的QA对
// 计费
// 计费
pushSplitDataBill
({
pushSplitDataBill
({
isPay
:
!
userApiKey
,
isPay
:
!
userApiKey
&&
result
.
length
>
0
,
userId
:
dataItem
.
userId
,
userId
:
dataItem
.
userId
,
type
:
'QA'
,
type
:
'QA'
,
text
:
systemPrompt
.
content
+
text
+
rawContent
,
text
:
systemPrompt
.
content
+
text
+
rawContent
,
tokenLen
:
res
.
data
.
usage
?.
total_tokens
||
0
tokenLen
:
res
.
data
.
usage
?.
total_tokens
||
0
});
});
return
{
return
{
rawContent
,
// chatgpt 原本的回复
rawContent
,
result
:
splitText
(
res
?.
data
.
choices
[
0
].
message
?.
content
||
''
)
// 格式化后的QA对
result
};
};
})
})
)
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment