39
webui.py
39
webui.py
@@ -66,6 +66,16 @@ else:
|
||||
|
||||
HAVE_ONLINE_STATUS_VERSION = version.parse("0.0.9")
|
||||
|
||||
#定义意愿模式可选项
|
||||
WILLING_MODE_CHOICES = [
|
||||
"classical",
|
||||
"dynamic",
|
||||
"custom",
|
||||
]
|
||||
|
||||
|
||||
|
||||
|
||||
#添加WebUI配置文件版本
|
||||
WEBUI_VERSION = version.parse("0.0.9")
|
||||
|
||||
@@ -435,7 +445,9 @@ def adjust_personality_less_probabilities(
|
||||
|
||||
def adjust_model_greater_probabilities(t_model_1_probability, t_model_2_probability, t_model_3_probability):
|
||||
total = (
|
||||
Decimal(str(t_model_1_probability)) + Decimal(str(t_model_2_probability)) + Decimal(str(t_model_3_probability))
|
||||
Decimal(str(t_model_1_probability)) +
|
||||
Decimal(str(t_model_2_probability)) +
|
||||
Decimal(str(t_model_3_probability))
|
||||
)
|
||||
if total > Decimal("1.0"):
|
||||
warning_message = (
|
||||
@@ -447,7 +459,9 @@ def adjust_model_greater_probabilities(t_model_1_probability, t_model_2_probabil
|
||||
|
||||
def adjust_model_less_probabilities(t_model_1_probability, t_model_2_probability, t_model_3_probability):
|
||||
total = (
|
||||
Decimal(str(t_model_1_probability)) + Decimal(str(t_model_2_probability)) + Decimal(str(t_model_3_probability))
|
||||
Decimal(str(t_model_1_probability))
|
||||
+ Decimal(str(t_model_2_probability))
|
||||
+ Decimal(str(t_model_3_probability))
|
||||
)
|
||||
if total < Decimal("1.0"):
|
||||
warning_message = (
|
||||
@@ -522,6 +536,7 @@ def save_message_and_emoji_config(
|
||||
|
||||
|
||||
def save_response_model_config(
|
||||
t_willing_mode,
|
||||
t_model_r1_probability,
|
||||
t_model_r2_probability,
|
||||
t_model_r3_probability,
|
||||
@@ -543,6 +558,8 @@ def save_response_model_config(
|
||||
t_vlm_model_name,
|
||||
t_vlm_model_provider,
|
||||
):
|
||||
if PARSED_CONFIG_VERSION >= version.parse("0.0.10"):
|
||||
config_data["willing"]["willing_mode"] = t_willing_mode
|
||||
config_data["response"]["model_r1_probability"] = t_model_r1_probability
|
||||
config_data["response"]["model_v3_probability"] = t_model_r2_probability
|
||||
config_data["response"]["model_r1_distill_probability"] = t_model_r3_probability
|
||||
@@ -1182,6 +1199,23 @@ with gr.Blocks(title="MaimBot配置文件编辑") as app:
|
||||
with gr.Column(scale=3):
|
||||
with gr.Row():
|
||||
gr.Markdown("""### 回复设置""")
|
||||
if PARSED_CONFIG_VERSION >= version.parse("0.0.10"):
|
||||
with gr.Row():
|
||||
gr.Markdown("""#### 回复意愿模式""")
|
||||
with gr.Row():
|
||||
gr.Markdown("""回复意愿模式说明:\n
|
||||
classical为经典回复意愿管理器\n
|
||||
dynamic为动态意愿管理器\n
|
||||
custom为自定义意愿管理器
|
||||
""")
|
||||
with gr.Row():
|
||||
willing_mode = gr.Dropdown(
|
||||
choices=WILLING_MODE_CHOICES,
|
||||
value=config_data["willing"]["willing_mode"],
|
||||
label="回复意愿模式"
|
||||
)
|
||||
else:
|
||||
willing_mode = gr.Textbox(visible=False,value="disabled")
|
||||
with gr.Row():
|
||||
model_r1_probability = gr.Slider(
|
||||
minimum=0,
|
||||
@@ -1355,6 +1389,7 @@ with gr.Blocks(title="MaimBot配置文件编辑") as app:
|
||||
save_model_btn.click(
|
||||
save_response_model_config,
|
||||
inputs=[
|
||||
willing_mode,
|
||||
model_r1_probability,
|
||||
model_r2_probability,
|
||||
model_r3_probability,
|
||||
|
||||
Reference in New Issue
Block a user