Skip to content

Commit b01abdb

Browse files
committed
v0.8.1
1 parent 36267de commit b01abdb

3 files changed

Lines changed: 32 additions & 4 deletions

File tree

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,10 @@ If you run into any issues, consult the logs or reach out on the repository's [I
240240
---
241241

242242
# Changelog
243+
- v0.8.1 - Startup status banner cleanup
244+
- Added Perplexity API enabled/disabled status to the startup banner.
245+
- Reads Perplexity status from `[Perplexity] -> Enabled` in `config.ini`.
246+
- Kept startup/config handling simple and centralized in `utils.py`.
243247
- v0.8.0 - OpenAI 5.x-era cleanup + Perplexity/DuckDuckGo compatibility hardening
244248
- Refactored `src/api_perplexity_search.py` for the current Perplexity/Sonar API workflow.
245249
- Kept Perplexity on the OpenAI-compatible Chat Completions endpoint by default:

src/main.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# https://github.com/FlyingFathead/TelegramBot-OpenAI-API
77
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
88
# version of this program
9-
version_number = "0.8.0"
9+
version_number = "0.8.1"
1010

1111
# Add the project root directory to Python's path
1212
import sys
@@ -135,6 +135,7 @@ def setup_logging(chat_logging_enabled: bool):
135135
# Initialize the tokenizer globally
136136
tokenizer = GPT2Tokenizer.from_pretrained("gpt2")
137137

138+
# bot class
138139
class TelegramBot:
139140
# version of this program
140141
version_number = version_number
@@ -543,7 +544,7 @@ def main():
543544
# 1) Read config
544545
config = configparser.ConfigParser()
545546
config.read(CONFIG_PATH)
546-
chat_logging_enabled = config['DEFAULT'].getboolean('ChatLoggingEnabled', False)
547+
chat_logging_enabled = config["DEFAULT"].getboolean("ChatLoggingEnabled", False)
547548

548549
# 2) Actually call our logging setup
549550
setup_logging(chat_logging_enabled=chat_logging_enabled)

src/utils.py

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,24 @@
1818
ELASTICSEARCH_USERNAME, ELASTICSEARCH_PASSWORD
1919
)
2020

21+
# check perplexity.ai API status
22+
def get_perplexity_enabled(config):
23+
"""
24+
Read the canonical Perplexity API enabled flag.
25+
26+
Source of truth:
27+
[Perplexity]
28+
Enabled = True/False
29+
"""
30+
if config is None:
31+
return False
32+
33+
return config.getboolean(
34+
"Perplexity",
35+
"Enabled",
36+
fallback=False
37+
)
38+
2139
# juhlapäivien käännösnimet
2240
holiday_replacements = {
2341
"New Year's Day": "uudenvuodenpäivä (New Year's Day)",
@@ -50,12 +68,17 @@ def hz_line(character='-'):
5068
sys.stdout.flush() # Flush the output to the terminal immediately
5169

5270
# print the startup message
53-
def print_startup_message(version_number):
71+
def print_startup_message(version_number, config=None):
5472
now = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
73+
perplexity_enabled = get_perplexity_enabled(config)
74+
5575
hz_line()
5676
print(f"::: [{now}] Telegram bot (powered by ChatKeke) v.{version_number} starting up...", flush=True)
57-
# Print Elasticsearch status
77+
78+
# Print optional module/API status
5879
print(f"::: Elasticsearch enabled: {ELASTICSEARCH_ENABLED}", flush=True)
80+
print(f"::: Perplexity.ai API enabled: {perplexity_enabled}", flush=True)
81+
5982
hz_line()
6083

6184
# remove html tags

0 commit comments

Comments
 (0)