File tree Expand file tree Collapse file tree 3 files changed +12
-1
lines changed Expand file tree Collapse file tree 3 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,8 @@ const mailer = require("./mailer");
11
11
const {
12
12
ASSISTANT_ID ,
13
13
AZURE_DEPLOYMENT_NAME ,
14
- EMAIL_RECEIVER
14
+ EMAIL_RECEIVER ,
15
+ OPENAI_FUNCTION_CALLING_SKIP_SEND_EMAIL
15
16
} = process . env ;
16
17
17
18
// Important: Errors handlings are removed intentionally. If you are using this sample in production
@@ -213,6 +214,11 @@ async function getStockPrice(symbol) {
213
214
}
214
215
215
216
async function writeAndSendEmail ( subject , html ) {
217
+ if ( OPENAI_FUNCTION_CALLING_SKIP_SEND_EMAIL === 'true' ) {
218
+ console . log ( 'Dry mode emabled. Skip sending emails' ) ;
219
+ return 'Fake email sent!!' ;
220
+ }
221
+
216
222
const info = await mailer . sendEmail ( {
217
223
to : EMAIL_RECEIVER , subject, html
218
224
} ) ;
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ var assistantGpt = {
27
27
deploymentCapacity : 10
28
28
}
29
29
30
+ param OPENAI_FUNCTION_CALLING_SKIP_SEND_EMAIL string = 'true' // Set in main.parameters.json
30
31
param openAiLocation string // Set in main.parameters.json
31
32
param openAiSkuName string = 'S0'
32
33
param openAiUrl string = ''
@@ -77,6 +78,7 @@ module api './core/host/functions.bicep' = {
77
78
AZURE_OPENAI_ENDPOINT : finalOpenAiUrl
78
79
AZURE_DEPLOYMENT_NAME : assistantGpt .deploymentName
79
80
OPENAI_API_VERSION : openAiApiVersion
81
+ OPENAI_FUNCTION_CALLING_SKIP_SEND_EMAIL : OPENAI_FUNCTION_CALLING_SKIP_SEND_EMAIL
80
82
}
81
83
}
82
84
dependsOn : empty (openAiUrl ) ? [] : [openAi ]
Original file line number Diff line number Diff line change 31
31
},
32
32
"azureDeploymentName" : {
33
33
"value" : " ${AZURE_DEPLOYMENT_NAME=gpt-35-turbo}"
34
+ },
35
+ "OPENAI_FUNCTION_CALLING_SKIP_SEND_EMAIL" : {
36
+ "value" : " ${OPENAI_FUNCTION_CALLING_SKIP_SEND_EMAIL=true}"
34
37
}
35
38
}
36
39
}
You can’t perform that action at this time.
0 commit comments