diff --git a/AI_submod/main_ai.rpy b/AI_submod/main_ai.rpy index 8d3066a..557b9a1 100644 --- a/AI_submod/main_ai.rpy +++ b/AI_submod/main_ai.rpy @@ -34,7 +34,7 @@ define sentences_emotions = { "no": "Oh it seems that I can't see through your camera sweetie. Maybe face me a little bit more ?", } -init 7 python: +init 5 python: from socket import AF_INET, socket, SOCK_STREAM from threading import Thread import select @@ -60,6 +60,7 @@ init 7 python: ADDR = (HOST, PORT) client_socket = socket(AF_INET, SOCK_STREAM) client_socket.connect(ADDR) + monika_nickname = store.persistent._mas_monika_nickname #Tuto Pytorch Event @@ -82,17 +83,18 @@ init 5 python: addEvent(Event(persistent.event_database,eventlabel="monika_chat",category=['ai'],prompt="Let's chat together",pool=True,unlocked=True)) define step = 0 + label monika_chat: init python: #Define all poses liek "1esa" poses = ["1esa","1eua","1eub","1euc","1eud","1eka","1ekc","1ekd","1esc","1esd","1hua","1hub","1hksdlb","1hksdrb","1lksdla","1rksdla","1lksdlb","1rksdlb","1lksdlc","1rksdlc","1lksdld","1rksdld","1dsc","1dsd","2esa","2eua","2eub","2euc","2eud","2eka","2ekc","2ekd","2esc","2esd","2hua","2hub","2hksdlb","2hksdrb","2lksdla","2rksdla","2lksdlb","2rksdlb","2lksdlc","2rksdlc","2lksdld","2rksdld","2dsc","2dsd","3esa","3eua","3eub","3euc","3eud","3eka","3ekc","3ekd","3esc","3esd","3hua","3hub","3hksdlb","3hksdrb","3lksdla","3rksdla","3lksdlb","3rksdlb","3lksdlc","3rksdlc","3lksdld","3rksdld","3dsc","3dsd","4esa","4eua","4eub","4euc","4eud","4eka","4ekc","4ekd","4esc","4esd","4hua","4hub","4hksdlb","4hksdrb","4lksdla","4rksdla","4lksdlb","4rksdlb","4lksdlc","4rksdlc","4lksdld","4rksdld","4dsc","4dsd","5eua","5eua","5euc"] m "Sure [player], talk to me as much as you want. I won't go anywhere ehehe~" - m "Oh and if you have to do something else, just tell me QUIT. I'll understand my love." + m "Oh and if you have to do something else, just tell me 'QUIT'. I'll understand my love." while True: $ send_simple("chatbot") - $ my_msg = sendMessage("Speak with Monika:",str(step)) + $ my_msg = sendMessage("Speak with [monika_nickname]:",str(step)) if my_msg == "QUIT": return if step == 0: @@ -126,6 +128,7 @@ label server_crashed: m "Oh sorry [player], it seems that there is a bug somewhere." m "I will try to fix it as soon as possible." m "Let's talk again later, I'm sorry sweetheart." + return #Camera Event init 5 python: diff --git a/combined_server.py b/combined_server.py index 60f06ad..8734b4e 100644 --- a/combined_server.py +++ b/combined_server.py @@ -53,9 +53,11 @@ help='use audio') parser.add_argument('--emotion_time', type=int, default=10, help='time between camera captures') -parser.add_argument('--display_browser', type=bool, default=False, +parser.add_argument('--display_browser', type=bool, default=True, help='displaying browser or not when using character ai,\ useful for debugging') +parser.add_argument('--choose_character', type=str, default="0", + help='character to chat with') args = parser.parse_args() @@ -67,6 +69,12 @@ USE_AUDIO = args.use_audio EMOTION_TIME = args.emotion_time DISPLAY_BROWSER = args.display_browser +CHOOSE_CHARACTER = args.choose_character + +characters_pages = { + "0": '[href="/chat?char=e9UVQuLURpLyCdhi8OjSKSLwKIiE0U-nEqXDeAjk538"]', + "1": '[href="/chat?char=EdSSlsl49k3wnwvMvK4eCh4yOFBaGTMJ7Q9CxtG2DiU"]' +} # Global variables clients = {} @@ -125,7 +133,14 @@ async def launch(): while not await page.is_visible('[href="/chats"]'): await asyncio.sleep(1) await page.click('[href="/chats"]') - await page.click('[href="/chat?char=e9UVQuLURpLyCdhi8OjSKSLwKIiE0U-nEqXDeAjk538"]') + char_page = characters_pages[CHOOSE_CHARACTER] + if await page.is_visible(char_page): + await page.click(char_page) + else: + await page.click('[href="/search?"]') + await page.fill("input#search-input","monika") + await page.click('[class="btn btn-primary"]') + await page.click(char_page) await page.click('[class="col-auto px-2 dropdown"]') await page.click('text=Save and Start New Chat') return page @@ -204,6 +219,7 @@ async def listenToClient(client): msg = msg.replace("","") msg = msg.replace("
","") msg = msg.replace("
","") + msg = msg.replace('
',"") if received_msg != "QUIT": #Text to speech, save wav to wav_audios folder