'update'
This commit is contained in:
+2
-2
@@ -83,8 +83,8 @@ class MZ_CustomizeInstruct:
|
||||
"required": {
|
||||
"system": ("STRING", {"multiline": True, "default": mz_prompts.Long_prompt}),
|
||||
"instruct": ("STRING", {"multiline": True, "default": "Short: {text}"}),
|
||||
"prefix": ("STRING", {"default": "Long: "}),
|
||||
"suffix": ("STRING", {"default": ""}),
|
||||
"start_str": ("STRING", {"default": "Long: "}),
|
||||
"end_str": ("STRING", {"default": ""}),
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
+10
-8
@@ -529,15 +529,17 @@ def base_query_beautify_prompt_text(args_dict):
|
||||
options=options,
|
||||
)
|
||||
|
||||
prefix = customize_instruct.get("prefix", "")
|
||||
# 去除前缀
|
||||
if prefix != "":
|
||||
full_response = full_response.lstrip(prefix)
|
||||
start_str = customize_instruct.get("start_str", "")
|
||||
if start_str != "" and full_response.find(start_str) != -1:
|
||||
full_response_list = full_response.split(start_str)
|
||||
full_response_list[0] = ""
|
||||
full_response = start_str.join(full_response_list)
|
||||
|
||||
suffix = customize_instruct.get("suffix", "")
|
||||
# 去除后缀
|
||||
if suffix != "":
|
||||
full_response = full_response.rstrip(suffix)
|
||||
end_str = customize_instruct.get("end_str", "")
|
||||
if end_str != "" and full_response.find(end_str) != -1:
|
||||
full_response_list = full_response.split(end_str)
|
||||
full_response_list[-1] = ""
|
||||
full_response = end_str.join(full_response_list)
|
||||
|
||||
|
||||
if keep_device is False:
|
||||
|
||||
Reference in New Issue
Block a user