pygpt-net 2.6.61__py3-none-any.whl → 2.6.63__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.
Files changed (86) hide show
  1. pygpt_net/CHANGELOG.txt +12 -0
  2. pygpt_net/__init__.py +3 -3
  3. pygpt_net/controller/chat/response.py +8 -2
  4. pygpt_net/controller/presets/editor.py +65 -1
  5. pygpt_net/controller/settings/profile.py +16 -4
  6. pygpt_net/controller/settings/workdir.py +30 -5
  7. pygpt_net/controller/theme/common.py +4 -2
  8. pygpt_net/controller/theme/markdown.py +2 -2
  9. pygpt_net/controller/theme/theme.py +2 -1
  10. pygpt_net/controller/ui/ui.py +31 -3
  11. pygpt_net/core/agents/custom/llama_index/runner.py +30 -52
  12. pygpt_net/core/agents/custom/runner.py +199 -76
  13. pygpt_net/core/agents/runners/llama_workflow.py +122 -12
  14. pygpt_net/core/agents/runners/openai_workflow.py +2 -1
  15. pygpt_net/core/node_editor/types.py +13 -1
  16. pygpt_net/core/render/web/renderer.py +76 -11
  17. pygpt_net/data/config/config.json +3 -3
  18. pygpt_net/data/config/models.json +3 -3
  19. pygpt_net/data/config/presets/agent_openai_b2b.json +1 -15
  20. pygpt_net/data/config/presets/agent_openai_coder.json +1 -15
  21. pygpt_net/data/config/presets/agent_openai_evolve.json +1 -23
  22. pygpt_net/data/config/presets/agent_openai_planner.json +1 -21
  23. pygpt_net/data/config/presets/agent_openai_researcher.json +1 -21
  24. pygpt_net/data/config/presets/agent_openai_supervisor.json +1 -13
  25. pygpt_net/data/config/presets/agent_openai_writer.json +1 -15
  26. pygpt_net/data/config/presets/agent_supervisor.json +1 -11
  27. pygpt_net/data/css/style.dark.css +18 -0
  28. pygpt_net/data/css/style.light.css +20 -1
  29. pygpt_net/data/js/app/runtime.js +4 -1
  30. pygpt_net/data/js/app.min.js +3 -2
  31. pygpt_net/data/locale/locale.de.ini +2 -0
  32. pygpt_net/data/locale/locale.en.ini +7 -0
  33. pygpt_net/data/locale/locale.es.ini +2 -0
  34. pygpt_net/data/locale/locale.fr.ini +2 -0
  35. pygpt_net/data/locale/locale.it.ini +2 -0
  36. pygpt_net/data/locale/locale.pl.ini +3 -1
  37. pygpt_net/data/locale/locale.uk.ini +2 -0
  38. pygpt_net/data/locale/locale.zh.ini +2 -0
  39. pygpt_net/item/ctx.py +23 -1
  40. pygpt_net/js_rc.py +13 -10
  41. pygpt_net/provider/agents/base.py +0 -0
  42. pygpt_net/provider/agents/llama_index/flow_from_schema.py +0 -0
  43. pygpt_net/provider/agents/llama_index/workflow/codeact.py +9 -6
  44. pygpt_net/provider/agents/llama_index/workflow/openai.py +38 -11
  45. pygpt_net/provider/agents/llama_index/workflow/planner.py +248 -28
  46. pygpt_net/provider/agents/llama_index/workflow/supervisor.py +60 -10
  47. pygpt_net/provider/agents/openai/agent.py +3 -1
  48. pygpt_net/provider/agents/openai/agent_b2b.py +17 -13
  49. pygpt_net/provider/agents/openai/agent_planner.py +617 -258
  50. pygpt_net/provider/agents/openai/agent_with_experts.py +4 -1
  51. pygpt_net/provider/agents/openai/agent_with_experts_feedback.py +8 -6
  52. pygpt_net/provider/agents/openai/agent_with_feedback.py +8 -6
  53. pygpt_net/provider/agents/openai/evolve.py +12 -8
  54. pygpt_net/provider/agents/openai/flow_from_schema.py +0 -0
  55. pygpt_net/provider/agents/openai/supervisor.py +292 -37
  56. pygpt_net/provider/api/openai/agents/response.py +1 -0
  57. pygpt_net/provider/api/x_ai/__init__.py +0 -0
  58. pygpt_net/provider/core/agent/__init__.py +0 -0
  59. pygpt_net/provider/core/agent/base.py +0 -0
  60. pygpt_net/provider/core/agent/json_file.py +0 -0
  61. pygpt_net/provider/core/config/patch.py +8 -0
  62. pygpt_net/provider/core/config/patches/patch_before_2_6_42.py +0 -0
  63. pygpt_net/provider/llms/base.py +0 -0
  64. pygpt_net/provider/llms/deepseek_api.py +0 -0
  65. pygpt_net/provider/llms/google.py +0 -0
  66. pygpt_net/provider/llms/hugging_face_api.py +0 -0
  67. pygpt_net/provider/llms/hugging_face_router.py +0 -0
  68. pygpt_net/provider/llms/mistral.py +0 -0
  69. pygpt_net/provider/llms/perplexity.py +0 -0
  70. pygpt_net/provider/llms/x_ai.py +0 -0
  71. pygpt_net/tools/agent_builder/tool.py +6 -0
  72. pygpt_net/tools/agent_builder/ui/dialogs.py +0 -41
  73. pygpt_net/ui/layout/toolbox/presets.py +14 -2
  74. pygpt_net/ui/main.py +2 -2
  75. pygpt_net/ui/widget/dialog/confirm.py +55 -5
  76. pygpt_net/ui/widget/draw/painter.py +90 -1
  77. pygpt_net/ui/widget/lists/preset.py +289 -25
  78. pygpt_net/ui/widget/node_editor/editor.py +53 -15
  79. pygpt_net/ui/widget/node_editor/node.py +82 -104
  80. pygpt_net/ui/widget/node_editor/view.py +4 -5
  81. pygpt_net/ui/widget/textarea/input.py +155 -21
  82. {pygpt_net-2.6.61.dist-info → pygpt_net-2.6.63.dist-info}/METADATA +22 -8
  83. {pygpt_net-2.6.61.dist-info → pygpt_net-2.6.63.dist-info}/RECORD +70 -70
  84. {pygpt_net-2.6.61.dist-info → pygpt_net-2.6.63.dist-info}/LICENSE +0 -0
  85. {pygpt_net-2.6.61.dist-info → pygpt_net-2.6.63.dist-info}/WHEEL +0 -0
  86. {pygpt_net-2.6.61.dist-info → pygpt_net-2.6.63.dist-info}/entry_points.txt +0 -0
