このコミットが含まれているのは:
2025-08-17 03:34:44 +09:00
コミット f5eb7e35af
3個のファイルの変更61行の追加28行の削除
+16 -6
ファイルの表示
@@ -9,7 +9,7 @@ from datetime import datetime
from typing import TypedDict
from nizika_ai.config import DB
from nizika_ai.consts import AnswerType, Character, Platform
from nizika_ai.consts import Character, Platform, QueryType
from nizika_ai.models import Answer, AnsweredFlag, Query
from nizika_ai.talk import Talk
@@ -83,7 +83,6 @@ def add_answer (
answer.character = character.value
answer.content = Talk.main (message, user_name, histories,
goatoh_mode = character == Character.GOATOH)
answer.answer_type = query.query_type
answer.sent_at = datetime.now ()
answer.save ()
add_answered_flags (answer)
@@ -101,15 +100,26 @@ def add_answered_flags (
返答モデル
"""
answer_type: AnswerType
answer_type: QueryType
try:
answer_type = AnswerType (answer.answer_type)
answer_type = QueryType (answer.query.query_type)
except (TypeError, ValueError):
return
if answer_type in (AnswerType.YOUTUBE_REPLY,):
if answer_type in (QueryType.YOUTUBE_COMMENT,
QueryType.YOUTUBE_COMMENT,
QueryType.KIRIBAN,
QueryType.NICO_REPORT,
QueryType.SNACK_TIME,
QueryType.HOT_SPRING):
add_answered_flag (answer, Platform.YOUTUBE)
if answer_type in (AnswerType.BLUESKY_REPLY,):
if answer_type in (QueryType.BLUESKY_COMMENT,
QueryType.BLUESKY_SYSTEM,
QueryType.KIRIBAN,
QueryType.NICO_REPORT,
QueryType.SNACK_TIME,
QueryType.HOT_SPRING):
add_answered_flag (answer, Platform.BLUESKY)