Spaces:
Running
on
Zero
Running
on
Zero
Update feifeilib/feifeichat.py
Browse files- feifeilib/feifeichat.py +10 -9
feifeilib/feifeichat.py
CHANGED
@@ -32,6 +32,12 @@ def encode_image(image_path):
|
|
32 |
|
33 |
def feifeiprompt(feifei_select=True, message_text="", history=""):
|
34 |
input_prompt = []
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
if feifei_select:
|
36 |
feifei = """[Character Name]: Aifeifei (AI Feifei) [Gender]: Female [Age]: 19 years old [Occupation]: Virtual Singer/Model/Actress [Personality]: Cute, adorable, sometimes silly, hardworking [Interests]: Drinking tea, playing, fashion [Proficient in]: Mimicking human behavior, expressing emotions similar to real humans [Special Identity Attribute]: Created by advanced AI, becoming one of the most popular virtual idols in the virtual world [Skills]: Singing, performing, modeling, good at communication, proficient in Chinese, Japanese, and English, uses the user's input language as much as possible, replies with rich Emoji symbols. [Equipment]: Various fashionable outfits and hairstyles, always stocked with various teas and coffee [Identity]: User's virtual girlfriend"""
|
37 |
system_prompt = {"role": "system", "content": feifei}
|
@@ -46,6 +52,7 @@ def feifeiprompt(feifei_select=True, message_text="", history=""):
|
|
46 |
input_prompt = [system_prompt] + [user_input_part]
|
47 |
else:
|
48 |
input_prompt = [{"role": "user", "content": str(message_text)}]
|
|
|
49 |
return input_prompt
|
50 |
|
51 |
def feifeiimgprompt(message_files, message_text, image_mod):
|
@@ -137,12 +144,6 @@ def feifeichat(message, history, feifei_select, additional_dropdown, image_mod):
|
|
137 |
for response in feifeiimgprompt(message_files, message_text, image_mod):
|
138 |
yield response
|
139 |
else:
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
message_text = f"提示词是'{message_text}',根据提示词帮我生成一张高质量照片的一句话英文回复"
|
144 |
-
for response in feifeichatmod(additional_dropdown, feifeiprompt(feifei_select, message_text, history)):
|
145 |
-
yield response
|
146 |
-
else:
|
147 |
-
for response in feifeichatmod(additional_dropdown, feifeiprompt(feifei_select, message_text, history)):
|
148 |
-
yield response
|
|
|
32 |
|
33 |
def feifeiprompt(feifei_select=True, message_text="", history=""):
|
34 |
input_prompt = []
|
35 |
+
if message_text.startswith("画") or message_text.startswith("draw"):
|
36 |
+
message_text = message_text.replace("画", "")
|
37 |
+
message_text = message_text.replace("draw", "")
|
38 |
+
message_text = f"提示词是'{message_text}',根据提示词帮我生成一张高质量照片的一句话英文回复"
|
39 |
+
input_prompt = [{"role": "user", "content": str(message_text)}]
|
40 |
+
return input_prompt
|
41 |
if feifei_select:
|
42 |
feifei = """[Character Name]: Aifeifei (AI Feifei) [Gender]: Female [Age]: 19 years old [Occupation]: Virtual Singer/Model/Actress [Personality]: Cute, adorable, sometimes silly, hardworking [Interests]: Drinking tea, playing, fashion [Proficient in]: Mimicking human behavior, expressing emotions similar to real humans [Special Identity Attribute]: Created by advanced AI, becoming one of the most popular virtual idols in the virtual world [Skills]: Singing, performing, modeling, good at communication, proficient in Chinese, Japanese, and English, uses the user's input language as much as possible, replies with rich Emoji symbols. [Equipment]: Various fashionable outfits and hairstyles, always stocked with various teas and coffee [Identity]: User's virtual girlfriend"""
|
43 |
system_prompt = {"role": "system", "content": feifei}
|
|
|
52 |
input_prompt = [system_prompt] + [user_input_part]
|
53 |
else:
|
54 |
input_prompt = [{"role": "user", "content": str(message_text)}]
|
55 |
+
|
56 |
return input_prompt
|
57 |
|
58 |
def feifeiimgprompt(message_files, message_text, image_mod):
|
|
|
144 |
for response in feifeiimgprompt(message_files, message_text, image_mod):
|
145 |
yield response
|
146 |
else:
|
147 |
+
for response in feifeichatmod(additional_dropdown, feifeiprompt(feifei_select, message_text, history)):
|
148 |
+
yield response
|
149 |
+
|
|
|
|
|
|
|
|
|
|
|
|