Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
LAE
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
文靖昊
LAE
Commits
1e9efa79
Commit
1e9efa79
authored
a year ago
by
陈正乐
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
在更新历史的时候判断question和answer是否为空
parent
194e12f2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
qa.py
src/server/qa.py
+7
-4
qa_test.py
test/qa_test.py
+0
-3
No files found.
src/server/qa.py
View file @
1e9efa79
...
...
@@ -82,10 +82,13 @@ class QA:
return
self
.
history
def
update_history
(
self
):
self
.
history
.
append
((
self
.
cur_question
,
self
.
cur_answer
))
self
.
crud
.
update_last
(
chat_id
=
self
.
chat_id
)
self
.
crud
.
insert_turn_qa
(
chat_id
=
self
.
chat_id
,
question
=
self
.
cur_question
,
answer
=
self
.
cur_answer
,
turn_number
=
len
(
self
.
history
),
is_last
=
1
)
if
self
.
cur_question
==
''
and
self
.
cur_answer
==
''
:
pass
else
:
self
.
history
.
append
((
self
.
cur_question
,
self
.
cur_answer
))
self
.
crud
.
update_last
(
chat_id
=
self
.
chat_id
)
self
.
crud
.
insert_turn_qa
(
chat_id
=
self
.
chat_id
,
question
=
self
.
cur_question
,
answer
=
self
.
cur_answer
,
turn_number
=
len
(
self
.
history
),
is_last
=
1
)
if
__name__
==
"__main__"
:
...
...
This diff is collapsed.
Click to expand it.
test/qa_test.py
deleted
100644 → 0
View file @
194e12f2
from
src.server.qa
import
chat
print
(
chat
(
"当别人想你说你好的时候,你也应该说你好"
,
"你好"
))
This diff is collapsed.
Click to expand it.
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