diff --git a/src/test/java/com/northtecom/visatrack/api/OpenAiTest.java b/src/test/java/com/northtecom/visatrack/api/OpenAiTest.java index 349313a..e8d918a 100644 --- a/src/test/java/com/northtecom/visatrack/api/OpenAiTest.java +++ b/src/test/java/com/northtecom/visatrack/api/OpenAiTest.java @@ -22,9 +22,11 @@ import org.junit.jupiter.api.TestInstance; class OpenAiTest { private String wechatMessageStr = StringUtils.EMPTY; + private String openAiToken = StringUtils.EMPTY; @BeforeEach protected void setUp() throws Exception { + openAiToken = System.getenv("OPENAI_TOKEN"); this.wechatMessageStr = (" \n" + " \n" + " \n" + @@ -46,7 +48,7 @@ class OpenAiTest { @Test public void testToWeChatMessage() { - OpenAiService service = new OpenAiService("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", 30); + OpenAiService service = new OpenAiService(openAiToken, 30); CompletionRequest completionRequest = new CompletionRequestBuilder() .setPrompt("上海天气怎么样") .setModel("text-davinci-003")