File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ export const MAX_TRIES = 3
35
35
const LLAMA_PREFIX_LIST = [ '* ' ]
36
36
const BARD_PREFIX_LIST = [ 'b. ' , 'B. ' ]
37
37
const CLAUDE_OPUS_PREFIX_LIST = [ 'c. ' ]
38
+ const GEMINI_PREFIX_LIST = [ 'g. ' ]
38
39
39
40
export const isMentioned = (
40
41
ctx : OnMessageContext | OnCallBackQueryData
@@ -82,6 +83,16 @@ export const hasClaudeOpusPrefix = (prompt: string): string => {
82
83
return ''
83
84
}
84
85
86
+ export const hasGeminiPrefix = ( prompt : string ) : string => {
87
+ const prefixList = GEMINI_PREFIX_LIST
88
+ for ( let i = 0 ; i < prefixList . length ; i ++ ) {
89
+ if ( prompt . toLocaleLowerCase ( ) . startsWith ( prefixList [ i ] ) ) {
90
+ return prefixList [ i ]
91
+ }
92
+ }
93
+ return ''
94
+ }
95
+
85
96
export const hasUrl = (
86
97
ctx : OnMessageContext | OnCallBackQueryData ,
87
98
prompt : string
@@ -213,7 +224,7 @@ export const sendMessage = async (
213
224
214
225
export const hasPrefix = ( prompt : string ) : string => {
215
226
return (
216
- hasBardPrefix ( prompt ) || hasLlamaPrefix ( prompt ) || hasClaudeOpusPrefix ( prompt )
227
+ hasBardPrefix ( prompt ) || hasLlamaPrefix ( prompt ) || hasClaudeOpusPrefix ( prompt ) || hasGeminiPrefix ( prompt )
217
228
)
218
229
}
219
230
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ import {
22
22
getPromptPrice ,
23
23
hasBardPrefix ,
24
24
hasClaudeOpusPrefix ,
25
+ hasGeminiPrefix ,
25
26
hasLlamaPrefix ,
26
27
hasPrefix ,
27
28
hasUrl ,
@@ -129,7 +130,7 @@ export class LlmsBot implements PayableBot {
129
130
await this . onChat ( ctx , LlmsModelsEnum . BISON )
130
131
return
131
132
}
132
- if ( ctx . hasCommand ( SupportedCommands . gemini ) || ctx . hasCommand ( SupportedCommands . gShort ) ) {
133
+ if ( ctx . hasCommand ( [ SupportedCommands . gemini , SupportedCommands . gShort ] ) || ( hasGeminiPrefix ( ctx . message ?. text ?? '' ) !== '' ) ) {
133
134
await this . onChat ( ctx , LlmsModelsEnum . GEMINI )
134
135
return
135
136
}
You can’t perform that action at this time.
0 commit comments