Skip to content

Commit fb43570

Browse files
committed
Call user pre_filter_cb before internal decimation of YouTube items in order to make complete items to be available.
1 parent ff44ed9 commit fb43570

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ Message broker between YouTube chat stream and ChatGPT.
147147
| interval_sec | Interval of ChatGPT API call | 20.0 \[sec\] |
148148
### Notice
149149
- Please refer [pytchat README](https://github.com/taizan-hokuto/pytchat) to know the type of YouTube Chat item used by get_item_cb, pre_filter_cb and post filter_cb.
150-
- Stamps in a message and messages consisted by stamps only are removed defaultly even if user doesn't set pre_filter_cb.
150+
- Emoticons in a message and messages consisted by emoticons only are removed defaultly even if user doesn't set pre_filter_cb.
151151
- Default value of interval_sec is 20.0, since free user of OpenAI API can get only 3 completions per minitue.
152152
- The system role given by user remains ever as the oldest sentence of current context even if the number of messages is reached to the maximum, so ChatGPT doesn't forgot the role while current cunversation.
153153

@@ -182,6 +182,7 @@ And other [threading.Thread](https://docs.python.org/3/library/threading.html) p
182182
- pre putting queue filter.
183183
- YouTube chat item is thrown as an argument.
184184
- You can edit YouTube chat items before putting internal queue.
185+
- <b>If you want to get Complete items from YouTube, please implement this callback, since emoticons in a message and messages consisted by emoticons only are already removed from the items gotten in get_item_cb.</b>
185186
- It's required that edited chat item is returned.
186187
- You can avoid putting internal queue by returning None.
187188
### post_filter_cb

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def _requires_from_file(filename):
1212

1313
setup(
1414
name="chatai-stream",
15-
version="0.0.1",
15+
version="0.0.2",
1616
license="MIT",
1717
description="ChatGPT reacts YouTube chat messages.",
1818
author="General Yadoc",
@@ -34,4 +34,4 @@ def _requires_from_file(filename):
3434
install_requires=_requires_from_file('requirements.txt'),
3535
setup_requires=["pytest-runner"],
3636
tests_require=["pytest", "pytest-cov"]
37-
)
37+
)

src/ChatAIStream.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ class params():
1717
class ChatAIStream(threading.Thread):
1818
def my_pre_filter_cb(self, c):
1919
prefiltered_c = c
20-
prefiltered_c.message = re.sub(r':[^:]+:', ".", prefiltered_c.message)
21-
prefiltered_c.message = re.sub(r'^[\.]+', "", prefiltered_c.message)
2220
if prefiltered_c and self.pre_filter_cb:
2321
prefiltered_c = self.pre_filter_cb(prefiltered_c)
22+
prefiltered_c.message = re.sub(r':[^:]+:', ".", prefiltered_c.message)
23+
prefiltered_c.message = re.sub(r'^[\.]+', "", prefiltered_c.message)
2424
return None if prefiltered_c.message == "" else prefiltered_c
2525

2626
def ask_stream_message_to_ai(self, c):

src/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
from .ChatAIStream import *
22

3-
__version__ = '0.0.1'
3+
__version__ = '0.0.2'

0 commit comments

Comments
 (0)