pro-craft 0.2.57__py3-none-any.whl → 0.2.58__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of pro-craft might be problematic. Click here for more details.

@@ -1,115 +0,0 @@
1
-
2
-
3
-
4
- ## 分析编码习惯
5
-
6
-
7
- class MeetingMessageHistory:
8
- def __init__(self):
9
- self._messages: List[Dict[str, Any]] = []
10
-
11
- def add_message(self, role: str, content: str, speaker_name: str = None):
12
- """添加一条消息到历史记录。"""
13
- message = {"role": role, "content": content}
14
- if speaker_name:
15
- message["speaker"] = speaker_name # 添加发言者元信息
16
- self._messages.append(message)
17
-
18
- def get_messages(self) -> List[Dict[str, Any]]:
19
- """获取当前完整的消息历史。"""
20
- return self._messages
21
-
22
- def clear(self):
23
- """清空消息历史。"""
24
- self._messages = []
25
-
26
- def __str__(self) -> str:
27
- return "\n".join([f"[{msg.get('speaker', msg['role'])}] {msg['content']}" for msg in self._messages])
28
-
29
-
30
- # 模拟一个外部 LLM 调用函数,以便在框架中演示
31
- def simulate_external_llm_call(messages: List[Dict[str, Any]], model_name: str = "default") -> str:
32
- """模拟调用外部 LLM 函数."""
33
- print(messages[0].get('speaker'),'messages')
34
- print(model_name,'model_name')
35
-
36
- bx = BianXieAdapter()
37
- bx.set_model(model_name)
38
- result = bx.chat(messages)
39
- simulated_response = f"[{model_name}] Responding to '{result}"
40
- return simulated_response
41
-
42
- class MeetingOrganizer:
43
- def __init__(self):
44
- # 存储参会者信息:名称和使用的模型
45
- self._participants: List[Dict[str, str]] = []
46
- self._history = MeetingMessageHistory()
47
- self._topic: str = ""
48
- self._background: str = ""
49
- # TODO: 在实际使用时,这里应该引用您真实的 LLM 调用函数
50
- self._llm_caller = simulate_external_llm_call # 指向您外部的 LLM 调用函数
51
-
52
- def set_llm_caller(self, caller_func):
53
- """设置外部的 LLM 调用函数."""
54
- self._llm_caller = caller_func
55
- print("External LLM caller function set.")
56
-
57
-
58
- def add_participant(self, name: str, model_name: str = "default"):
59
- """添加一个参会者 (LLM) 到会议中。"""
60
- participant_info = {"name": name, "model": model_name}
61
- self._participants.append(participant_info)
62
- print(f"Added participant: {name} (using model: {model_name})")
63
-
64
- def set_topic(self, topic: str, background: str = ""):
65
- """设置会议主题和背景。"""
66
- self._topic = topic
67
- self._background = background
68
- initial_message = f"Meeting Topic: {topic}\nBackground: {background}"
69
- # 可以将主题和背景作为用户输入的第一条消息,或者 system 消息
70
- self._history.add_message("user", initial_message, speaker_name="Meeting Host")
71
- print(f"Meeting topic set: {topic}")
72
-
73
- def run_simple_round(self):
74
- """执行一轮简单的会议:每个参会 LLM 基于当前历史回复一次。"""
75
- if not self._participants:
76
- print("No participants in the meeting.")
77
- return
78
-
79
- print("\n--- Running a Simple Meeting Round ---")
80
- current_history = self._history.get_messages()
81
-
82
- for participant in self._participants:
83
- participant_name = participant["name"]
84
- model_to_use = participant["model"]
85
- try:
86
- # 调用外部 LLM 函数
87
- print(current_history,'current_history')
88
- response_content = self._llm_caller(current_history, model_name=model_to_use)
89
- # 将回复添加到历史中,并标记发言者
90
- self._history.add_message("assistant", response_content, speaker_name=participant_name)
91
- print(f"'{participant_name}' responded.")
92
- except Exception as e:
93
- print(f"Error during '{participant_name}' participation: {e}")
94
- # 在框架阶段,简单的错误打印即可
95
-
96
- def get_discussion_history(self) -> List[Dict[str, Any]]:
97
- """获取完整的讨论消息历史。"""
98
- return self._history.get_messages()
99
-
100
- def get_simple_summary(self) -> str:
101
- """获取简单的讨论摘要(第一阶段:拼接所有 LLM 发言)。"""
102
- print("\n--- Generating Simple Summary ---")
103
- summary_parts = []
104
- for message in self._history.get_messages():
105
- # 提取 assistant 角色的发言作为摘要内容
106
- if message.get("role") == "assistant":
107
- speaker = message.get("speaker", "Unknown Assistant")
108
- summary_parts.append(f"[{speaker}]: {message['content']}")
109
-
110
- return "\n\n".join(summary_parts)
111
-
112
- def display_history(self):
113
- """打印格式化的讨论历史。"""
114
- print("\n--- Full Discussion History ---")
115
- print(self._history)
@@ -1,21 +0,0 @@
1
- pro_craft/__init__.py,sha256=F9tKarKn247Oq4brgcEAKdRVeciaw8WGL56QOAci21Y,310
2
- pro_craft/database.py,sha256=784kXjJPKdxkrNakNOS7j_ucCgvEp60q2mSbg_K6qHU,9339
3
- pro_craft/file_manager.py,sha256=abVAlJ07_egWNuTj4JiP4me8NloQrsXGNd-SP63ab94,3738
4
- pro_craft/log.py,sha256=cL8mZIVvmsATMgHMfVxlLwHSn0ehzsZUpLQyK0hEWFg,5011
5
- pro_craft/utils.py,sha256=R1DFkS4dsm5dIhg8lLTgBBvItvIYyyojROdh-ykqiYk,5250
6
- pro_craft/code_helper/coder.py,sha256=L6pRQr0pYRIHrMFZ4-pO_tZf1koxgGgF3L7Vl-GIyjM,24687
7
- pro_craft/code_helper/designer.py,sha256=3gyCqrjcw61sHzDjUPKhL1LOAE8xWLLbNT8NlK2mFLc,4739
8
- pro_craft/prompt_craft/__init__.py,sha256=83ruWO1Oci-DWvdVhPqcQrgdZTNfbmK72VQCkWASk7A,80
9
- pro_craft/prompt_craft/async_.py,sha256=IBLdcK3bngk3o0Mfc6PkMqouBdSQhiFperYuVLl3bBk,56310
10
- pro_craft/prompt_craft/new.py,sha256=ULjGGl95vmHrOs7XECJGlaqj1NE9BypE5WnFYhGugRY,25903
11
- pro_craft/prompt_craft/sync.py,sha256=4bms8Qvzq5QqgwHWwiyjrcl7hdkSqE7Kne5s3Ex8bBU,26217
12
- pro_craft/server/mcp/__init__.py,sha256=4dbl-lFcm0r2tkOP04OxqiZG2jR-rqF181qi2AfU6UA,123
13
- pro_craft/server/mcp/models.py,sha256=0QlohI7aSVjYjMdXK9Rq19Dp7b2LnjLKIiArDzI1ufg,1272
14
- pro_craft/server/mcp/prompt.py,sha256=zZ58zb422vhwoL_uYCVBdOwOR-xy69MLQ5tyVfbpBlU,2505
15
- pro_craft/server/router/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
- pro_craft/server/router/models.py,sha256=o60_qHjFIHwH3Pp6jNmg3V23GyFeXJXH-V6uBVoztXQ,1340
17
- pro_craft/server/router/prompt.py,sha256=Y9WWYq8GrcGhYPcWOSyGHGx9j-I0kxjCCt10BMN98g4,7749
18
- pro_craft-0.2.57.dist-info/METADATA,sha256=OnqYlovmtP3hQIEXoa247Wg6A7TzX6Y9XX5Kk6T1fSQ,1782
19
- pro_craft-0.2.57.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
20
- pro_craft-0.2.57.dist-info/top_level.txt,sha256=yqYDHArnYMWpeCxkmGRwlL6sJtxiOUnYylLDx9EOgFg,10
21
- pro_craft-0.2.57.dist-info/RECORD,,