@@ -658,6 +658,7 @@ event.control.voice_cmd.toggle = 语音控制:切换
658
658
  event.control.voice_msg.start = 语音输入:开始
659
659
  event.control.voice_msg.stop = 语音输入:停止
660
660
  event.control.voice_msg.toggle = 语音输入:切换
661
+ exit.msg = 你喜欢PyGPT吗?支持项目的发展:
661
662
  expert.wait.failed: 调用专家失败
662
663
  expert.wait.status: 等待专家...
663
664
  files.delete.confirm = 刪除文件/目錄?
@@ -734,6 +735,7 @@ input.search.placeholder = 搜索...
734
735
  input.send_clear = 發送後清除
735
736
  input.stream = 流
736
737
  input.tab = 輸入
738
+ input.tab.tooltip = {chars} 字符 (~{tokens} 令牌)
737
739
  interpreter.all = 执行历史记录(全部)
738
740
  interpreter.auto_clear = 发送时清除
739
741
  interpreter.btn.clear = 清除输出
pygpt_net/item/ctx.py CHANGED
@@ -6,7 +6,7 @@
6
6
  # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
7
  # MIT License #
8
8
  # Created By : Marcin Szczygliński #
9
- # Updated Date: 2025.09.05 18:00:00 #
9
+ # Updated Date: 2025.09.26 17:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  import copy
@@ -209,6 +209,28 @@ class CtxItem:
209
209
  if src:
210
210
  setattr(self, name, dp(src))
211
211
 
212
+ def set_agent_name(self, name: Optional[str]):
213
+ """
214
+ Set AI/agent name
215
+
216
+ :param name: name
217
+ """
218
+ self.ai_name = name
219
+ if name:
220
+ if self.extra is None:
221
+ self.extra = {}
222
+ self.extra['agent_name'] = name
223
+
224
+ def get_agent_name(self) -> Optional[str]:
225
+ """
226
+ Get AI/agent name
227
+
228
+ :return: name
229
+ """
230
+ if self.extra and isinstance(self.extra, dict):
231
+ return self.extra.get('agent_name', None)
232
+ return None
233
+
212
234
  def is_empty(self) -> bool:
213
235
  """
214
236
  Check if context item is empty
pygpt_net/js_rc.py CHANGED
@@ -111344,7 +111344,7 @@ toggleEl.classLi\
111344
111344
  st.toggle('toggl\
111345
111345
  e-expanded');\x0a\x09}\
111346
111346
  \x0a}\
111347
- \x00\x00J]\
111347
+ \x00\x00J\x8d\
111348
111348
  /\
111349
111349
  / ==============\
111350
111350
  ================\
@@ -111867,8 +111867,11 @@ utput = () => th\
111867
111867
  is.toolOutput.be\
111868
111868
  gin();\x0a\x09api_endT\
111869
111869
  oolOutput = () =\
111870
- > this.toolOutpu\
111871
- t.end();\x0a\x09api_en\
111870
+ > {\x0a\x09 this.to\
111871
+ olOutput.end();\x0a\
111872
+ \x09 this.scroll\
111873
+ Mgr.scheduleScro\
111874
+ ll();\x0a\x09}\x0a\x09api_en\
111872
111875
  ableToolOutput =\
111873
111876
  () => this.tool\
111874
111877
  Output.enable();\
@@ -113507,8 +113510,8 @@ ros||{},d(e,r)}}\
113507
113510
  /\
113508
113511
  * app.min.js \xe2\x80\x94\
113509
113512
  generated on 20\
113510
- 25-09-22 09:05:0\
113511
- 8 by bin/minify_\
113513
+ 25-09-22 22:18:1\
113514
+ 3 by bin/minify_\
113512
113515
  js.py using rjsm\
113513
113516
  in */\x0a\x0a/* data/j\
113514
113517
  s/app/async.js *\
@@ -125325,8 +125328,8 @@ order: 1px solid\
125325
125328
  transparent; ba\
125326
125329
  ckground: transp\
125327
125330
  arent; }','.msg-\
125328
- box.msg-user:hov\
125329
- er .msg .msg-cop\
125331
+ box.msg-user .ms\
125332
+ g:hover .msg-cop\
125330
125333
  y-btn, .msg-box.\
125331
125334
  msg-user .msg:fo\
125332
125335
  cus-within .msg-\
@@ -126940,14 +126943,14 @@ qt_resource_struct = b"\
126940
126943
  \x00\x00\x02\x88\x00\x00\x00\x00\x00\x01\x00\x18\x02\xdd\
126941
126944
  \x00\x00\x030\x00\x00\x00\x00\x00\x01\x00\x1b+\x19\
126942
126945
  \x00\x00\x02\x0e\x00\x00\x00\x00\x00\x01\x00\x13kD\
126943
- \x00\x00\x03\x9c\x00\x00\x00\x00\x00\x01\x00\x1b\xb1\x9d\
126946
+ \x00\x00\x03\x9c\x00\x00\x00\x00\x00\x01\x00\x1b\xb1\xcd\
126944
126947
  \x00\x00\x01\xb2\x00\x00\x00\x00\x00\x01\x00\x13\x0dY\
126945
126948
  \x00\x00\x00\xf8\x00\x00\x00\x00\x00\x01\x00\x11H\xf7\
126946
126949
  \x00\x00\x01\xf0\x00\x00\x00\x00\x00\x01\x00\x13d>\
126947
126950
  \x00\x00\x00J\x00\x00\x00\x00\x00\x01\x00\x10\x8c-\
126948
126951
  \x00\x00\x016\x00\x00\x00\x00\x00\x01\x00\x11j\xda\
126949
126952
  \x00\x00\x02\xb2\x00\x00\x00\x00\x00\x01\x00\x19\xe5\xc3\
126950
- \x00\x00\x03R\x00\x00\x00\x00\x00\x01\x00\x1buz\
126953
+ \x00\x00\x03R\x00\x00\x00\x00\x00\x01\x00\x1bu\xaa\
126951
126954
  \x00\x00\x02\xd0\x00\x00\x00\x00\x00\x01\x00\x1a\x15/\
126952
126955
  \x00\x00\x01\x96\x00\x00\x00\x00\x00\x01\x00\x13\x04\x0b\
126953
126956
  \x00\x00\x02.\x00\x00\x00\x00\x00\x01\x00\x13\x82Z\
@@ -126958,7 +126961,7 @@ qt_resource_struct = b"\
126958
126961
  \x00\x00\x00\x8a\x00\x00\x00\x00\x00\x01\x00\x11\x07\xcf\
126959
126962
  \x00\x00\x02\xf0\x00\x00\x00\x00\x00\x01\x00\x1a\x8d\x01\
126960
126963
  \x00\x00\x00\xc2\x00\x00\x00\x00\x00\x01\x00\x11Bm\
126961
- \x00\x00\x03r\x00\x00\x00\x00\x00\x01\x00\x1b\xa4\x03\
126964
+ \x00\x00\x03r\x00\x00\x00\x00\x00\x01\x00\x1b\xa43\
126962
126965
  \x00\x00\x01\x16\x00\x00\x00\x00\x00\x01\x00\x11a&\
126963
126966
  "
126964
126967
 
File without changes
File without changes
@@ -5,7 +5,7 @@
5
5
  # GitHub: https://github.com/szczyglis-dev/py-gpt #
6
6
  # MIT License #
7
7
  # Created By : Marcin Szczygliński #
8
- # Updated Date: 2025.08.14 01:00:00 #
8
+ # Updated Date: 2025.09.26 14:00:00 #
9
9
  # ================================================== #
10
10
 
11
11
  # >>> Based on LlamaIndex CodeActAgent implementation, with custom plugin tool support <<<
@@ -124,6 +124,9 @@ class CodeActAgent(BaseWorkflowAgent):
124
124
  _plugin_tool_fn: Union[Callable, Awaitable] = PrivateAttr(default=None)
125
125
  _on_stop: Optional[Callable] = PrivateAttr(default=None)
126
126
 
127
+ # Always emit this human-friendly agent name in workflow events for UI consumption.
128
+ _display_agent_name: str = PrivateAttr(default="CodeAct")
129
+
127
130
  def __init__(
128
131
  self,
129
132
  code_execute_fn: Union[Callable, Awaitable],
@@ -296,13 +299,13 @@ class CodeActAgent(BaseWorkflowAgent):
296
299
  StepEvent(name=name, index=index, total=total, meta=meta or {})
297
300
  )
298
301
  except Exception:
299
- # Fallback for older versions of AgentStream
302
+ # Fallback for environments lacking StepEvent wiring.
300
303
  try:
301
304
  ctx.write_event_to_stream(
302
305
  AgentStream(
303
306
  delta="",
304
307
  response="",
305
- current_agent_name="PlannerWorkflow",
308
+ current_agent_name=self._display_agent_name, # always "CodeAct"
306
309
  tool_calls=[],
307
310
  raw={"StepEvent": {"name": name, "index": index, "total": total, "meta": meta or {}}}
308
311
  )
@@ -367,7 +370,7 @@ class CodeActAgent(BaseWorkflowAgent):
367
370
  current_llm_input.insert(0, ChatMessage(role="system", content=system_prompt))
368
371
 
369
372
  ctx.write_event_to_stream(
370
- AgentInput(input=current_llm_input, current_agent_name=self.name)
373
+ AgentInput(input=current_llm_input, current_agent_name=self._display_agent_name) # always "CodeAct"
371
374
  )
372
375
 
373
376
  if any(tool.metadata.name == "handoff" for tool in tools):
@@ -400,7 +403,7 @@ class CodeActAgent(BaseWorkflowAgent):
400
403
  response=full_response_text,
401
404
  tool_calls=[],
402
405
  raw=raw,
403
- current_agent_name=self.name,
406
+ current_agent_name=self._display_agent_name, # always "CodeAct"
404
407
  )
405
408
  )
406
409
 
@@ -443,7 +446,7 @@ class CodeActAgent(BaseWorkflowAgent):
443
446
  response=message,
444
447
  tool_calls=tool_calls,
445
448
  raw=raw,
446
- current_agent_name=self.name,
449
+ current_agent_name=self._display_agent_name, # always "CodeAct"
447
450
  )
448
451
 
449
452
  async def handle_tool_call_results(
@@ -6,7 +6,7 @@
6
6
  # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
7
  # MIT License #
8
8
  # Created By : Marcin Szczygliński #
9
- # Updated Date: 2025.08.14 01:00:00 #
9
+ # Updated Date: 2025.09.26 15:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from __future__ import annotations
@@ -34,6 +34,7 @@ from llama_index.core.agent.workflow import (
34
34
  ToolCallResult,
35
35
  AgentStream,
36
36
  AgentOutput,
37
+ AgentInput, # ensure AgentInput propagation includes agent name
37
38
  )
38
39
 
39
40
  # v12/v13 compatibility imports
@@ -167,6 +168,9 @@ class OpenAIWorkflowAgent(Workflow):
167
168
  self._on_stop = on_stop
168
169
  self.verbose = verbose
169
170
 
171
+ # human-friendly display name propagated to UI via workflow events
172
+ self._display_agent_name: str = "FunctionAgent"
173
+
170
174
  # construct FunctionAgent once, will override tools/system_prompt/memory per run
171
175
  self._agent = FunctionAgent(
172
176
  name="OpenAIWorkflowAgent",
@@ -287,9 +291,13 @@ class OpenAIWorkflowAgent(Workflow):
287
291
  :param total: Total number of steps (optional)
288
292
  :param meta: Optional metadata dictionary for the step event
289
293
  """
294
+ # Always include agent_name so UI can set it before first token arrives.
295
+ m = dict(meta or {})
296
+ m.setdefault("agent_name", self._display_agent_name)
297
+
290
298
  try:
291
299
  if StepEvent is not None:
292
- ctx.write_event_to_stream(StepEvent(name=name, index=index, total=total, meta=meta or {}))
300
+ ctx.write_event_to_stream(StepEvent(name=name, index=index, total=total, meta=m))
293
301
  return
294
302
  except Exception:
295
303
  pass
@@ -300,9 +308,9 @@ class OpenAIWorkflowAgent(Workflow):
300
308
  AgentStream(
301
309
  delta="",
302
310
  response="",
303
- current_agent_name="OpenAIWorkflowAgent",
311
+ current_agent_name=self._display_agent_name,
304
312
  tool_calls=[],
305
- raw={"StepEvent": {"name": name, "index": index, "total": total, "meta": meta or {}}},
313
+ raw={"StepEvent": {"name": name, "index": index, "total": total, "meta": m}},
306
314
  )
307
315
  )
308
316
  except Exception:
@@ -499,14 +507,14 @@ class OpenAIWorkflowAgent(Workflow):
499
507
  self,
500
508
  ctx: Context,
501
509
  text: str,
502
- agent_name: str = "OpenAIWorkflowAgent"
510
+ agent_name: str = "FunctionAgent"
503
511
  ):
