Skip to content

Commit b7c1063

Browse files
authored
Feat/new env config (#78)
* fix: command in readme * feat(core): update config for connectivity test
1 parent 9b6fcc6 commit b7c1063

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

connectivity-test/tests/connectivity.test.ts

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,19 @@ vi.setConfig({
2929
const imagePath = join(__dirname, "some_logo.png");
3030
const imageBase64 = localImg2Base64(imagePath);
3131

32-
const model = process.env.MIDSCENE_MODEL_NAME || "gpt-4o";
32+
const model = process.env.MIDSCENE_MODEL_NAME || '';
33+
const apiKey = process.env.MIDSCENE_MODEL_API_KEY /* recommended */ || process.env.OPENAI_API_KEY;
34+
const baseURL = process.env.MIDSCENE_MODEL_BASE_URL /* recommended */ || process.env.OPENAI_BASE_URL;
3335
describe("Use OpenAI SDK directly", () => {
36+
beforeAll(() => {
37+
expect(model).toBeDefined();
38+
expect(apiKey).toBeDefined();
39+
expect(baseURL).toBeDefined();
40+
});
3441
it(`basic call with ${model}`, async () => {
3542
const openai = new OpenAI({
36-
apiKey: process.env.OPENAI_API_KEY,
37-
baseURL: process.env.OPENAI_BASE_URL,
43+
apiKey,
44+
baseURL,
3845
});
3946
const response = await openai.chat.completions.create({
4047
model: model,
@@ -46,8 +53,8 @@ describe("Use OpenAI SDK directly", () => {
4653

4754
it(`image input with ${model}`, async () => {
4855
const openai = new OpenAI({
49-
apiKey: process.env.OPENAI_API_KEY,
50-
baseURL: process.env.OPENAI_BASE_URL,
56+
apiKey,
57+
baseURL,
5158
});
5259

5360
const response = await openai.chat.completions.create({
@@ -103,7 +110,8 @@ describe("Use Midscene wrapped OpenAI SDK", () => {
103110
});
104111
});
105112

106-
// remove the ".skip" if you want to test Azure OpenAI Service
113+
// It's no longer supported in Midscene 1.x
114+
// remove the ".skip" if you want to test Azure OpenAI Service in Midscene 0.x
107115
describe.skip("Azure OpenAI Service by ADT Credential", () => {
108116
it("basic call", async () => {
109117
// sample code: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/openai/openai/samples/cookbook/simpleCompletionsPage/app.js

0 commit comments

Comments
 (0)