Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on May 11, 2024. It is now read-only.

Commit 3be05bb

Browse files
修改单元测试时无法加载apikey和prompt的问题
1 parent ea73207 commit 3be05bb

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

‎src/test/java/com/gzhu/funai/service/TestChatService.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,21 +56,27 @@ public void chatOneShot(){
5656

5757
@Test
5858
public void chatSession(){
59+
adminApiKeyService.load();
5960
ChatGPTReq chatGPTReq = ChatGPTReq.builder().build();
6061
ChatGPTResp resp = chatService.sessionChat(
6162
"", 1, chatGPTReq,"我刚刚问了什么",
6263
adminApiKeyService.roundRobinGetByType(ApiType.OPENAI), SessionType.NORMAL_CHAT);
6364
System.out.println(resp.getMessage());
6465
}
6566

67+
/**
68+
* 改方法已废弃
69+
*/
6670
@Test
6771
public void testCreditGrants(){
72+
adminApiKeyService.load();
6873
CreditGrantsResp openAiCreditGrantsResp = chatService.creditGrants(adminApiKeyService.roundRobinGetByType(ApiType.OPENAI));
6974
System.out.println(openAiCreditGrantsResp);
7075
}
7176

7277
@Test
7378
public void testStreamSessionReq(){
79+
adminApiKeyService.load();
7480
String msg = "你好";
7581
ChatGPTReq chatGPTReq = ChatGPTReq.builder()
7682
.messages(ImmutableList.of(new ContextMessage(Role.USER.name, msg)))
@@ -93,6 +99,7 @@ public void testStreamSessionReq(){
9399

94100
@Test
95101
public void testStreamOneShotReq(){
102+
adminApiKeyService.load();
96103
String msg = "你好呀";
97104
ChatGPTReq chatGPTReq = ChatGPTReq.builder()
98105
.messages(ImmutableList.of(new ContextMessage(Role.USER.name, msg)))

‎src/test/java/com/gzhu/funai/service/TestFileChatService.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,13 @@ public class TestFileChatService {
3333
private FileChatService fileChatService;
3434
@Resource
3535
private AdminApiKeyService adminApiKeyService;
36+
@Resource
37+
private PromptService promptService;
3638

3739
@Test
3840
public void uploadFile(){
39-
41+
adminApiKeyService.load();
42+
promptService.load();
4043
//生成File文件
4144
File file = new File("D:\\!!笔记\\000学习\\6-专业前沿学习\\003-人工智能\\09-NLP相关论文\\14-chatgpt\\ChatGPT-SpringBoot\\src\\test\\java\\com\\gzhu\\funai\\service\\ICTAI2022_9_28___终稿.pdf");
4245

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /