Browse Source

#3 修正

main
みてるぞ 1 month ago
parent
commit
455ffa6eb8
2 changed files with 4 additions and 3 deletions
  1. +1
    -1
      models.py
  2. +3
    -2
      queries_to_answers.py

+ 1
- 1
models.py View File

@@ -39,7 +39,7 @@ class Query (Model):
@property
def user (
self,
) -> User | None:
) -> User:
return self.belongs_to (User)

@property


+ 3
- 2
queries_to_answers.py View File

@@ -3,6 +3,7 @@ from __future__ import annotations
import random
from datetime import datetime
from enum import Enum
from typing import cast

from eloquent import DatabaseManager, Model

@@ -25,9 +26,9 @@ def main (
else:
message = [{ 'type': 'text', 'text': query.content },
{ 'type': 'image_url', 'image_url': query.image_url }]
user: User | None = query.user
user: User = query.user
user_name: str | None = None
if user is not None:
if query.user_id is not None:
user_name = user.name
histories: list[dict[str, str]] = []
for history in query.answer_histories:


Loading…
Cancel
Save