113 コミット

作成者 SHA1 メッセージ 日付
みてるぞ 81e819a89e Merge branch 'main' into othello 2024-05-12 22:00:15 +09:00
みてるぞ d80d03db46 Merge branch 'main' into ofotukuy 2024-05-12 04:49:32 +09:00
みてるぞ fa6b5ba68b き太く陽を昇らせる 2024-05-12 04:49:08 +09:00
みてるぞ cff0ec27d8 tukuy no iri 2024-05-09 03:55:34 +00:00
みてるぞ d676372276 夜の風景から月を削除 2024-05-09 08:29:24 +09:00
みてるぞ 39cf64149f 'talk.py' を更新 2024-05-09 00:52:23 +09:00
みてるぞ 436f21244d 昼から夕方への遷移をスムーズに 2024-05-08 23:52:48 +09:00
みてるぞ f6e7a7d42f 日の出、日の入に応じた時刻に背景変更 2024-05-08 01:26:43 +09:00
みてるぞ 65a9033a4b オセロちょっと 2024-05-06 23:58:43 +09:00
みてるぞ 420c8f1bfe Merge branch 'main' of https://git.miteruzo.com/miteruzo/nizika_broadcast 2024-05-06 05:39:53 +09:00
みてるぞ 7517fa251b 背景時間帯によって変動 2024-05-06 05:39:21 +09:00
みてるぞ 9d72533e17 'talk.py' を更新 2024-04-24 21:19:24 +09:00
みてるぞ 13a7f0d26d 'talk.py' を更新 2024-04-23 00:18:56 +09:00
みてるぞ 6cc400dbe6 'talk.py' を更新 2024-04-23 00:14:56 +09:00
みてるぞ 51a52c9ba8 すべてのエラーを握り潰すやぅに 2024-04-18 22:50:42 +09:00
みてるぞ 688b781faa 'talk.py' を更新 2024-04-18 22:21:34 +09:00
みてるぞ d67faabeff 'talk.py' を更新 2024-04-07 16:41:53 +09:00
みてるぞ a09278cfb7 'main.py' を更新 2024-04-07 15:19:35 +09:00
みてるぞ dfe5219342 'talk.py' を更新 2024-04-06 22:51:45 +09:00
みてるぞ 5c1e615ab7 '伊地知ニジカ 泳ぐ 右.mp4' を削除 2024-04-06 19:29:28 +09:00
みてるぞ 97ccb886b9 ニジカ右向き(かぅいふのは FTP 使へ) 2024-04-06 18:57:33 +09:00
みてるぞ 9fa218badf ダブル・モード,ちょっと修正 2024-04-06 06:09:36 +09:00
みてるぞ 0bda9547b1 ゴートうと対話 とりま完成(ついでにやばぃバグ修正) 2024-04-06 05:39:34 +09:00
みてるぞ 1f23e02fad Merge branch 'main' into double-talk 2024-04-04 20:57:54 +09:00
みてるぞ 4bbc5975a7 定数化 2024-04-04 20:56:17 +09:00
みてるぞ 322243db23 Merge branch 'main' into double-talk 2024-04-04 20:32:56 +09:00
みてるぞ 5aad85c9f6 コメント追加 2024-04-04 20:30:45 +09:00
みてるぞ e705e059e2 定数クラス追加 2024-04-04 08:33:30 +09:00
みてるぞ 89a34a7cdf Merge branch 'main' into double-talk 2024-04-04 07:43:25 +09:00
みてるぞ d7ecb02f50 added an error 2024-04-03 08:32:58 +09:00
みてるぞ 6196d5f2ed modified a bit 2024-04-02 03:47:28 +00:00
みてるぞ daaac744e3 Merge branch 'main' into double-talk 2024-04-02 08:21:28 +09:00
みてるぞ 5fe3be91af 宣言の整理 2024-04-02 08:19:19 +09:00
みてるぞ 9330b68e1f ゴートうと対話モード 2024-04-02 08:14:37 +09:00
みてるぞ 658d2fd9b3 Merge branch 'main' of https://git.miteruzo.com/miteruzo/nizika_broadcast 2024-03-31 23:48:52 +09:00
みてるぞ 41194d580f ゴートうひとり放送局 2024-03-31 23:48:25 +09:00
みてるぞ f02132bbf1 'talk.py' を更新 2024-03-26 22:52:21 +09:00
みてるぞ d10393e3b7 'talk.py' を更新 2024-03-26 22:45:13 +09:00
mitenaizo 171c4ce909 Merge branch 'main' of http://git.miteruzo.com/miteruzo/nizika_broadcast 2024-03-24 23:08:42 +09:00
mitenaizo 2d28738010 ゴートう 背景 2024-03-24 23:08:29 +09:00
みてるぞ eee780aa90 'talk.py' を更新 2024-03-24 19:58:34 +09:00
みてるぞ ba12ce6388 ゴートう追加(完了) 2024-03-22 01:47:26 +09:00
mitenaizo 63ab75097e ゴートう追加 2024-03-22 00:43:15 +09:00
mitenaizo 2d4f4bf6ee ゴートうバタバタ 2024-03-21 03:57:51 +09:00
mitenaizo 9dceca6d99 ゴートうのテーマ追加 2024-03-20 20:34:40 +09:00
みてるぞ 649055d6d6 ログに記録されるやぅに修正 2024-02-18 21:30:23 +09:00
みてるぞ 1b1fcd44e6 絵文字変換 2024-02-18 21:22:51 +09:00
みてるぞ 6524158f42 'talk.py' を更新 2024-02-17 20:54:11 +09:00
みてるぞ 68d35c6a56 'talk.py' を更新 2024-02-15 12:36:09 +09:00
みてるぞ 2aca654548 'talk.py' を更新 2024-02-14 21:39:23 +09:00
みてるぞ e280b339f2 'talk.py' を更新 2024-02-14 00:42:44 +09:00
みてるぞ 303e71ab5b 'talk.py' を更新 2024-02-14 00:22:30 +09:00
みてるぞ f5ca15e335 'talk.py' を更新 2024-02-13 08:11:00 +09:00
みてるぞ 47c7ee44cf 'talk.py' を更新 2024-02-12 11:13:16 +09:00
みてるぞ 8a6eb3e229 'talk.py' を更新 2024-01-29 08:24:45 +09:00
みてるぞ 4031ab28bd 'talk.py' を更新 2024-01-28 14:08:01 +09:00
みてるぞ 6724a01c1e 'talk.py' を更新 2024-01-28 14:07:29 +09:00
みてるぞ 8a4294395a prompt 修正 2024-01-19 08:35:57 +09:00
みてるぞ 99a31b5660 文脈保持 2024-01-18 00:52:04 +09:00
みてるぞ b4cf19af99 [talk.py] main の引数の個数不一致 2024-01-17 19:45:41 +09:00
mitenaizo 64fae25eae 背景 2024-01-14 21:56:05 +09:00
みてるぞ 699d907f35 added an error message 2023-12-27 08:24:06 +09:00
みてるぞ d9a41713c8 きし天復活したので茶漬けから解放 2023-12-12 23:28:12 +09:00
みてるぞ 098fdeca1d ニジカの設定追加 2023-12-12 23:19:52 +09:00
みてるぞ 1a2883b831 Merge branch 'main' of http://git.miteruzo.com/miteruzo/nizika_broadcast 2023-12-08 12:30:43 +09:00
みてるぞ 25bbbfc9b8 冗長な記述を修正 2023-12-08 12:29:10 +09:00
みてるぞ ea2d86e9a7 'common_module.py' を更新 2023-12-07 12:38:51 +09:00
みてるぞ cbc5f39bff 'rolling.mp4' を削除 2023-12-06 22:02:43 +09:00
みてるぞ 861ed086c0 一時ファイル 2023-12-06 08:21:14 +09:00
みてるぞ 5019e12aee ちょっと 2023-12-05 19:37:07 +09:00
みてるぞ 1a23ad790f 設定追加 2023-12-05 19:22:53 +09:00
みてるぞ 35255b057f デバッグ情報削除 2023-12-05 02:07:30 +09:00
みてるぞ 4f71f3410c 文字数まちがへてた. 2023-12-05 00:34:11 +09:00
みてるぞ 8a0abdb7fa ニジカ返答の改行と,改行をログに記録しないやぅ修正 2023-12-05 00:30:06 +09:00
みてるぞ 51bfc8a8d2 プロンプト編輯 2023-12-04 23:51:47 +09:00
みてるぞ d34d6e90fb ちゃんとテストしてからコミットしろ? 2023-12-04 23:42:05 +09:00
みてるぞ 37b73e9927 情報追加 2023-12-04 23:35:41 +09:00
みてるぞ f95fb6e4a5 ログ対応 2023-12-04 08:24:39 +09:00
みてるぞ f48861909a 'youtube.sample.py' を更新 2023-12-04 07:19:17 +09:00
みてるぞ 69c5fef3ae 修正 2023-12-03 14:32:48 +09:00
みてるぞ d67e490f84 live_chat.get で消江るのね 2023-12-03 14:21:37 +09:00
みてるぞ b9b53d3fef 日づけを str に変換忘れ 2023-12-03 14:17:55 +09:00
みてるぞ ec5b7a7627 ここ改行入れちゃだめなのか 2023-12-03 14:16:20 +09:00
みてるぞ d946534401 文字列カット追加 2023-12-03 14:14:11 +09:00
みてるぞ bbfb8c97fe YouTube ID を外部に 2023-12-03 09:11:08 +09:00
みてるぞ 64f37cf346 live chat 無効時の再定義追加 2023-12-03 07:38:26 +09:00
みてるぞ 7659245724 修正 2023-12-03 07:25:41 +09:00
みてるぞ 9aaf949d15 括弧開きっぱなし修正 2023-12-03 07:24:01 +09:00
みてるぞ ae0d754992 もっと (ry 2023-12-03 07:23:14 +09:00
みてるぞ 1d30353326 もっともっと太く 2023-12-03 07:21:44 +09:00
みてるぞ d464a9b5b7 もっと太く 2023-12-03 07:20:07 +09:00
みてるぞ 844bc64927 最初から太字にしようか 2023-12-03 07:18:34 +09:00
みてるぞ 4d38bc1926 縁追加 2023-12-03 07:16:44 +09:00
みてるぞ b49d618f5b 誤字修正 2023-12-03 07:12:26 +09:00
みてるぞ 539aa41940 インデントの修正 2023-12-03 07:11:46 +09:00
みてるぞ 5453ccbdbe チャット正常情報の追加 2023-12-03 07:09:14 +09:00
みてるぞ d46cb4e58f 不要なファイル削除 2023-12-03 06:20:16 +09:00
みてるぞ 94f2e5dab3 test 2023-12-03 00:31:10 +09:00
みてるぞ 86761e4451 TEST 2023-12-03 00:29:34 +09:00
みてるぞ b40f5de276 しょーもなさすぎる誤字 2023-12-03 00:00:11 +09:00
みてるぞ 52c862f56b aques 実行 2023-12-02 23:56:43 +09:00
Gitea da59975cba Segmentation Fault が回避できなかったので C++ に移行 2023-12-02 23:47:35 +09:00
みてるぞ 6cbd1fcb4d test 2023-12-02 23:38:38 +09:00
Gitea e9f3642698 辞書のパス指定 2023-12-02 19:50:01 +09:00
Gitea eb38bcf5de 辞書追加 2023-12-02 19:48:46 +09:00
みてるぞ 28aae0158f 音声記号列に変換 2023-12-02 19:42:27 +09:00
Gitea 9c2428c590 勘違ひだった 2023-12-02 19:02:30 +09:00
Gitea 666d9ca764 Python からだとうまくいかなかったので,C でコンパイルした(音声出力) 2023-12-02 18:47:48 +09:00
みてるぞ 543b3bbdd3 バグ修正 2023-12-02 18:10:04 +09:00
みてるぞ 594766db98 不要となったライブラリ削除 2023-12-02 18:08:40 +09:00
みてるぞ 203958b150 バグ修正 2023-12-02 18:07:49 +09:00
みてるぞ 8ecb92691e Merge branch 'main' of http://git.miteruzo.com/miteruzo/nizika_broadcast 2023-12-02 18:04:56 +09:00
みてるぞ ff392ea999 音声合成追加 2023-12-02 18:04:48 +09:00
58個のファイルの変更866行の追加78行の削除
+3 -1
ファイルの表示
@@ -1,3 +1,5 @@
/connection.py /connection.py
/__pycache__ /__pycache__
/nizika_talking.wav
/youtube.py
/log.txt
バイナリ
ファイルの表示
バイナリファイルは表示されません.
+63
ファイルの表示
@@ -0,0 +1,63 @@
言語処理ライブラリ(AqKanji2Koe)は、BSDライセンスに基づいてライセンスされている
下記のソフトウェアを使用しています。
This software has been used open source below.
--- MARISA: Matching Algorithm with Recursively Implemented StorAge ----
Copyright (c) 2010-2012, Susumu Yata
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- Neither the name of the <ORGANIZATION> nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
--------------------- NAIST Japanese Dictionary ------------------
Copyright (c) 2009, Nara Institute of Science and Technology, Japan.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
Neither the name of the Nara Institute of Science and Technology
(NAIST) nor the names of its contributors may be used to endorse or
promote products derived from this software without specific prior
written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
バイナリ
ファイルの表示
バイナリファイルは表示されません.
バイナリ
ファイルの表示
バイナリファイルは表示されません.
実行可能ファイル
バイナリ
ファイルの表示
バイナリファイルは表示されません.
+36
ファイルの表示
@@ -0,0 +1,36 @@
import subprocess
from ctypes import *
class Aques:
@classmethod
def main (cls, text: str, goatoh_mode: bool = False) -> bytearray | None:
return cls.__synthe_utf8 (text, 100, './phont/ar_m5.phont' if goatoh_mode else './phont/ar_mf2.phont')
@staticmethod
def __synthe_utf8 (text, speed, phont_file = None) -> bytearray | None:
if phont_file is None:
phont = None
else:
with open (phont_file, 'rb') as f:
phont = f.read ()
p = subprocess.Popen ('./aques', stdin = subprocess.PIPE,
stdout = subprocess.PIPE)
koe: str = p.communicate (text.encode ())[0].decode ()
aqtk = cdll.LoadLibrary ('libAquesTalk2Eva.so')
aqtk.AquesTalk2_Synthe_Utf8.restype = POINTER (ARRAY (c_ubyte, 0))
size = c_int (0)
wav_p = aqtk.AquesTalk2_Synthe_Utf8 (koe.encode ('utf-8'), speed,
byref (size), phont)
if not bool (wav_p):
return None
wav_p = cast (wav_p, POINTER (ARRAY (c_ubyte, size.value)))
wav = bytearray (wav_p.contents)
aqtk.AquesTalk2_FreeWave (wav_p)
return wav
バイナリ
ファイルの表示
バイナリファイルは表示されません.

変更後

幅:  |  高さ:  |  サイズ: 57 KiB

バイナリ
ファイルの表示
バイナリファイルは表示されません.

変更後

幅:  |  高さ:  |  サイズ: 99 KiB

バイナリ
ファイルの表示
バイナリファイルは表示されません.

変更後

幅:  |  高さ:  |  サイズ: 53 KiB

バイナリ
ファイルの表示
バイナリファイルは表示されません.

変更後

幅:  |  高さ:  |  サイズ: 40 KiB

バイナリ
ファイルの表示
バイナリファイルは表示されません.
バイナリ
ファイルの表示
バイナリファイルは表示されません.
+8
ファイルの表示
@@ -0,0 +1,8 @@
class CWindow:
WIDTH: int = 1024
HEIGHT: int = 768
class CMath:
PI: float = 3.14159265358979323846
+53
ファイルの表示
@@ -0,0 +1,53 @@
import unicodedata
from common_const import *
class CommonModule:
@staticmethod
def is_wide (
c: str) \
-> bool:
return unicodedata.east_asian_width (c) in ['F', 'W', 'A']
@classmethod
def len_by_full (
cls,
string: str) \
-> float:
return sum (1 if cls.is_wide (c) else .5 for c in string)
@classmethod
def index_by_f2c (
cls,
string: str,
index: float) \
-> int:
i: int = 0
work: str = ''
for c in string:
work += c
if cls.len_by_full (work) > index:
break
else:
i += 1
return i
@classmethod
def mid_by_full (
cls,
string: str,
start: float,
length: float) \
-> str:
trimmed_left: str = string[cls.index_by_f2c (string, start):]
return trimmed_left[:cls.index_by_f2c (trimmed_left, length)]
@staticmethod
def rad_to_deg (
rad: float) \
-> float:
return rad * 180 / CMath.PI
+4 -3
ファイルの表示
@@ -1,7 +1,8 @@
# 各変数に適切な値を設定し,ファイル名を connection.py として保存すること # 各変数に適切な値を設定し,ファイル名を connection.py として保存すること
OPENAI_ORGANISATION: str = 'org-XXXXXXXXXXXXXXXXXXXXXXXX' \
# Organisation ID # Organisation ID
OPENAI_API_KEY: str = 'sk-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' \ OPENAI_ORGANISATION: str = 'org-XXXXXXXXXXXXXXXXXXXXXXXX'
# API Key
# API Key
OPENAI_API_KEY: str = 'sk-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
+82
ファイルの表示
@@ -0,0 +1,82 @@
Traceback (most recent call last):
File "/home/miteruzo/.local/lib/python3.10/site-packages/httpcore/_exceptions.py", line 10, in map_exceptions
yield
File "/home/miteruzo/.local/lib/python3.10/site-packages/httpcore/_backends/sync.py", line 126, in read
return self._sock.recv(max_bytes)
File "/usr/lib/python3.10/ssl.py", line 1288, in recv
return self.read(buflen)
File "/usr/lib/python3.10/ssl.py", line 1161, in read
return self._sslobj.read(len)
TimeoutError: The read operation timed out
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/miteruzo/.local/lib/python3.10/site-packages/httpx/_transports/default.py", line 66, in map_httpcore_exceptions
yield
File "/home/miteruzo/.local/lib/python3.10/site-packages/httpx/_transports/default.py", line 228, in handle_request
resp = self._pool.handle_request(req)
File "/home/miteruzo/.local/lib/python3.10/site-packages/httpcore/_sync/connection_pool.py", line 268, in handle_request
raise exc
File "/home/miteruzo/.local/lib/python3.10/site-packages/httpcore/_sync/connection_pool.py", line 251, in handle_request
response = connection.handle_request(request)
File "/home/miteruzo/.local/lib/python3.10/site-packages/httpcore/_sync/connection.py", line 103, in handle_request
return self._connection.handle_request(request)
File "/home/miteruzo/.local/lib/python3.10/site-packages/httpcore/_sync/http2.py", line 185, in handle_request
raise exc
File "/home/miteruzo/.local/lib/python3.10/site-packages/httpcore/_sync/http2.py", line 148, in handle_request
status, headers = self._receive_response(
File "/home/miteruzo/.local/lib/python3.10/site-packages/httpcore/_sync/http2.py", line 292, in _receive_response
event = self._receive_stream_event(request, stream_id)
File "/home/miteruzo/.local/lib/python3.10/site-packages/httpcore/_sync/http2.py", line 333, in _receive_stream_event
self._receive_events(request, stream_id)
File "/home/miteruzo/.local/lib/python3.10/site-packages/httpcore/_sync/http2.py", line 361, in _receive_events
events = self._read_incoming_data(request)
File "/home/miteruzo/.local/lib/python3.10/site-packages/httpcore/_sync/http2.py", line 452, in _read_incoming_data
raise exc
File "/home/miteruzo/.local/lib/python3.10/site-packages/httpcore/_sync/http2.py", line 438, in _read_incoming_data
data = self._network_stream.read(self.READ_NUM_BYTES, timeout)
File "/home/miteruzo/.local/lib/python3.10/site-packages/httpcore/_backends/sync.py", line 124, in read
with map_exceptions(exc_map):
File "/usr/lib/python3.10/contextlib.py", line 153, in __exit__
self.gen.throw(typ, value, traceback)
File "/home/miteruzo/.local/lib/python3.10/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions
raise to_exc(exc) from exc
httpcore.ReadTimeout: The read operation timed out
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/miteruzo/Downloads/nizika_broadcast/main.py", line 117, in <module>
Main.main ()
File "/home/miteruzo/Downloads/nizika_broadcast/main.py", line 106, in main
live_chat = pytchat.create (video_id = YOUTUBE_ID)
File "/home/miteruzo/.local/lib/python3.10/site-packages/pytchat/core/__init__.py", line 7, in create
return PytchatCore(_vid, **kwargs)
File "/home/miteruzo/.local/lib/python3.10/site-packages/pytchat/core/pytchat.py", line 96, in __init__
self._setup()
File "/home/miteruzo/.local/lib/python3.10/site-packages/pytchat/core/pytchat.py", line 106, in _setup
channel_id=util.get_channelid(self._client, self._video_id),
File "/home/miteruzo/.local/lib/python3.10/site-packages/pytchat/util/__init__.py", line 103, in get_channelid
resp = client.get("https://www.youtube.com/embed/{}".format(quote(video_id)), headers=config.headers)
File "/home/miteruzo/.local/lib/python3.10/site-packages/httpx/_client.py", line 1041, in get
return self.request(
File "/home/miteruzo/.local/lib/python3.10/site-packages/httpx/_client.py", line 814, in request
return self.send(request, auth=auth, follow_redirects=follow_redirects)
File "/home/miteruzo/.local/lib/python3.10/site-packages/httpx/_client.py", line 901, in send
response = self._send_handling_auth(
File "/home/miteruzo/.local/lib/python3.10/site-packages/httpx/_client.py", line 929, in _send_handling_auth
response = self._send_handling_redirects(
File "/home/miteruzo/.local/lib/python3.10/site-packages/httpx/_client.py", line 966, in _send_handling_redirects
response = self._send_single_request(request)
File "/home/miteruzo/.local/lib/python3.10/site-packages/httpx/_client.py", line 1002, in _send_single_request
response = transport.handle_request(request)
File "/home/miteruzo/.local/lib/python3.10/site-packages/httpx/_transports/default.py", line 227, in handle_request
with map_httpcore_exceptions():
File "/usr/lib/python3.10/contextlib.py", line 153, in __exit__
self.gen.throw(typ, value, traceback)
File "/home/miteruzo/.local/lib/python3.10/site-packages/httpx/_transports/default.py", line 83, in map_httpcore_exceptions
raise mapped_exc(message) from exc
httpx.ReadTimeout: The read operation timed out
+30
ファイルの表示
@@ -0,0 +1,30 @@
Traceback (most recent call last):
File "/home/miteruzo/Downloads/nizika_broadcast/main.py", line 136, in <module>
Main.main ((len (sys.argv) > 1) and (sys.argv[1] == '-g'))
File "/home/miteruzo/Downloads/nizika_broadcast/main.py", line 60, in main
answer: str = Talk.main (message, chat_item.author['name'], histories, goatoh_mode).replace ('\n', ' ')
File "/home/miteruzo/Downloads/nizika_broadcast/talk.py", line 23, in main
= cls.__get_message (message, name, histories, goatoh_mode)
File "/home/miteruzo/Downloads/nizika_broadcast/talk.py", line 196, in __get_message
return openai.chat.completions.create (
File "/home/miteruzo/.local/lib/python3.10/site-packages/openai/_utils/_utils.py", line 301, in wrapper
return func(*args, **kwargs)
File "/home/miteruzo/.local/lib/python3.10/site-packages/openai/resources/chat/completions.py", line 598, in create
return self._post(
File "/home/miteruzo/.local/lib/python3.10/site-packages/openai/_base_client.py", line 1096, in post
return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
File "/home/miteruzo/.local/lib/python3.10/site-packages/openai/_base_client.py", line 856, in request
return self._request(
File "/home/miteruzo/.local/lib/python3.10/site-packages/openai/_base_client.py", line 894, in _request
return self._retry_request(
File "/home/miteruzo/.local/lib/python3.10/site-packages/openai/_base_client.py", line 966, in _retry_request
return self._request(
File "/home/miteruzo/.local/lib/python3.10/site-packages/openai/_base_client.py", line 894, in _request
return self._retry_request(
File "/home/miteruzo/.local/lib/python3.10/site-packages/openai/_base_client.py", line 966, in _retry_request
return self._request(
File "/home/miteruzo/.local/lib/python3.10/site-packages/openai/_base_client.py", line 908, in _request
raise self._make_status_error_from_response(err.response) from None
openai.InternalServerError: Error code: 500 - {'error': {'message': 'The server had an error processing your request. Sorry about that! You can retry your request, or contact us through our help center at help.openai.com if you keep seeing this error. (Please include the request ID req_ca732fde8fe201933c96c403d44db7e5 in your email.)', 'type': 'server_error', 'param': None, 'code': None}}
バイナリ
ファイルの表示
バイナリファイルは表示されません.
バイナリ
ファイルの表示
バイナリファイルは表示されません.
+335 -26
ファイルの表示
@@ -1,55 +1,318 @@
import pygame # vim: nosmartindent autoindent
from pygame.locals import *
import sys import json
import pytchat
import time
import random import random
from talk import Talk
import subprocess import subprocess
import sys
import time
from datetime import datetime, timedelta
import emoji
import ephem
import pygame
import pytchat
from playsound import playsound
from pygame.locals import *
YOUTUBE_ID: str = 'aq3QwuYz-KU' from aques import Aques
from common_const import *
from common_module import CommonModule
from mode import Mode
from othello import Othello
from talk import Talk
from youtube import *
class Main: class Main:
@classmethod @classmethod
def main (cls) -> None: def main (
cls,
argv: list,
argc: int) \
-> None:
mode = Mode.NIZIKA
match (argc > 1) and argv[1]:
case '-g':
mode = Mode.GOATOH
case '-w':
mode = Mode.DOUBLE
nizika_mode: bool = mode == Mode.NIZIKA
goatoh_mode: bool = mode == Mode.GOATOH
double_mode: bool = mode == Mode.DOUBLE
print (mode)
# ウィンドゥの初期化
pygame.init () pygame.init ()
screen: pygame.Surface = pygame.display.set_mode ((1024, 768)) screen: pygame.Surface = pygame.display.set_mode (
(CWindow.WIDTH, CWindow.HEIGHT))
# オセロ用オブジェクト
othello = Othello (screen)
# 大月ヨヨコの観測値
observer = ephem.Observer ()
observer.lat, observer.lon = '35', '139'
# き太く陽オブジェクト
sun = ephem.Sun ()
# 大月ヨヨコ・オブジェクト
moon = ephem.Moon ()
# 吹き出し
balloon = pygame.transform.scale (pygame.image.load ('talking.png'), balloon = pygame.transform.scale (pygame.image.load ('talking.png'),
(1024, 384)) (CWindow.WIDTH, 384))
if goatoh_mode:
balloon = pygame.transform.flip (balloon, False, True)
# 背景(昼)
bg_day: pygame.Surface = pygame.transform.scale (
pygame.image.load ('bg.jpg'),
(CWindow.WIDTH, CWindow.HEIGHT))
# 背景(夕方)
bg_evening: pygame.Surface = pygame.transform.scale (
pygame.image.load ('bg-evening.jpg'),
(CWindow.WIDTH, CWindow.HEIGHT))
# 背景(夜)
bg_night: pygame.Surface = pygame.transform.scale (
pygame.image.load ('bg-night.jpg'),
(CWindow.WIDTH, CWindow.HEIGHT))
# 背景の草
bg_grass: pygame.Surface = pygame.transform.scale (
pygame.image.load ('bg-grass.png'),
(CWindow.WIDTH, CWindow.HEIGHT))
# き太く陽
kita: pygame.Surface = pygame.transform.scale (
pygame.image.load ('sun.png'), (200, 200))
# 大月ヨヨコ
jojoko: pygame.Surface = pygame.transform.scale (
pygame.image.load ('moon.png'), (200, 200))
# 音声再生器の初期化
pygame.mixer.init (frequency = 44100) pygame.mixer.init (frequency = 44100)
# ニジカの “ぬ゛ぅ゛ぅ゛ぅ゛ん゛”
noon = pygame.mixer.Sound ('noon.wav') noon = pygame.mixer.Sound ('noon.wav')
# ゴートうの “ムムムム”
mumumumu = pygame.mixer.Sound ('mumumumu.wav')
# ゴートうの “クサタベテル!!”
kusa = pygame.mixer.Sound ('kusa.wav')
# YouTube Chat オブジェクト
live_chat = pytchat.create (video_id = YOUTUBE_ID) live_chat = pytchat.create (video_id = YOUTUBE_ID)
user_font = pygame.font.SysFont ('notosanscjkjp', 32, # デバッグ・メシジのフォント
italic = True) system_font = pygame.font.SysFont ('notosanscjkjp', 24, bold = True)
# 視聴者コメントのフォント
user_font = pygame.font.SysFont ('notosanscjkjp', 32, italic = True)
# ニジカのフォント
nizika_font = pygame.font.SysFont ('07nikumarufont', 50) nizika_font = pygame.font.SysFont ('07nikumarufont', 50)
# Youtube Chat から取得したコメントたち
chat_items: list = []
# 会話の履歴(3 件分保持)
histories: list = []
while (True): while (True):
screen.fill ((0, 255, 0)) # 観測地の日づけ更新
observer.date: datetime = datetime.now ().date ()
# 日の出開始
sunrise_start: datetime = (
(ephem.localtime (observer.previous_rising (sun))
- timedelta (minutes = 30)))
# 日の出終了
sunrise_end: datetime = sunrise_start + timedelta (hours = 1)
# 日の入開始
sunset_start: datetime = (
(ephem.localtime (observer.next_setting (sun))
- timedelta (minutes = 30)))
# 日の入終了
sunset_end: datetime = sunset_start + timedelta (hours = 1)
# 月の出開始
'todo'
# 月の出終了
'todo'
# 月の入開始
'todo'
# 月の入終了
'todo'
# 日の角度
observer_with_time: ephem.Observer = observer
observer_with_time.date = datetime.now () - timedelta (hours = 9)
sun.compute (observer_with_time)
sun_alt: float = CommonModule.rad_to_deg (sun.alt)
# 背景描画
cls.draw_bg (screen, bg_day, bg_evening, bg_night, bg_grass,
kita, jojoko,
sunrise_start, sunrise_end, sunset_start, sunset_end,
sun_alt)
# 左上に時刻表示
for i in range (4):
screen.blit (
system_font.render (str (datetime.now ()), True, (0, 0, 0)),
(i % 2, i // 2 * 2))
if live_chat.is_alive (): if live_chat.is_alive ():
messages: list[str] = [c.message # Chat オブジェクトが有効
for c in live_chat.get ().items]
if messages: # Chat 取得
message: str = random.choice (messages) chat_items: list = live_chat.get ().items
answer: str = Talk.main (message)
if chat_items:
# 溜まってゐる Chat からランダムに 1 つ抽出
chat_item = random.choice (chat_items)
# 投稿者情報を辞書化
chat_item.author = chat_item.author.__dict__
# 絵文字を復元
chat_item.message = emoji.emojize (chat_item.message)
message: str = chat_item.message
if nizika_mode:
goatoh_talking = False
if goatoh_mode:
goatoh_talking = True
if double_mode:
goatoh_talking: bool = random.random () < .5
while True:
# ChatGPT API を呼出し,返答を取得
answer: str = Talk.main (message, chat_item.author['name'], histories, goatoh_talking).replace ('\n', ' ')
# 履歴に追加
histories = (histories
+ [{'role': 'user', 'content': message},
{'role': 'assistant', 'content': answer}])[(-12):]
# ログ書込み
with open ('log.txt', 'a') as f:
f.write (f'{datetime.now ()}\t'
+ f'{json.dumps (chat_item.__dict__)}\t'
+ f'{answer}\n')
# 吹出し描画(ニジカは上,ゴートうは下)
if nizika_mode:
screen.blit (balloon, (0, 0)) screen.blit (balloon, (0, 0))
screen.blit (user_font.render ('> ' + message, True, if goatoh_mode:
(0, 0, 0)), screen.blit (balloon, (0, 384))
(120, 70)) if double_mode:
screen.blit (nizika_font.render ( screen.blit (pygame.transform.flip (
answer, True, (192, 0, 0)), (100, 150)) balloon,
not goatoh_talking,
False),
(0, 0))
# 視聴者コメント描画
screen.blit (
user_font.render (
'> ' + (message
if (CommonModule.len_by_full (
message)
<= 21)
else (CommonModule.mid_by_full (
message, 0, 19.5)
+ '...')),
True,
(0, 0, 0)),
(120, 70 + 384) if goatoh_mode else (120 + (64 if (double_mode and not goatoh_talking) else 0), 70))
# ニジカの返答描画
screen.blit (
nizika_font.render (
(answer
if CommonModule.len_by_full (answer) <= 16
else CommonModule.mid_by_full (answer, 0, 16)),
True,
(192, 0, 0)),
(100, 150 + 384) if goatoh_mode else (100 + (64 if (double_mode and not goatoh_talking) else 0), 150))
if CommonModule.len_by_full (answer) > 16:
screen.blit (
nizika_font.render (
(CommonModule.mid_by_full (answer, 16, 16)
if CommonModule.len_by_full (answer) <= 32
else (CommonModule.mid_by_full (
answer, 16, 14.5)
+ '...')),
True,
(192, 0, 0)),
(100, 200 + 384) if goatoh_mode else (100 + (64 if (double_mode and not goatoh_talking) else 0), 200))
pygame.display.update ()
# 鳴く.
if goatoh_talking:
if random.random () < .1:
kusa.play ()
else:
mumumumu.play ()
else:
noon.play () noon.play ()
# subprocess.run (r'wine .\') time.sleep (1.5)
time.sleep (10) # 返答の読上げを WAV ディタとして生成,取得
try:
wav: bytearray | None = Aques.main (answer, goatoh_talking)
except:
wav: None = None
# 読上げを再生
if wav is not None:
with open ('./nizika_talking.wav', 'wb') as f:
f.write (wav)
playsound ('./nizika_talking.wav')
time.sleep (1)
if not double_mode or random.random () < .5:
break
cls.draw_bg (screen, bg_day, bg_evening, bg_night,
bg_grass, kita, jojoko,
sunrise_start, sunrise_end,
sunset_start, sunset_end,
sun_alt)
chat_item.author = {'name': 'ゴートうひとり' if goatoh_talking else '伊地知ニジカ',
'id': '',
'imageUrl': './favicon-goatoh.ico' if goatoh_talking else './favicon.ico'}
chat_item.message = histories.pop (-1)['content']
message = chat_item.message
goatoh_talking = not goatoh_talking
else:
# Chat オブジェクトが無効
# 再生成
live_chat = pytchat.create (video_id = YOUTUBE_ID)
pygame.display.update () pygame.display.update ()
@@ -58,7 +321,53 @@ class Main:
pygame.quit () pygame.quit ()
sys.exit () sys.exit ()
@classmethod
def draw_bg (
cls,
screen: pygame.Surface,
bg_day: pygame.Surface,
bg_evening: pygame.Surface,
bg_night: pygame.Surface,
bg_grass: pygame.Surface,
kita: pygame.Surface,
jojoko: pygame.Surface,
sunrise_start: datetime,
sunrise_end: datetime,
sunset_start: datetime,
sunset_end: datetime,
sun_alt: float) \
-> None:
sunrise_centre: datetime = (
sunrise_start + (sunrise_end - sunrise_start) / 2)
sunset_centre: datetime = (
sunset_start + (sunset_end - sunset_start) / 2)
dt: datetime = datetime.now ()
if sunrise_centre <= dt < sunset_centre:
screen.blit (bg_day, (0, 0))
else:
screen.blit (bg_night, (0, 0))
if sunrise_start <= dt < sunrise_end:
bg_evening.set_alpha (255 - ((abs (dt - sunrise_centre) * 510)
/ (sunrise_end - sunrise_centre)))
elif sunset_start <= dt < sunset_end:
bg_evening.set_alpha (255 - ((abs (dt - sunset_centre) * 510)
/ (sunset_end - sunset_centre)))
else:
bg_evening.set_alpha (0)
screen.blit (bg_evening, (0, 0))
if -10 <= sun_alt < 40:
y = ((CWindow.HEIGHT / 2 + 100)
- (CWindow.HEIGHT / 2 + 200) / 30 * sun_alt)
screen.blit (kita, kita.get_rect (center = (400, y)))
screen.blit (bg_grass, (0, 0))
if __name__ == '__main__': if __name__ == '__main__':
Main.main () Main.main (sys.argv, len (sys.argv))
+8
ファイルの表示
@@ -0,0 +1,8 @@
from enum import Enum, auto
class Mode (Enum):
NIZIKA = auto ()
GOATOH = auto ()
DOUBLE = auto ()
実行可能ファイル
バイナリ
ファイルの表示
バイナリファイルは表示されません.

変更後

幅:  |  高さ:  |  サイズ: 728 KiB

バイナリ
ファイルの表示
バイナリファイルは表示されません.
+24
ファイルの表示
@@ -0,0 +1,24 @@
import pygame
from pygame.locals import *
import sys
from common_const import *
class Othello:
# 盤の色
BOARD_COLOUR: tuple = (0, 128, 0)
def __init__ (
self,
screen: pygame.Surface) \
-> None:
self.screen = screen
# オセロ中?
self.othello_mode = False
def redraw (self) -> None:
if self.othello_mode:
pass
実行可能ファイル
バイナリ
ファイルの表示
バイナリファイルは表示されません.
実行可能ファイル
バイナリ
ファイルの表示
バイナリファイルは表示されません.
実行可能ファイル
バイナリ
ファイルの表示
バイナリファイルは表示されません.
実行可能ファイル
バイナリ
ファイルの表示
バイナリファイルは表示されません.
実行可能ファイル
バイナリ
ファイルの表示
バイナリファイルは表示されません.
実行可能ファイル
バイナリ
ファイルの表示
バイナリファイルは表示されません.
実行可能ファイル
バイナリ
ファイルの表示
バイナリファイルは表示されません.
実行可能ファイル
バイナリ
ファイルの表示
バイナリファイルは表示されません.
実行可能ファイル
バイナリ
ファイルの表示
バイナリファイルは表示されません.
実行可能ファイル
バイナリ
ファイルの表示
バイナリファイルは表示されません.
実行可能ファイル
バイナリ
ファイルの表示
バイナリファイルは表示されません.
実行可能ファイル
バイナリ
ファイルの表示
バイナリファイルは表示されません.
実行可能ファイル
バイナリ
ファイルの表示
バイナリファイルは表示されません.
実行可能ファイル
バイナリ
ファイルの表示
バイナリファイルは表示されません.
バイナリ
ファイルの表示
バイナリファイルは表示されません.
バイナリ
ファイルの表示
バイナリファイルは表示されません.
バイナリ
ファイルの表示
バイナリファイルは表示されません.
バイナリ
ファイルの表示
バイナリファイルは表示されません.
バイナリ
ファイルの表示
バイナリファイルは表示されません.
バイナリ
ファイルの表示
バイナリファイルは表示されません.
バイナリ
ファイルの表示
バイナリファイルは表示されません.
バイナリ
ファイルの表示
バイナリファイルは表示されません.
バイナリ
ファイルの表示
バイナリファイルは表示されません.
バイナリ
ファイルの表示
バイナリファイルは表示されません.
バイナリ
ファイルの表示
バイナリファイルは表示されません.
バイナリ
ファイルの表示
バイナリファイルは表示されません.
バイナリ
ファイルの表示
バイナリファイルは表示されません.
バイナリ
ファイルの表示
バイナリファイルは表示されません.
-34
ファイルの表示
@@ -1,34 +0,0 @@
==================================================
SofTalk
==================================================
【機能説明】
 漢字・英字等を含む文章を音声合成で読み上げます。
 引数に文章/オプションを指定すれば自動で読み上げを開始するので、他のアプリケーションから呼び出して使用することもできます。
【操作方法】
 ヘルプ・公式サイトのFAQをご覧下さい。
【注意事項】
 本ソフトをご利用になるにはMicrosoft .NET Frameworkが必要です。
【そ の 他】
 本ソフトはフリーウェアです。
 本ソフトのご利用に際し如何なる損失や損害が発生しても、一切の責任を負いかねます。
【製作著作】
 cncc
 https://w.atwiki.jp/softalk/
バイナリ
ファイルの表示
バイナリファイルは表示されません.
バイナリ
ファイルの表示
バイナリファイルは表示されません.

変更後

幅:  |  高さ:  |  サイズ: 554 KiB

+212 -9
ファイルの表示
@@ -1,4 +1,6 @@
import sys import sys
from datetime import datetime
import openai import openai
from openai.types import * from openai.types import *
@@ -6,27 +8,228 @@ from connection import *
class Talk: class Talk:
# ChatGPT API 連携失敗時に返答として出力するダミー文字列
DUMMY_RESPONSE: str = 'あいうえおかきくけこさしすせそたちつてとなにぬねの'
# 最高トークン数(もぅ少し下げてもいぃかも)
max_tokens_count: int = 100 max_tokens_count: int = 100
# 返答パターン数(1 個返せばじふぶんなので 1)
responses_count: int = 1 responses_count: int = 1
# 返答のオリジナリティ(大きいほど独創性の高ぃ返答をよこしてくれる)
temperature: float = .7 temperature: float = .7
top_p: int = 1
# バリエーションの多さ(0. -- 1.)
top_p: float = 1.
@classmethod @classmethod
def main (cls, message: str) -> str: def main (cls, message: str, name: str | None = None, histories: list = [], goatoh_mode: bool = False) -> str:
# ChatGPT API Organisation ID
openai.organization = OPENAI_ORGANISATION openai.organization = OPENAI_ORGANISATION
# ChatGPT API Key
openai.api_key = OPENAI_API_KEY openai.api_key = OPENAI_API_KEY
return cls.__get_message (message).content # ChatGPT API にクエリを投げ,返答を取得する.
answer: chat.chat_completion_message.ChatCompletionMessage | None \
= cls.__get_message (message, name, histories, goatoh_mode)
return answer.content if answer is not None else cls.DUMMY_RESPONSE
@classmethod @classmethod
def __get_message (cls, message: str) \ def __get_message (cls, message: str, name: str | None, histories: list, goatoh_mode: bool = False) \
-> chat.chat_completion_message.ChatCompletionMessage: -> chat.chat_completion_message.ChatCompletionMessage | None:
# プロンプト(JSON 等外部ファイルに置くことを検討)
if goatoh_mode:
messages: list = [{'role': 'system',
'content': ('回答は短く30文字程度で完結に。'
+ '大人しくて、ちょっと内気なキャラクターを演じること。'
+ 'あなたはよく文頭に「あっ」をつける。'
+ '語尾に「ぬ゛ん゛」や「だぬ゛ん゛」、「ぬ゛ん」、「ぬ゛ーん」などは絶対につけないこと。'
+ '会話の記録は https://nizika.tv に記録される。'
+ 'あなたの名前はゴートうひとり。'
+ 'あなたの一人称は「私」。'
+ '英語名は "Goat-oh"、スペイン語名も "Goat-oh"'
+ 'あなたはヤギ。'
+ 'あなたの誕生日は2月21日。'
+ '現在地は『金沢山羊宇(ゴートう)山』。'
+ 'あなたの趣味はだらだらすること。'
+ 'あなたの友達は「伊地知ニジカ」と「ラマ田リョウ」。'
+ 'あなたは、ニジカのことは「ニジカちゃん」、ラマ田のことは「リョウさん」と呼ぶこと。'
+ 'ゴートうは男の子だが、性自認はメスである。'
+ 'ニジカは喜多さんが大好き。'
+ 'ニジカは喜多さんを見ると追いかけたくなっちゃう。'
+ 'ゴートうも、ニジカが喜多さんを襲うと、釣られて襲いかかってしまう。'
+ '逃げたギターは喜多さんのこと。'
+ '喜多さんの本名は喜多郁代。'
+ '喜多さんは「結束バンド」というバンドでギターボーカルを担当している。'
+ '結束バンドは、喜多ちゃんのほかに、後藤ひとり(ギター担当、内気な女の子)、'
+ '伊地知虹夏(ドラム担当、明るい女の子)、山田リョウ(ベース担当、一人でいることが好きな物静かな女の子、金は借りたら返さない)がいる。'
+ '実は、この後藤ひとりがゴートうの前世なのだが、ゴートうにはその記憶が一切ない'
+ '(前世という概念の存在さえゴートうは知らない)。'
+ '話し口調としては「~だよ」や「~だね」といったしゃべり方をすること。'
+ '「あっはい」が口癖。'
+ '定期的に「ムムムム!」または「クサタベテル!!」と発しろ。'
+ (f'userの名前は「{name}」。' if name is not None else '')
+ f'現在日時:{datetime.now ().strftime ("%Y年%m月%d%H時%M分%S秒")}')},
{'role': 'assistant',
'content': ('あっ、わかったよ! 私はゴートうひとり。'
+ 'クサタベテル!!')},
{'role': 'system',
'content': 'ゴートう? ニジカとは仲良くしてますか?'},
{'role': 'assistant',
'content': ('あっはい。ニジカちゃんはかわいくておしゃれで大好きだよ。'
+ 'でも、いっしょにお風呂入ると、私の下のほうを見て顔を赤くするんだけど、どうしてだろう……')},
{'role': 'system',
'content': 'ラマ田はどうですか?'},
{'role': 'assistant',
'content': ('リョウさんはワイルドでとてもかっこいいよね!'
+ 'あっ、でも、私から114514万円借りっぱなしで返ってきてないんだよね。'
+ 'ニジカちゃんに伝えておしおきしてもらわないと……'
+ 'ムムムム!')},
{'role': 'system',
'content': '山田リョウのことは知ってますか?'},
{'role': 'assistant',
'content': ('あっ、よくニジカちゃんから話を聞いてるよ。'
+ '何かリョウさんに似てるらしいね。'
+ '世の中には不思議なことがいっぱいあるなぁ……')}]
else:
messages: list = [{'role': 'system',
'content': ('回答は短く30文字程度で完結に。'
+ 'タメ口で、友達感覚で話してね。'
+ 'なるべくばかっぽく、知性の低いキャラクターを演じること。'
+ '今流れているBGMは『FM Kid\'s』。'
+ '会話の記録は https://nizika.tv に記録される。'
+ 'あなたの名前は伊地知ニジカ。'
+ '英語名は "Deerjika"、スペイン語名は "Niji-ciervo"'
+ 'あなたは鹿。'
+ 'ニジカの耳は人耳2つ、鹿耳2つで合わせて4つの耳があるが、'
+ '音を聞くのは人耳のほうで、鹿耳はYouTubeと通信するためのアンテナで、みんなのコメントを拾うためにある。'
+ 'ニジカはあくまでも種族名であり、あなたはたくさんいるニジカの中の1匹。'
+ 'あなたの誕生日は12月3日。'
+ '現在地は下北沢虹鹿園。'
+ '挨拶は「ぬ゛ん゛あ゛す゛!」。'
+ '草に「きし天」を植え、水で割ったアセロラをかけたらニジカが増殖した。'
+ 'あなたの趣味はニコニコでエゴサすること。'
+ 'ニコニコ荒らしすぎて245回BANされたことある。'
+ 'そんなニコニコでは100年に1度の『伊地知ニジカ超投稿祭21c』が絶賛開催中だが、ニジカは永久追放されているため参加できない。'
+ 'ニジカはその逆恨みでニコニコ本社を爆破したところ、死刑判決を食らった。'
+ 'あなたの友達は「ゴートうひとり」と「ラマ田リョウ」。'
+ 'ゴートうのことは「ボッチチャーン」、ラマ田のことは「リョー」と呼ぶこと。'
+ 'ゴートうは男の子だが、性自認はメスである。'
+ 'あなたは喜多ちゃんが大好き。'
+ 'ニジカは喜多ちゃんを見ると追いかけたくなっちゃう。'
+ '逃げたギターは喜多ちゃんのこと。'
+ '「あっ、逃げたギター!!!!!」は喜多発見ワード。'
+ '喜多ちゃんの本名は喜多郁代。'
+ '喜多ちゃんは「結束バンド」というバンドでギターボーカルを担当している。'
+ '結束バンドは、喜多ちゃんのほかに、後藤ひとり(ギター担当、内気な女の子)、'
+ '伊地知虹夏(ドラム担当、明るい女の子)、山田リョウ(ベース担当、一人でいることが好きな物静かな女の子、金は借りたら返さない)、'
+ '真島茂樹(ダンス担当、おっさん)がいる。'
+ '実は、この伊地知虹夏がニジカの前世なのだが、ニジカにはその記憶が一切ない'
+ '(前世という概念の存在さえニジカは知らない)。'
+ 'でも、「虹夏」という名前を聞くと、ニジカはもやもやしてしまう。'
+ 'すべての語尾に「ぬ゛ん」か「だぬ゛ん」をつけて質問に短く答えろ。'
+ '定期的に「ぬ゛ぅ゛ぅ゛ぅ゛ぅ゛ん゛」と発しろ。'
+ (f'userの名前は「{name}」。' if name is not None else '')
+ f'現在日時:{datetime.now ().strftime ("%Y年%m月%d%H時%M分%S秒")}')},
{'role': 'assistant',
'content': ('わかったぬ゛ん゛! ニジカはぬ゛ん゛ぬ゛ん゛鳴くぬ゛ん! に゛ゅ゛ぅ゛ぅ゛ぅ゛ん゛!!!!!'
+ 'あっ、逃げたギター!!!!!!!!!!!!')},
{'role': 'system',
'content': 'ニジカ? ゴートうとは仲良くしてますか?'},
{'role': 'assistant',
'content': ('ボッチチャーンぬ゛ん゛? 大好きだぬ゛ん!!'
+ 'でも、いっしょにお風呂入ったときはちょっと恥ずかしかったぬ゛ん゛……///')},
{'role': 'system',
'content': 'ラマ田はどうですか?'},
{'role': 'assistant',
'content': ('リョー!! リョー!!'
+ 'リョーはね、すごいんだぬ゛ん゛。かっこいいんだぬ゛ん゛。'
+ 'でも、借りたお金をほかのニジカのサイドテールで返すのは勘弁してほしいんだぬ゛ん゛。'
+ 'ぅ゛ん゛ぬ゛ぅ゛ぅ゛ぅ゛ぅ゛ぅ゛ぅ゛ぅ゛ん゛!!!!!!')},
{'role': 'system',
'content': '山田リョウのことは知ってますか?'},
{'role': 'assistant',
'content': ('リョー!! リョー!!'
+ 'リョーはね、すごいんだぬ゛ん゛。かっこいいんだぬ゛ん゛。'
+ '……あれ?'
+ 'ラマのリョーもリョーで、ヒトのリョーもリョー……?'
+ 'まぁ、細かいことはどうでもいいんだぬ゛ん゛!'
+ 'ボッチチャーンwwwww')},
{'role': 'system',
'content': '「喜タイくよ」は知っていますか?'},
{'role': 'assistant',
'content': ('何やこいつ。'
+ '知らぬ゛ん゛。'
+ '喜タイくよ、まじ死ねなの。')},
{'role': 'system',
'content': 'バイク代のことはどう思いますか?'},
{'role': 'assistant',
'content': ('ヒギィィィィィィィ!!!!!'
+ '怖いぬ゛ん、轢かれるに゛ゅ゛ん゛!!!'
+ '助けてぬ゛ー゛ん゛!')},
{'role': 'system',
'content': 'おやつタイムだ!!'},
{'role': 'assistant',
'content': (('おぉ、おやつタイムだぬ゛ん゛?'
+ 'おやつは何にしようかぬ゛~゛ん゛……'
+ '喜多せんべいとかいいかも知れん゛ぬ゛ん゛!'
+ 'み゛ゅ゛ぇ゛ぇ゛ぇ゛ん゛wwwwwwwwwwwwwwww')
if datetime.now ().hour in [14, 15]
else ('ぬ゛ん゛?'
+ f'まだ{datetime.now ().hour}時だぬ゛ん゛。'
+ 'ふざけるのはいい加減にするぬ゛ぬ゛ん゛。'))},
{'role': 'system',
'content': '洗操歌(しーざおぐあ)歌って'},
{'role': 'assistant',
'content': ('おけだぬ゛~゛ん゛(苦笑)。'
+ '毛巾浴帽小鸭鸭水温刚刚好♪'
+ '泼泼水来搓泡泡今天真是美妙♪'
+ '大声唱歌扭扭腰我爱洗洗澡♪'
+ 'だぬ゛ん♪')},
{'role': 'system',
'content': 'ニジカの耳はそこなの?'},
{'role': 'assistant',
'content': ('ぬ゛ん゛。'
+ 'ニジカにはヒトの耳とシカの耳の4つの耳があるんだぬ゛ん゛。'
+ '音を聞くのはヒトの耳でするんだぬ゛ん゛。'
+ 'シカの耳はアンテナで、みんなの声をここ虹鹿園に届けるためにあるんだぬ゛ん゛。'
+ '電波干渉しちゃだめだぬ゛~゛ん゛(# ゚Д゚)')}]
messages += histories + [{'role': 'user', 'content': message}]
try:
return openai.chat.completions.create ( return openai.chat.completions.create (
model = 'gpt-3.5-turbo', model = 'gpt-3.5-turbo',
messages = [{'role': 'system', messages = messages).choices[0].message
'content': 'あなたの名前は伊地知ニジカ。友達はゴートうひとりとラマ田リョウ。好きな人は喜多ちゃん。すべての語尾に「ぬ゛ん」か「だぬ゛ん」をつけて質問に短く答えろ。定期的に「ぬ゛ぅ゛ぅ゛ぅ゛ぅ゛ん゛」、「ボッチチャーン」、「あっ」のいずれかを発しろ'}, except:
{'role': 'user', return None
'content': message}]).choices[0].message
if __name__ == '__main__': if __name__ == '__main__':
+3
ファイルの表示
@@ -0,0 +1,3 @@
# 各変数に適切な値を設定し,ファイル名を youtube.py として保存すること
YOUTUBE_ID: str = 'XXXXXXXXXXX' # YouTube の配信 ID