Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Q
qk_backend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
quanku
qk_backend
Commits
d6a04775
Commit
d6a04775
authored
Oct 26, 2023
by
shiyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
默认ai问题列表
parent
532558f9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
6 deletions
+14
-6
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/AiDefaultQuestionServiceImpl.java
...ava/com/wwdz/ch/wx/impl/AiDefaultQuestionServiceImpl.java
+5
-4
ch-wx-api/src/test/java/com/wwdz/ch/wx/api/ChatApiTest.java
ch-wx-api/src/test/java/com/wwdz/ch/wx/api/ChatApiTest.java
+9
-2
No files found.
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/AiDefaultQuestionServiceImpl.java
View file @
d6a04775
...
@@ -46,15 +46,16 @@ public class AiDefaultQuestionServiceImpl implements AiDefaultQuestionService {
...
@@ -46,15 +46,16 @@ public class AiDefaultQuestionServiceImpl implements AiDefaultQuestionService {
@Override
@Override
public
Result
findList
(
AiDefaultQuestionRequestDto
dto
)
{
public
Result
findList
(
AiDefaultQuestionRequestDto
dto
)
{
try
{
try
{
String
key
=
AI_DEFAULT_QUESTION_KEY_PREFIX
+
dto
.
getUserId
();
if
(
redisUtils
.
hasKey
(
key
)
&&
dto
.
getIsChangeList
()
==
0
){
return
Result
.
success
();
}
//查询机器人信息
//查询机器人信息
AiAssistant
aiAssistant
=
aiAssistantDao
.
findByCode
(
imUtil
.
revertAppletUserId
(
dto
.
getCode
()));
AiAssistant
aiAssistant
=
aiAssistantDao
.
findByCode
(
imUtil
.
revertAppletUserId
(
dto
.
getCode
()));
if
(
aiAssistant
==
null
)
{
if
(
aiAssistant
==
null
)
{
return
Result
.
success
();
return
Result
.
success
();
}
}
String
key
=
AI_DEFAULT_QUESTION_KEY_PREFIX
+
dto
.
getUserId
()
+
":"
+
aiAssistant
.
getCode
();
if
(
redisUtils
.
hasKey
(
key
)
&&
dto
.
getIsChangeList
()
==
0
){
return
Result
.
success
();
}
dto
.
setType
(
aiAssistant
.
getType
());
dto
.
setType
(
aiAssistant
.
getType
());
List
<
AiDefaultQuestion
>
aiDefaultQuestionList
=
aiDefaultQuestionDao
.
findList
(
dto
);
List
<
AiDefaultQuestion
>
aiDefaultQuestionList
=
aiDefaultQuestionDao
.
findList
(
dto
);
...
...
ch-wx-api/src/test/java/com/wwdz/ch/wx/api/ChatApiTest.java
View file @
d6a04775
...
@@ -7,6 +7,7 @@ import com.wwdz.ch.core.im.api.ChatUserApi;
...
@@ -7,6 +7,7 @@ import com.wwdz.ch.core.im.api.ChatUserApi;
import
com.wwdz.ch.core.im.api.ConversationApi
;
import
com.wwdz.ch.core.im.api.ConversationApi
;
import
com.wwdz.ch.core.im.api.TLSSigApi
;
import
com.wwdz.ch.core.im.api.TLSSigApi
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.core.util.RedisUtils
;
import
com.wwdz.ch.db.dao.AiAssistantDao
;
import
com.wwdz.ch.db.dao.AiAssistantDao
;
import
com.wwdz.ch.db.dao.UserDao
;
import
com.wwdz.ch.db.dao.UserDao
;
import
com.wwdz.ch.db.domain.AiAssistant
;
import
com.wwdz.ch.db.domain.AiAssistant
;
...
@@ -43,6 +44,9 @@ public class ChatApiTest {
...
@@ -43,6 +44,9 @@ public class ChatApiTest {
@Autowired
@Autowired
AiAssistantDao
aiAssistantDao
;
AiAssistantDao
aiAssistantDao
;
@Autowired
RedisUtils
redisUtils
;
@Test
@Test
public
void
chatWithModel
()
{
public
void
chatWithModel
()
{
String
question
=
"伟伟伟伟伟伟伟伟伟伟伟伟伟伟伟伟伟伟小伟伟"
;
String
question
=
"伟伟伟伟伟伟伟伟伟伟伟伟伟伟伟伟伟伟小伟伟"
;
...
@@ -116,7 +120,7 @@ public class ChatApiTest {
...
@@ -116,7 +120,7 @@ public class ChatApiTest {
sendChatMsgRequestDto
.
setFromAccount
(
"ai10000"
);
sendChatMsgRequestDto
.
setFromAccount
(
"ai10000"
);
sendChatMsgRequestDto
.
setMsgType
(
IMEnum
.
MsgTypeEnum
.
TIMTextElem
.
getCode
());
sendChatMsgRequestDto
.
setMsgType
(
IMEnum
.
MsgTypeEnum
.
TIMTextElem
.
getCode
());
long
timestamp
=
System
.
currentTimeMillis
();
long
timestamp
=
System
.
currentTimeMillis
();
String
msgContent
=
"Hi,欢迎来到
小藏
的世界"
;
String
msgContent
=
"Hi,欢迎来到
老猫
的世界"
;
sendChatMsgRequestDto
.
setMsgContent
(
msgContent
);
sendChatMsgRequestDto
.
setMsgContent
(
msgContent
);
conversationApi
.
sendChatMsg
(
sendChatMsgRequestDto
);
conversationApi
.
sendChatMsg
(
sendChatMsgRequestDto
);
});
});
...
@@ -132,6 +136,9 @@ public class ChatApiTest {
...
@@ -132,6 +136,9 @@ public class ChatApiTest {
conversationApi
.
getChatList
(
imChatRequestDto
);
conversationApi
.
getChatList
(
imChatRequestDto
);
}
}
@Test
public
void
getKeyExpire
()
{
System
.
out
.
println
(
redisUtils
.
getExpire
(
"AI-DEFAULT-QUESTION:269"
));
}
}
}
\ No newline at end of file
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