Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
ai-chat-agent
Project
Project
Details
Activity
Releases
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
李超鹏
ai-chat-agent
Commits
fe28535e
Commit
fe28535e
authored
Dec 27, 2023
by
李超鹏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
历史记录接口
parent
0f1badb5
Pipeline
#7457
canceled with stages
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
5 deletions
+25
-5
KnowledgeService.java
src/main/java/cc/shenjiying/ai/manager/KnowledgeService.java
+9
-3
Question.java
...ain/java/cc/shenjiying/ai/repository/entity/Question.java
+4
-1
KnowLedgeResource.java
...ain/java/cc/shenjiying/ai/resource/KnowLedgeResource.java
+12
-1
No files found.
src/main/java/cc/shenjiying/ai/manager/KnowledgeService.java
View file @
fe28535e
...
@@ -94,9 +94,15 @@ public class KnowledgeService {
...
@@ -94,9 +94,15 @@ public class KnowledgeService {
return
entity
.
getId
();
return
entity
.
getId
();
}
}
public
List
<
Question
>
history
(
Long
pageNum
,
Long
pageSize
)
{
public
Page
<
Question
>
history
(
Long
pageNum
,
Long
pageSize
)
{
return
questionMapper
.
selectList
(
new
Page
<>(
pageNum
,
pageSize
),
new
LambdaQueryWrapper
<
Question
>().
eq
(
Question:
:
getUserId
,
QuestionerHolder
.
getId
())
.
orderByDesc
(
Question:
:
getCreateTime
));
return
questionMapper
.
selectPage
(
new
Page
<>(
pageNum
,
pageSize
),
new
LambdaQueryWrapper
<
Question
>().
eq
(
Question:
:
getUserId
,
QuestionerHolder
.
getId
())
.
orderByDesc
(
Question:
:
getCreateTime
).
eq
(
Question:
:
getDeleteFlag
,
0
));
}
public
Boolean
deleteHistory
(
Long
questionId
)
{
questionMapper
.
update
(
new
Question
().
setDeleteFlag
(
1
),
new
LambdaQueryWrapper
<
Question
>().
eq
(
Question:
:
getId
,
questionId
).
eq
(
Question:
:
getUserId
,
QuestionerHolder
.
getId
()));
return
Boolean
.
TRUE
;
}
}
...
...
src/main/java/cc/shenjiying/ai/repository/entity/Question.java
View file @
fe28535e
...
@@ -22,7 +22,10 @@ public class Question {
...
@@ -22,7 +22,10 @@ public class Question {
@TableField
(
"answers"
)
@TableField
(
"answers"
)
private
String
answers
;
private
String
answers
;
@TableField
(
"correct"
)
@TableField
(
"correct"
)
private
int
correct
;
private
Integer
correct
;
@TableField
(
"create_time"
)
@TableField
(
"create_time"
)
private
LocalDateTime
createTime
;
private
LocalDateTime
createTime
;
@TableField
(
"delete_flag"
)
private
Integer
deleteFlag
;
}
}
src/main/java/cc/shenjiying/ai/resource/KnowLedgeResource.java
View file @
fe28535e
...
@@ -5,6 +5,8 @@ import cc.shenjiying.ai.dto.ChatAIResponse;
...
@@ -5,6 +5,8 @@ import cc.shenjiying.ai.dto.ChatAIResponse;
import
cc.shenjiying.ai.dto.FeedbackSaveDTO
;
import
cc.shenjiying.ai.dto.FeedbackSaveDTO
;
import
cc.shenjiying.ai.manager.KnowledgeService
;
import
cc.shenjiying.ai.manager.KnowledgeService
;
import
cc.shenjiying.ai.repository.entity.Question
;
import
cc.shenjiying.ai.repository.entity.Question
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.oracle.svm.core.annotate.Delete
;
import
io.quarkiverse.bucket4j.runtime.RateLimited
;
import
io.quarkiverse.bucket4j.runtime.RateLimited
;
import
io.smallrye.mutiny.Multi
;
import
io.smallrye.mutiny.Multi
;
import
io.smallrye.mutiny.Uni
;
import
io.smallrye.mutiny.Uni
;
...
@@ -70,10 +72,19 @@ public class KnowLedgeResource {
...
@@ -70,10 +72,19 @@ public class KnowLedgeResource {
@Path
(
"/history"
)
@Path
(
"/history"
)
@Operation
(
summary
=
"历史记录"
)
@Operation
(
summary
=
"历史记录"
)
@Produces
(
MediaType
.
APPLICATION_JSON
)
@Produces
(
MediaType
.
APPLICATION_JSON
)
public
List
<
Question
>
history
(
@RestQuery
(
"pageNum"
)
Long
pageNum
,
@RestQuery
(
"pageSize"
)
Long
pageSize
)
{
public
Page
<
Question
>
history
(
@RestQuery
(
"pageNum"
)
Long
pageNum
,
@RestQuery
(
"pageSize"
)
Long
pageSize
)
{
return
knowledgeService
.
history
(
pageNum
,
pageSize
);
return
knowledgeService
.
history
(
pageNum
,
pageSize
);
}
}
@DELETE
@Path
(
"/history/{id}"
)
@Operation
(
summary
=
"历史记录删除"
)
@Produces
(
MediaType
.
APPLICATION_JSON
)
public
Boolean
history
(
@PathParam
(
"id"
)
Long
id
)
{
return
knowledgeService
.
deleteHistory
(
id
);
}
}
}
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