Browse Source

使用glm输出

master
majiahui@haimaqingfan.com 1 month ago
parent
commit
5e786d7604
  1. 25
      flask_drop_rewrite_request.py

25
flask_drop_rewrite_request.py

@ -62,8 +62,10 @@ def get_host_ip():
return ip
chatgpt_url_predict = "http://{}:12001/predict".format(str(get_host_ip()))
chatgpt_url_search = "http://{}:12001/search".format(str(get_host_ip()))
# chatgpt_url_predict = "http://{}:12001/predict".format(str(get_host_ip()))
# chatgpt_url_search = "http://{}:12001/search".format(str(get_host_ip()))
chatgpt_url_predict = "http://{}:20002/predict".format(str(get_host_ip()))
chatgpt_url_search = "http://{}:20002/search".format(str(get_host_ip()))
def smtp_f(name):
@ -491,14 +493,23 @@ def english_ulit(sentence):
# 判断句子长度
if "" != "":
# if "" != "":
# if sentence[-1] != ".":
# text = f"<|im_start|>user\nRewrite the following sentence fragment, ensuring that the meaning remains similar but with significant changes. The length of the rewritten sentence must be greater, not less. Additionally, the words in the short sentences must connect seamlessly with the preceding and following sentences:\n{sentence}<|im_end|>\n<|im_start|>assistant\n"
# else:
# text = f"<|im_start|>user\nRewrite the following sentence, requiring the meaning to be similar but the change to be larger, and the number of words can only be more but not less:\n{sentence}<|im_end|>\n<|im_start|>assistant\n"
# else:
# if_change = False
# text = f"<|im_start|>user\nHello<|im_end|>\n<|im_start|>assistant\n"
if sentence != "":
if sentence[-1] != ".":
text = f"<|im_start|>user\nRewrite the following sentence fragment, ensuring that the meaning remains similar but with significant changes. The length of the rewritten sentence must be greater, not less. Additionally, the words in the short sentences must connect seamlessly with the preceding and following sentences:\n{sentence}<|im_end|>\n<|im_start|>assistant\n"
text = sentence
else:
text = f"<|im_start|>user\nRewrite the following sentence, requiring the meaning to be similar but the change to be larger, and the number of words can only be more but not less:\n{sentence}<|im_end|>\n<|im_start|>assistant\n"
text = sentence
else:
if_change = False
text = f"<|im_start|>user\nHello<|im_end|>\n<|im_start|>assistant\n"
text = sentence
return text, if_change
@ -508,7 +519,7 @@ def chinese_ulit(sentence):
sentence = str(sentence).strip()
if_change = True
text = f"<|im_start|>user\n任务:降aigc率\n请用偏口语化改写句子,要求改写后的句子与原句差别较大,句子完成重新打乱重新描述,语义上可以有变动,让观点更明确,且内容更丰富,形容词增多,但是不能出现明显的逻辑错误和语法错误,不能有不合理的用词,用词必须符合汉语的常识习惯,但是句子格式和内容变化要大,且必须符合人类的书写习惯,语法上必须要规范,尽量多断句,尽量控制每个短句句子长度,能用同义词替换的部分尽量用同义词替换,在句子开头禁止出现连词,比如“首先”, “其次”等,尽量避免出现模糊表达和不确定性表达,比如“某大学”,“某地”,“某城市”等,改写后的句子长度不能少于原句的,需要改写的句子 “{sentence}”,直返会改写后的句子,不要返回其他内容<|im_end|>\n<|im_start|>assistant\n"
text = sentence
# 判断标题
result_biaoti_list_0 = re.findall(pantten_biaoti_0, sentence)

Loading…
Cancel
Save