@@ -9,14 +9,14 @@ const model = genAI.getGenerativeModel({
9
9
model : 'gemini-1.5-pro' ,
10
10
tools : [
11
11
{
12
- codeExecution : { } ,
13
- } ,
14
- ] ,
12
+ codeExecution : { }
13
+ }
14
+ ]
15
15
} ) ;
16
16
17
17
const rl = readline . createInterface ( {
18
18
input : process . stdin ,
19
- output : process . stdout ,
19
+ output : process . stdout
20
20
} ) ;
21
21
22
22
async function askQuestion ( query ) {
@@ -30,9 +30,7 @@ async function askQuestion(query) {
30
30
async function main ( ) {
31
31
while ( true ) {
32
32
try {
33
- const userQuestion1 = await askQuestion (
34
- "Enter your condition (or type 'exit' to quit): "
35
- ) ;
33
+ const userQuestion1 = await askQuestion ( "Enter your condition (or type 'exit' to quit): " ) ;
36
34
37
35
if ( userQuestion1 . toLowerCase ( ) === 'exit' ) {
38
36
console . log ( 'Exiting the program. Goodbye!' ) ;
@@ -41,9 +39,7 @@ async function main() {
41
39
}
42
40
let userQuestion2 ;
43
41
if ( userQuestion1 !== '' ) {
44
- userQuestion2 = await askQuestion (
45
- "Enter your question (or type 'exit' to quit): "
46
- ) ;
42
+ userQuestion2 = await askQuestion ( "Enter your question (or type 'exit' to quit): " ) ;
47
43
if ( userQuestion2 . toLowerCase ( ) === 'exit' ) {
48
44
console . log ( 'Exiting the program. Goodbye!' ) ;
49
45
rl . close ( ) ;
@@ -52,10 +48,8 @@ async function main() {
52
48
}
53
49
54
50
if ( userQuestion1 !== '' && userQuestion2 !== '' ) {
55
- const result = await model . generateContent (
56
- userQuestion1 + userQuestion2
57
- ) ;
58
- const response = result . response ;
51
+ const result = await model . generateContent ( userQuestion1 + userQuestion2 ) ;
52
+ console . log ( 'Response:' , result . response ) ;
59
53
}
60
54
} catch ( error ) {
61
55
console . error ( 'An error occurred:' , error ) ;
0 commit comments