add action chain

This commit is contained in:
bridge
2025-09-02 00:35:07 +08:00
parent 420a17d471
commit 3047de0367
18 changed files with 370 additions and 150 deletions

20
src/utils/id_generator.py Normal file
View File

@@ -0,0 +1,20 @@
"""
简化的ID生成器替代UUID4
"""
import random
import string
def base62_id(length: int = 8) -> str:
"""
生成base62编码的短ID数字+大小写字母)
默认8位比UUID4的36位短很多
"""
charset = string.ascii_letters + string.digits # 0-9, a-z, A-Z (62个字符)
return ''.join(random.choices(charset, k=length))
def get_avatar_id() -> str:
"""获取Avatar ID的默认函数"""
return base62_id(8)

View File

@@ -44,8 +44,8 @@ def get_prompt_and_call_llm(template_path: Path, infos: dict) -> str:
prompt = get_prompt(template, infos)
res = call_llm(prompt)
json_res = json.loads(res)
print(f"prompt = {prompt}")
print(f"res = {res}")
# print(f"prompt = {prompt}")
# print(f"res = {res}")
return json_res
def get_ai_prompt_and_call_llm(infos: dict) -> dict: