This commit is contained in:
guanjihuan 2025-02-27 18:23:03 +08:00
parent 18a7236eff
commit 319981909f
3 changed files with 12 additions and 4 deletions

View File

@ -1,7 +1,7 @@
[metadata]
# replace with your username:
name = guan
version = 0.1.153
version = 0.1.154
author = guanjihuan
author_email = guanjihuan@163.com
description = An open source python package

View File

@ -1,6 +1,6 @@
Metadata-Version: 2.2
Name: guan
Version: 0.1.153
Version: 0.1.154
Summary: An open source python package
Home-page: https://py.guanjihuan.com
Author: guanjihuan

View File

@ -42,7 +42,7 @@ def auto_chat(prompt='你好', round=2, model=1, stream=1):
import guan
response0 = prompt
for i0 in range(round):
print(f'【对话第 {i0+1} 轮】\n')
print(f'\n【对话第 {i0+1} 轮】\n')
print('机器人 1: ')
response1 = guan.chat(prompt=response0, model=model, stream=stream)
print('机器人 2: ')
@ -53,7 +53,7 @@ def auto_chat_with_guide(prompt='你好', guide_message='回答字数少于30
import guan
response0 = prompt
for i0 in range(round):
print(f'【对话第 {i0+1} 轮】\n')
print(f'\n【对话第 {i0+1} 轮】\n')
print('机器人 1: ')
response1 = guan.chat(prompt=response0+guide_message, model=model, stream=stream)
print('机器人 2: ')
@ -318,6 +318,14 @@ def get_string_between_two_patterns(original_string, start, end, include_start_a
else:
return ''
# 删除某个字符串中两个模式之间的内容,返回新字符串
def remove_substrings(original_string, start, end):
import re
escaped_start = re.escape(start)
escaped_end = re.escape(end)
pattern = f'{escaped_start}.*?{escaped_end}'
return re.sub(pattern, '', original_string, flags=re.DOTALL)
# 打印数组
def print_array(array, line_break=0):
if line_break == 0: