1
- """Scaffolding to host your LangChain Chatbot on Steamship and connect it to Telegram."""
2
1
import re
3
2
from typing import List , Optional , Type
4
3
27
26
28
27
29
28
class GirlFriendGPTConfig (TelegramTransportConfig ):
30
- bot_token : str = Field (
31
- description = "Your telegram bot token.\n Learn how to create one here: "
32
- "https://github.com/EniasCailliau/GirlfriendGPT/blob/main/docs/register-telegram-bot.md"
33
- )
34
29
elevenlabs_api_key : str = Field (
35
30
default = "" , description = "Optional API KEY for ElevenLabs Voice Bot"
36
31
)
@@ -47,7 +42,7 @@ class GirlFriendGPTConfig(TelegramTransportConfig):
47
42
use_gpt4 : bool = Field (
48
43
True ,
49
44
description = "If True, use GPT-4. Use GPT-3.5 if False. "
50
- "GPT-4 generates better responses at higher cost and latency." ,
45
+ "GPT-4 generates better responses at higher cost and latency." ,
51
46
)
52
47
53
48
@@ -116,31 +111,8 @@ def __init__(self, **kwargs):
116
111
# This Mixin provides HTTP endpoints that connects this agent to Telegram
117
112
self .add_mixin (IndexerPipelineMixin (client = self .client , invocable = self ))
118
113
119
- def limit_exceeded (self , context : AgentContext ):
120
- if hasattr (self .config , "chat_ids" ) and self .config .chat_ids :
121
- if len (context .chat_history .messages ) / 2 > MAX_FREE_MESSAGES :
122
-
123
- for func in context .emit_funcs :
124
- func (
125
- [
126
- Block (text = "Thanks for trying out SachaGPT!" ),
127
- Block (
128
- text = "Please deploy your own version GirlfriendGPT to continue chatting."
129
- ),
130
- Block (
131
- text = "Learn how on: https://github.com/EniasCailliau/GirlfriendGPT/"
132
- ),
133
- ],
134
- context .metadata ,
135
- )
136
- return True
137
- return False
138
-
139
114
def run_agent (self , agent : Agent , context : AgentContext ):
140
115
"""Override run-agent to patch in audio generation as a finishing step for text output."""
141
- if self .limit_exceeded (context ):
142
- return
143
-
144
116
speech = self .voice_tool ()
145
117
146
118
# Note: EmitFunc is Callable[[List[Block], Metadata], None]
0 commit comments