AI 移行 #38

マージ済み
みてるぞ が 49 個のコミットを ai-migration から main へマージ 2025-12-03 02:02:36 +09:00
5個のファイルの変更20行の追加12行の削除
コミット af862a7981 の変更だけを表示してゐます - すべてのコミットを表示
+1 -1
ファイルの表示
@@ -1,5 +1,5 @@
/connection.py
/__pycache__
__pycache__
/nizika_talking.wav
/youtube.py
/log.txt
ファイルの表示
+2
ファイルの表示
@@ -0,0 +1,2 @@
[mypy]
disable_error_code = import-untyped
サブモジュール nizika_ai が更新されました: 662b7d69de...ed1085535e
+16 -10
ファイルの表示
@@ -10,21 +10,22 @@ from typing import Callable, TypedDict
import cv2
import emoji
import ephem # type: ignore
import ephem
import pygame
import pygame.gfxdraw
import pytchat # type: ignore
import pytchat
import requests
from cv2 import VideoCapture
from ephem import Moon, Observer, Sun # type: ignore
from ephem import Moon, Observer, Sun
from pygame import Rect, Surface
from pygame.font import Font
from pygame.mixer import Sound
from pygame.time import Clock
from pytchat.core.pytchat import PytchatCore # type: ignore
from pytchat.processors.default.processor import Chat # type: ignore
from pytchat.core.pytchat import PytchatCore
from pytchat.processors.default.processor import Chat
from common_module import CommonModule
from nizika_ai.config import DB
from nizika_ai.models import Answer, AnsweredFlag, Query, User
from nizika_ai.consts import AnswerType, Character, GPTModel, Platform, QueryType
@@ -58,16 +59,18 @@ def main (
if event.type == pygame.QUIT:
pygame.quit ()
sys.exit ()
answer_flags = (AnsweredFlag.where ('platform', Platform.YOUTUBE.value)
.where ('answered', False)
.get ())
if not balloon.enabled:
answer_flags = (AnsweredFlag.where ('platform', Platform.YOUTUBE.value)
.where ('answered', False)
.get ())
if answer_flags:
answer_id: int = random.choice (answer_flags).answer_id
answer = Answer.find (answer_id)
answer_flag = random.choice (answer_flags)
answer = Answer.find (answer_flag.answer_id)
if answer.answer_type == AnswerType.YOUTUBE_REPLY.value:
query = Query.find (answer.query_id)
balloon.talk (query.content, answer.content)
answer_flag.answered = True
answer_flag.save ()
add_query (broadcast)
game.redraw ()
@@ -705,6 +708,7 @@ def add_query (
chat = broadcast.fetch_chat ()
if chat is None:
return
DB.begin_transaction ()
chat.message = emoji.emojize (chat.message)
message: str = chat.message
user = (User.where ('platform', Platform.YOUTUBE.value)
@@ -726,6 +730,8 @@ def add_query (
query.sent_at = datetime.now ()
query.answerd = False
query.save ()
DB.commit ()
if __name__ == '__main__':
main ()