Skip to content

Commit def3b63

Browse files
author
Enias Cailliau
committed
Simplify codebase
1 parent 31576bf commit def3b63

File tree

1 file changed

+1
-29
lines changed

1 file changed

+1
-29
lines changed

src/api.py

+1-29
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
"""Scaffolding to host your LangChain Chatbot on Steamship and connect it to Telegram."""
21
import re
32
from typing import List, Optional, Type
43

@@ -27,10 +26,6 @@
2726

2827

2928
class GirlFriendGPTConfig(TelegramTransportConfig):
30-
bot_token: str = Field(
31-
description="Your telegram bot token.\nLearn how to create one here: "
32-
"https://github.com/EniasCailliau/GirlfriendGPT/blob/main/docs/register-telegram-bot.md"
33-
)
3429
elevenlabs_api_key: str = Field(
3530
default="", description="Optional API KEY for ElevenLabs Voice Bot"
3631
)
@@ -47,7 +42,7 @@ class GirlFriendGPTConfig(TelegramTransportConfig):
4742
use_gpt4: bool = Field(
4843
True,
4944
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.",
5146
)
5247

5348

@@ -116,31 +111,8 @@ def __init__(self, **kwargs):
116111
# This Mixin provides HTTP endpoints that connects this agent to Telegram
117112
self.add_mixin(IndexerPipelineMixin(client=self.client, invocable=self))
118113

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-
139114
def run_agent(self, agent: Agent, context: AgentContext):
140115
"""Override run-agent to patch in audio generation as a finishing step for text output."""
141-
if self.limit_exceeded(context):
142-
return
143-
144116
speech = self.voice_tool()
145117

146118
# Note: EmitFunc is Callable[[List[Block], Metadata], None]

0 commit comments

Comments
 (0)