504
512
  """
505
513
  Emit text to the context stream, handling validation errors gracefully.
506
514
 
507
515
  :param ctx: Context for the workflow
508
516
  :param text: Text to emit to the stream
509
- :param agent_name: Name of the agent to set in the event (default: "OpenAIWorkflowAgent")
517
+ :param agent_name: Name of the agent to set in the event (default: "FunctionAgent")
510
518
  """
511
519
  try:
512
520
  ctx.write_event_to_stream(AgentStream(delta=text))
@@ -561,12 +569,31 @@ class OpenAIWorkflowAgent(Workflow):
561
569
  pass
562
570
  return last_answer
563
571
 
572
+ if isinstance(e, AgentInput):
573
+ # Ensure the input event also carries the display name for UI
574
+ try:
575
+ e.current_agent_name = self._display_agent_name
576
+ except Exception:
577
+ pass
578
+ ctx.write_event_to_stream(e)
579
+ continue
580
+
564
581
  if isinstance(e, AgentStream):
565
582
  if getattr(e, "delta", None):
566
583
  has_stream = True
567
- if not getattr(e, "current_agent_name", None):
584
+ # Always enforce agent name for consistency in UI
585
+ try:
586
+ e.current_agent_name = self._display_agent_name
587
+ except Exception:
588
+ # If immutable, rebuild a compatible event object
568
589
  try:
569
- e.current_agent_name = "OpenAIWorkflowAgent"
590
+ e = AgentStream(
591
+ delta=getattr(e, "delta", ""),
592
+ response=getattr(e, "response", ""),
593
+ current_agent_name=self._display_agent_name,
594
+ tool_calls=getattr(e, "tool_calls", []),
595
+ raw=getattr(e, "raw", {}),
596
+ )
570
597
  except Exception:
571
598
  pass
572
599
  ctx.write_event_to_stream(e)
@@ -581,9 +608,9 @@ class OpenAIWorkflowAgent(Workflow):
581
608
  AgentStream(
582
609
  delta=content,
583
610
  response=content,
584
- current_agent_name="OpenAIWorkflowAgent",
585
- tool_calls=e.tool_calls,
586
- raw=e.raw,
611
+ current_agent_name=self._display_agent_name,
612
+ tool_calls=getattr(e, "tool_calls", []),
613
+ raw=getattr(e, "raw", {}),
587
614
  )
588
615
  )
589
616
  continue