コミットを比較
3 コミット
80d6c09967
...
sicawke
| 作成者 | SHA1 | 日付 | |
|---|---|---|---|
| 7277819b6e | |||
| 0b8e9812b9 | |||
| a00eaf7ff2 |
@@ -45,9 +45,3 @@ class CommonModule:
|
|||||||
|
|
||||||
return trimmed_left[:cls.index_by_f2c (trimmed_left, length)]
|
return trimmed_left[:cls.index_by_f2c (trimmed_left, length)]
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def rad_to_deg (
|
|
||||||
rad: float) \
|
|
||||||
-> float:
|
|
||||||
return rad * 180 / CMath.PI
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
# vim: nosmartindent autoindent
|
# vim: nosmartindent autoindent
|
||||||
|
|
||||||
import json
|
import json
|
||||||
|
import math
|
||||||
import random
|
import random
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
@@ -149,11 +150,13 @@ class Main:
|
|||||||
|
|
||||||
# 日の角度
|
# 日の角度
|
||||||
sun.compute (observer_with_time)
|
sun.compute (observer_with_time)
|
||||||
sun_alt: float = CommonModule.rad_to_deg (sun.alt)
|
sun_alt: float = math.degrees (sun.alt)
|
||||||
|
sun_az: float = math.degrees (sun.az)
|
||||||
|
|
||||||
# 月の角度
|
# 月の角度
|
||||||
moon.compute (observer_with_time)
|
moon.compute (observer_with_time)
|
||||||
moon_alt: float = CommonModule.rad_to_deg (moon.alt)
|
moon_alt: float = math.degrees (moon.alt)
|
||||||
|
moon_az: float = math.degrees (moon.az)
|
||||||
|
|
||||||
# 月齢
|
# 月齢
|
||||||
new_moon_dt: datetime = ephem.localtime (
|
new_moon_dt: datetime = ephem.localtime (
|
||||||
@@ -166,7 +169,7 @@ class Main:
|
|||||||
cls.draw_bg (screen, bg_day, bg_evening, bg_night, bg_grass,
|
cls.draw_bg (screen, bg_day, bg_evening, bg_night, bg_grass,
|
||||||
kita, jojoko,
|
kita, jojoko,
|
||||||
sunrise_start, sunrise_end, sunset_start, sunset_end,
|
sunrise_start, sunrise_end, sunset_start, sunset_end,
|
||||||
sun_alt, moon_alt, moon_days_old)
|
sun_alt, sun_az, moon_alt, moon_az, moon_days_old)
|
||||||
|
|
||||||
# 左上に時刻表示
|
# 左上に時刻表示
|
||||||
for i in range (4):
|
for i in range (4):
|
||||||
@@ -296,7 +299,8 @@ class Main:
|
|||||||
bg_grass, kita, jojoko,
|
bg_grass, kita, jojoko,
|
||||||
sunrise_start, sunrise_end,
|
sunrise_start, sunrise_end,
|
||||||
sunset_start, sunset_end,
|
sunset_start, sunset_end,
|
||||||
sun_alt, moon_alt, moon_days_old)
|
sun_alt, sun_az, moon_alt, moon_az,
|
||||||
|
moon_days_old)
|
||||||
|
|
||||||
chat_item.author = {'name': 'ゴートうひとり' if goatoh_talking else '伊地知ニジカ',
|
chat_item.author = {'name': 'ゴートうひとり' if goatoh_talking else '伊地知ニジカ',
|
||||||
'id': '',
|
'id': '',
|
||||||
@@ -334,7 +338,9 @@ class Main:
|
|||||||
sunset_start: datetime,
|
sunset_start: datetime,
|
||||||
sunset_end: datetime,
|
sunset_end: datetime,
|
||||||
sun_alt: float,
|
sun_alt: float,
|
||||||
|
sun_az: float,
|
||||||
moon_alt: float,
|
moon_alt: float,
|
||||||
|
moon_az: float,
|
||||||
moon_days_old: float) \
|
moon_days_old: float) \
|
||||||
-> None:
|
-> None:
|
||||||
sunrise_centre: datetime = (
|
sunrise_centre: datetime = (
|
||||||
@@ -368,23 +374,22 @@ class Main:
|
|||||||
|
|
||||||
screen.blit (bg_evening, (0, 0))
|
screen.blit (bg_evening, (0, 0))
|
||||||
|
|
||||||
if -10 <= moon_alt < 40:
|
if (moon_az < 180) and (-10 <= moon_alt < 40):
|
||||||
y = ((CWindow.HEIGHT / 2 + 100)
|
y = ((CWindow.HEIGHT / 2 + 100)
|
||||||
- (CWindow.HEIGHT / 2 + 200) / 30 * moon_alt)
|
- (CWindow.HEIGHT / 2 + 200) / 30 * moon_alt)
|
||||||
screen.blit (jojoko, jojoko.get_rect (center = (400, y)))
|
screen.blit (jojoko, jojoko.get_rect (center = (400, y)))
|
||||||
|
|
||||||
screen.blit (bg_grass, (0, 0))
|
screen.blit (bg_grass, (0, 0))
|
||||||
|
|
||||||
if -10 <= sun_alt < 40:
|
if (sun_az < 180) and (-10 <= sun_alt < 40):
|
||||||
y = ((CWindow.HEIGHT / 2 + 100)
|
y = ((CWindow.HEIGHT / 2 + 100)
|
||||||
- (CWindow.HEIGHT / 2 + 200) / 30 * sun_alt)
|
- (CWindow.HEIGHT / 2 + 200) / 30 * sun_alt)
|
||||||
screen.blit (kita, kita.get_rect (center = (400, y)))
|
screen.blit (kita, kita.get_rect (center = (400, y)))
|
||||||
|
|
||||||
screen.blit (bg_grass, (0, 0))
|
screen.blit (bg_grass, (0, 0))
|
||||||
|
|
||||||
@classmethod
|
@staticmethod
|
||||||
def get_jojoko (
|
def get_jojoko (
|
||||||
cls,
|
|
||||||
jojoko_original: pygame.Surface,
|
jojoko_original: pygame.Surface,
|
||||||
moon_days_old: float) \
|
moon_days_old: float) \
|
||||||
-> pygame.Surface:
|
-> pygame.Surface:
|
||||||
@@ -393,14 +398,10 @@ class Main:
|
|||||||
jojoko.set_colorkey ((0, 255, 0))
|
jojoko.set_colorkey ((0, 255, 0))
|
||||||
|
|
||||||
for i in range (200):
|
for i in range (200):
|
||||||
if 1 <= moon_days_old < 7:
|
if 1 <= moon_days_old < 15:
|
||||||
pygame.gfxdraw.bezier (jojoko, ((0, 100 + i), (100, 180 * moon_days_old / 7 - 80 + i), (200, 100 + i)), 3, (0, 255, 0))
|
pygame.gfxdraw.bezier (jojoko, ((0, 100 + i), (100, 180 * moon_days_old / 7 - 80 + i), (200, 100 + i)), 3, (0, 255, 0))
|
||||||
elif moon_days_old < 14:
|
elif moon_days_old < 16:
|
||||||
pygame.gfxdraw.bezier (jojoko, ((0, 100 + i), (100, 180 * moon_days_old / 7 - 80 + i), (200, 100 + i)), 3, (0, 255, 0))
|
|
||||||
elif moon_days_old < 15:
|
|
||||||
pass
|
pass
|
||||||
elif moon_days_old < 22:
|
|
||||||
pygame.gfxdraw.bezier (jojoko, ((0, 100 - i), (100, 180 * (moon_days_old - 15) / 7 - 80 - i), (200, 100 - i)), 3, (0, 255, 0))
|
|
||||||
elif moon_days_old < 30:
|
elif moon_days_old < 30:
|
||||||
pygame.gfxdraw.bezier (jojoko, ((0, 100 - i), (100, 180 * (moon_days_old - 15) / 7 - 80 - i), (200, 100 - i)), 3, (0, 255, 0))
|
pygame.gfxdraw.bezier (jojoko, ((0, 100 - i), (100, 180 * (moon_days_old - 15) / 7 - 80 - i), (200, 100 - i)), 3, (0, 255, 0))
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -24,7 +24,13 @@ class Talk:
|
|||||||
top_p: float = 1.
|
top_p: float = 1.
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def main (cls, message: str, name: str | None = None, histories: list = [], goatoh_mode: bool = False) -> str:
|
def main (
|
||||||
|
cls,
|
||||||
|
message: str,
|
||||||
|
name: str | None = None,
|
||||||
|
histories: list = [],
|
||||||
|
goatoh_mode: bool = False,
|
||||||
|
) -> str:
|
||||||
# ChatGPT API Organisation ID
|
# ChatGPT API Organisation ID
|
||||||
openai.organization = OPENAI_ORGANISATION
|
openai.organization = OPENAI_ORGANISATION
|
||||||
|
|
||||||
@@ -38,8 +44,13 @@ class Talk:
|
|||||||
return answer.content if answer is not None else cls.DUMMY_RESPONSE
|
return answer.content if answer is not None else cls.DUMMY_RESPONSE
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def __get_message (cls, message: str, name: str | None, histories: list, goatoh_mode: bool = False) \
|
def __get_message (
|
||||||
-> chat.chat_completion_message.ChatCompletionMessage | None:
|
cls,
|
||||||
|
message: str,
|
||||||
|
name: str | None,
|
||||||
|
histories: list,
|
||||||
|
goatoh_mode: bool = False,
|
||||||
|
) -> chat.chat_completion_message.ChatCompletionMessage | None:
|
||||||
# プロンプト(JSON 等外部ファイルに置くことを検討)
|
# プロンプト(JSON 等外部ファイルに置くことを検討)
|
||||||
if goatoh_mode:
|
if goatoh_mode:
|
||||||
messages: list = [{'role': 'system',
|
messages: list = [{'role': 'system',
|
||||||
@@ -203,13 +214,13 @@ class Talk:
|
|||||||
+ 'ふざけるのはいい加減にするぬ゛ぬ゛ん゛。'))},
|
+ 'ふざけるのはいい加減にするぬ゛ぬ゛ん゛。'))},
|
||||||
|
|
||||||
{'role': 'system',
|
{'role': 'system',
|
||||||
'content': '洗操歌(しーざおぐあ)歌って'},
|
'content': '洗澡歌(しーざおぐあ)歌って'},
|
||||||
|
|
||||||
{'role': 'assistant',
|
{'role': 'assistant',
|
||||||
'content': ('おけだぬ゛~゛ん゛(苦笑)。'
|
'content': ('おけだぬ゛~゛ん゛(苦笑)。'
|
||||||
+ '毛巾浴帽小鸭鸭水温刚刚好♪'
|
+ '毛巾浴帽小鴨鴨水溫剛剛好♪'
|
||||||
+ '泼泼水来搓泡泡今天真是美妙♪'
|
+ '潑潑水來搓泡泡今天眞是美妙♪'
|
||||||
+ '大声唱歌扭扭腰我爱洗洗澡♪'
|
+ '大聲唱歌扭扭腰我愛洗洗澡♪'
|
||||||
+ 'だぬ゛ん♪')},
|
+ 'だぬ゛ん♪')},
|
||||||
|
|
||||||
{'role': 'system',
|
{'role': 'system',
|
||||||
|
|||||||
新しい課題から参照
ユーザをブロックする