pygpt-net 2.5.7__py3-none-any.whl → 2.5.9__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 (42) hide show
  1. CHANGELOG.md +13 -1
  2. README.md +24 -68
  3. pygpt_net/CHANGELOG.txt +13 -1
  4. pygpt_net/__init__.py +3 -3
  5. pygpt_net/controller/chat/stream.py +6 -1
  6. pygpt_net/controller/chat/vision.py +2 -0
  7. pygpt_net/controller/lang/custom.py +3 -1
  8. pygpt_net/controller/notepad/__init__.py +6 -2
  9. pygpt_net/controller/presets/editor.py +8 -1
  10. pygpt_net/core/agents/legacy.py +2 -0
  11. pygpt_net/core/bridge/__init__.py +10 -2
  12. pygpt_net/core/ctx/__init__.py +4 -1
  13. pygpt_net/core/debug/presets.py +3 -1
  14. pygpt_net/core/events/control.py +2 -1
  15. pygpt_net/core/experts/__init__.py +3 -1
  16. pygpt_net/core/models/__init__.py +6 -1
  17. pygpt_net/core/modes/__init__.py +3 -1
  18. pygpt_net/core/presets/__init__.py +5 -1
  19. pygpt_net/core/render/web/helpers.py +12 -7
  20. pygpt_net/core/render/web/parser.py +7 -5
  21. pygpt_net/core/tokens/__init__.py +4 -2
  22. pygpt_net/core/types/mode.py +3 -2
  23. pygpt_net/data/config/config.json +5 -3
  24. pygpt_net/data/config/models.json +424 -3
  25. pygpt_net/data/config/modes.json +9 -3
  26. pygpt_net/data/config/presets/current.research.json +35 -0
  27. pygpt_net/data/config/settings.json +19 -0
  28. pygpt_net/data/locale/locale.en.ini +6 -0
  29. pygpt_net/item/preset.py +5 -1
  30. pygpt_net/plugin/openai_dalle/__init__.py +3 -1
  31. pygpt_net/plugin/openai_vision/__init__.py +3 -1
  32. pygpt_net/provider/core/config/patch.py +10 -1
  33. pygpt_net/provider/core/model/patch.py +7 -1
  34. pygpt_net/provider/core/preset/json_file.py +4 -0
  35. pygpt_net/provider/gpt/__init__.py +30 -6
  36. pygpt_net/provider/gpt/chat.py +3 -6
  37. pygpt_net/ui/dialog/preset.py +3 -1
  38. {pygpt_net-2.5.7.dist-info → pygpt_net-2.5.9.dist-info}/METADATA +25 -69
  39. {pygpt_net-2.5.7.dist-info → pygpt_net-2.5.9.dist-info}/RECORD +42 -41
  40. {pygpt_net-2.5.7.dist-info → pygpt_net-2.5.9.dist-info}/LICENSE +0 -0
  41. {pygpt_net-2.5.7.dist-info → pygpt_net-2.5.9.dist-info}/WHEEL +0 -0
  42. {pygpt_net-2.5.7.dist-info → pygpt_net-2.5.9.dist-info}/entry_points.txt +0 -0
CHANGELOG.md CHANGED
@@ -1,8 +1,20 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 2.5.9 (2025-03-05)
4
+
5
+ - Improved formatting of HTML code in the output.
6
+ - Disabled automatic indentation parsing as code blocks.
7
+ - Disabled automatic scrolling of the notepad when opening a tab.
8
+
9
+ ## 2.5.8 (2025-03-02)
10
+
11
+ - Added a new mode: Research (Perplexity) powered by: https://perplexity.ai - beta.
12
+ - Added Perplexity models: sonar, sonar-pro, sonar-deep-research, sonar-reasoning, sonar-reasoning-pro, r1-1776.
13
+ - Added a new OpenAI model: gpt-4.5-preview.
14
+
3
15
  ## 2.5.7 (2025-02-26)
4
16
 
5
- - Steam mode has been enabled in o1 models.
17
+ - Stream mode has been enabled in o1 models.
6
18
  - CSS styling for <think> tags (reasoning models) has been added.
7
19
  - The search input has been moved to the top.
8
20
  - The ChatGPT-based style is now set as default.
README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![pygpt](https://snapcraft.io/pygpt/badge.svg)](https://snapcraft.io/pygpt)
4
4
 
5
- Release: **2.5.7** | build: **2025.02.26** | Python: **>=3.10, <3.13**
5
+ Release: **2.5.9** | build: **2025.03.05** | Python: **>=3.10, <3.13**
6
6
 
7
7
  > Official website: https://pygpt.net | Documentation: https://pygpt.readthedocs.io
8
8
  >
@@ -38,7 +38,7 @@ You can download compiled 64-bit versions for Windows and Linux here: https://py
38
38
 
39
39
  - Desktop AI Assistant for `Linux`, `Windows` and `Mac`, written in Python.
40
40
  - Works similarly to `ChatGPT`, but locally (on a desktop computer).
41
- - 11 modes of operation: Chat, Vision, Completion, Assistant, Image generation, LangChain, Chat with Files, Chat with Audio, Experts, Autonomous Mode and Agents.
41
+ - 12 modes of operation: Chat, Vision, Completion, Assistant, Image generation, LangChain, Chat with Files, Chat with Audio, Research (Perplexity), Experts, Autonomous Mode and Agents.
42
42
  - Supports multiple models: `o1`, `GPT-4o`, `GPT-4`, `GPT-3.5`, and any model accessible through `LangChain`, `LlamaIndex` and `Ollama` such as `Llama 3`, `Mistral`, `Google Gemini`, `Anthropic Claude`, `DeepSeek V3/R1`, `Bielik`, etc.
43
43
  - Chat with your own Files: integrated `LlamaIndex` support: chat with data such as: `txt`, `pdf`, `csv`, `html`, `md`, `docx`, `json`, `epub`, `xlsx`, `xml`, webpages, `Google`, `GitHub`, video/audio, images and other data types, or use conversation history as additional context provided to the model.
44
44
  - Built-in vector databases support and automated files and data embedding.
@@ -398,7 +398,15 @@ More info: https://platform.openai.com/docs/guides/audio/quickstart
398
398
 
399
399
  Currently, in beta. Tool and function calls are not enabled in this mode.
400
400
 
401
- **INFO:** The execution of commands and tools in this mode is temporarily unavailable.
401
+ ## Research (Perplexity)
402
+
403
+ 2025-03-02: currently in beta.
404
+
405
+ Mode operates using the Perplexity API: https://perplexity.ai.
406
+
407
+ It allows for deep web searching and utilizes Sonar models, available in `Perplexity AI`.
408
+
409
+ It requires a Perplexity API key, which can be generated at: https://perplexity.ai.
402
410
 
403
411
  ## Completion
404
412
 
@@ -3964,9 +3972,21 @@ may consume additional tokens that are not displayed in the main window.
3964
3972
 
3965
3973
  ## Recent changes:
3966
3974
 
3975
+ **2.5.9 (2025-03-05)**
3976
+
3977
+ - Improved formatting of HTML code in the output.
3978
+ - Disabled automatic indentation parsing as code blocks.
3979
+ - Disabled automatic scrolling of the notepad when opening a tab.
3980
+
3981
+ **2.5.8 (2025-03-02)**
3982
+
3983
+ - Added a new mode: Research (Perplexity) powered by: https://perplexity.ai - beta.
3984
+ - Added Perplexity models: sonar, sonar-pro, sonar-deep-research, sonar-reasoning, sonar-reasoning-pro, r1-1776.
3985
+ - Added a new OpenAI model: gpt-4.5-preview.
3986
+
3967
3987
  **2.5.7 (2025-02-26)**
3968
3988
 
3969
- - Steam mode has been enabled in o1 models.
3989
+ - Stream mode has been enabled in o1 models.
3970
3990
  - CSS styling for <think> tags (reasoning models) has been added.
3971
3991
  - The search input has been moved to the top.
3972
3992
  - The ChatGPT-based style is now set as default.
@@ -4015,70 +4035,6 @@ may consume additional tokens that are not displayed in the main window.
4015
4035
  - Fix: error handling in stream mode.
4016
4036
  - Fix: added check for active plugin tools before tool call.
4017
4037
 
4018
- **2.4.57 (2025-01-19)**
4019
-
4020
- - Logging fix.
4021
-
4022
- **2.4.56 (2025-01-19)**
4023
-
4024
- - Improved tab switching and focus change.
4025
- - Improved global keyboard shortcuts handling.
4026
-
4027
- **2.4.55 (2025-01-18)**
4028
-
4029
- - Added a new option in settings: Audio -> Recording timeout.
4030
- - Added a new option in settings: Audio -> Enable timeout in continuous mode.
4031
-
4032
- **2.4.54 (2025-01-18)**
4033
-
4034
- - Audio output switched from PyGame to PyAudio. It may be necessary to manually connect Alsa in Snap version with: "sudo snap connect pygpt:alsa".
4035
- - Added audio output volume progress bar.
4036
-
4037
- **2.4.53 (2025-01-17)**
4038
-
4039
- - Fix: issue #89
4040
-
4041
- **2.4.52 (2025-01-17)**
4042
-
4043
- - Improved audio input button visibility toggle.
4044
- - Fix: check for required arguments - issue #88.
4045
- - UI Fixes.
4046
-
4047
- **2.4.51 (2025-01-17)**
4048
-
4049
- - Added a "Continuous recording" mode under Audio Input in the Notepad tab, allowing for recording long voice notes and real-time auto-transcription. (beta)
4050
- - A new option has been added in Settings -> Audio -> Continuous recording auto-transcribe interval.
4051
-
4052
- **2.4.50 (2025-01-16)**
4053
-
4054
- - Refactored audio input core.
4055
- - Added audio input volume progress bar.
4056
-
4057
- **2.4.49 (2025-01-16)**
4058
-
4059
- - Fix: stream render in Assistants mode.
4060
- - Fix: items remove in context regen/edit.
4061
-
4062
- **2.4.48 (2025-01-16)**
4063
-
4064
- - Fix: parsing lists in data loaders configuration.
4065
- - Fix: crash on Windows on PySide6 v6.6.0.
4066
- - Added Gemini embeddings to LlamaIndex settings.
4067
- - LlamaIndex upgraded to 0.12.11.
4068
- - Security updates.
4069
-
4070
- **2.4.47 (2025-01-14)**
4071
-
4072
- - Added support for Python 3.12.
4073
- - Added a new model to Chat with Files: gemini-2.0-flash-exp.
4074
- - PySide6 upgraded to 6.6.0.
4075
-
4076
- **2.4.46 (2024-12-16)**
4077
-
4078
- - Added a new tab in Settings: "API Keys", where the API keys configuration for Google and Anthropic models has been relocated.
4079
- - Introduced a new mode in "Chat with Files": "Retrieve Only", which allows for retrieving raw documents from the index.
4080
- - Fixed a bug related to tool calls in the Gemini provider when using Chat with Files mode.
4081
-
4082
4038
  # Credits and links
4083
4039
 
4084
4040
  **Official website:** <https://pygpt.net>
pygpt_net/CHANGELOG.txt CHANGED
@@ -1,6 +1,18 @@
1
+ 2.5.9 (2025-03-05)
2
+
3
+ - Improved formatting of HTML code in the output.
4
+ - Disabled automatic indentation parsing as code blocks.
5
+ - Disabled automatic scrolling of the notepad when opening a tab.
6
+
7
+ 2.5.8 (2025-03-02)
8
+
9
+ - Added a new mode: Research (Perplexity) powered by: https://perplexity.ai - beta.
10
+ - Added Perplexity models: sonar, sonar-pro, sonar-deep-research, sonar-reasoning, sonar-reasoning-pro, r1-1776.
11
+ - Added a new OpenAI model: gpt-4.5-preview.
12
+
1
13
  2.5.7 (2025-02-26)
2
14
 
3
- - Steam mode has been enabled in o1 models.
15
+ - Stream mode has been enabled in o1 models.
4
16
  - CSS styling for <think> tags (reasoning models) has been added.
5
17
  - The search input has been moved to the top.
6
18
  - The ChatGPT-based style is now set as default.
pygpt_net/__init__.py CHANGED
@@ -6,15 +6,15 @@
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.02.26 23:00:00 #
9
+ # Updated Date: 2025.03.05 23:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  __author__ = "Marcin Szczygliński"
13
13
  __copyright__ = "Copyright 2025, Marcin Szczygliński"
14
14
  __credits__ = ["Marcin Szczygliński"]
15
15
  __license__ = "MIT"
16
- __version__ = "2.5.7"
17
- __build__ = "2025.02.26"
16
+ __version__ = "2.5.9"
17
+ __build__ = "2025-03-05"
18
18
  __maintainer__ = "Marcin Szczygliński"
19
19
  __github__ = "https://github.com/szczyglis-dev/py-gpt"
20
20
  __report__ = "https://github.com/szczyglis-dev/py-gpt/issues"
@@ -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.01.31 22:00:00 #
9
+ # Updated Date: 2025.03.02 19:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from typing import Any
@@ -81,7 +81,12 @@ class Stream:
81
81
 
82
82
  # OpenAI chat completion
83
83
  if chunk_type == "api_chat":
84
+ citations = None
84
85
  if chunk.choices[0].delta and chunk.choices[0].delta.content is not None:
86
+ if citations is None:
87
+ if chunk and hasattr(chunk, 'citations') and chunk.citations is not None:
88
+ citations = chunk.citations
89
+ ctx.urls = citations
85
90
  response = chunk.choices[0].delta.content
86
91
  if chunk.choices[0].delta and chunk.choices[0].delta.tool_calls:
87
92
  tool_chunks = chunk.choices[0].delta.tool_calls
@@ -17,6 +17,7 @@ from pygpt_net.core.types import (
17
17
  MODE_LANGCHAIN,
18
18
  MODE_LLAMA_INDEX,
19
19
  MODE_VISION,
20
+ MODE_RESEARCH,
20
21
  )
21
22
 
22
23
  class Vision:
@@ -36,6 +37,7 @@ class Vision:
36
37
  MODE_LLAMA_INDEX,
37
38
  MODE_AGENT,
38
39
  MODE_AGENT_LLAMA,
40
+ MODE_RESEARCH,
39
41
  ]
40
42
 
41
43
  def setup(self):
@@ -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.01.17 02:00:00 #
9
+ # Updated Date: 2025.03.02 19:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from PySide6.QtCore import Qt
@@ -22,6 +22,7 @@ from pygpt_net.core.types import (
22
22
  MODE_LANGCHAIN,
23
23
  MODE_LLAMA_INDEX,
24
24
  MODE_VISION,
25
+ MODE_RESEARCH,
25
26
  )
26
27
  from pygpt_net.utils import trans
27
28
 
@@ -61,6 +62,7 @@ class Custom:
61
62
  self.window.ui.config['preset'][MODE_AGENT_LLAMA].box.setText(trans("preset.agent_llama"))
62
63
  self.window.ui.config['preset'][MODE_EXPERT].box.setText(trans("preset.expert"))
63
64
  self.window.ui.config['preset'][MODE_AUDIO].box.setText(trans("preset.audio"))
65
+ self.window.ui.config['preset'][MODE_RESEARCH].box.setText(trans("preset.research"))
64
66
 
65
67
  self.window.ui.config['global']['img_raw'].setText(trans("img.raw"))
66
68
 
@@ -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.02.26 23:00:00 #
9
+ # Updated Date: 2025.03.05 23:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from typing import Optional, Tuple
@@ -31,6 +31,7 @@ class Notepad:
31
31
  """
32
32
  self.window = window
33
33
  self.opened_once = False
34
+ self.opened_idx = []
34
35
 
35
36
  def create(
36
37
  self,
@@ -283,6 +284,9 @@ class Notepad:
283
284
  if tab.type == Tab.TAB_NOTEPAD:
284
285
  idx = tab.data_id
285
286
  if idx in self.window.ui.notepad:
286
- self.window.ui.notepad[idx].scroll_to_bottom()
287
+ if idx not in self.opened_idx:
288
+ self.window.ui.notepad[idx].scroll_to_bottom()
287
289
  if not self.window.ui.notepad[idx].opened:
288
290
  self.window.ui.notepad[idx].opened = True
291
+ if idx not in self.opened_idx:
292
+ self.opened_idx.append(idx)
@@ -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: 2024.12.14 08:00:00 #
9
+ # Updated Date: 2025.03.02 19:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  import datetime
@@ -25,6 +25,7 @@ from pygpt_net.core.types import (
25
25
  MODE_LLAMA_INDEX,
26
26
  MODE_VISION,
27
27
  MODE_IMAGE,
28
+ MODE_RESEARCH,
28
29
  )
29
30
  from pygpt_net.item.preset import PresetItem
30
31
  from pygpt_net.utils import trans
@@ -93,6 +94,10 @@ class Editor:
93
94
  "type": "bool",
94
95
  "label": "preset.audio",
95
96
  },
97
+ MODE_RESEARCH: {
98
+ "type": "bool",
99
+ "label": "preset.research",
100
+ },
96
101
  # "assistant": {
97
102
  # "type": "bool",
98
103
  # "label": "preset.assistant",
@@ -302,6 +307,8 @@ class Editor:
302
307
  data.agent_llama = True
303
308
  elif mode == MODE_AUDIO:
304
309
  data.audio = True
310
+ elif mode == MODE_RESEARCH:
311
+ data.research = True
305
312
 
306
313
  options = {}
307
314
  data_dict = data.to_dict()
@@ -18,6 +18,7 @@ from pygpt_net.core.types import (
18
18
  MODE_LLAMA_INDEX,
19
19
  MODE_VISION,
20
20
  MODE_AUDIO,
21
+ MODE_RESEARCH,
21
22
  )
22
23
 
23
24
  class Legacy:
@@ -35,6 +36,7 @@ class Legacy:
35
36
  MODE_LANGCHAIN,
36
37
  MODE_LLAMA_INDEX,
37
38
  MODE_AUDIO,
39
+ MODE_RESEARCH,
38
40
  ]
39
41
 
40
42
  def get_allowed_modes(self) -> List[str]:
@@ -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: 2024.12.14 08:00:00 #
9
+ # Updated Date: 2025.03.02 19:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  import time
@@ -21,6 +21,7 @@ from pygpt_net.core.types import (
21
21
  MODE_LANGCHAIN,
22
22
  MODE_LLAMA_INDEX,
23
23
  MODE_VISION,
24
+ MODE_RESEARCH,
24
25
  )
25
26
 
26
27
  from .context import BridgeContext
@@ -195,7 +196,7 @@ class Bridge:
195
196
 
196
197
  if context.model is not None:
197
198
  # check if model is supported by chat API, if not then try to use llama-index or langchain call
198
- if not context.model.is_supported(MODE_CHAT):
199
+ if not context.model.is_supported(MODE_CHAT) and not context.model.is_supported(MODE_RESEARCH):
199
200
 
200
201
  # tmp switch to: llama-index
201
202
  if context.model.is_supported(MODE_LLAMA_INDEX):
@@ -231,6 +232,13 @@ class Bridge:
231
232
  self.window.core.debug.error(e)
232
233
  return ""
233
234
 
235
+ # if model is research model, then switch to research / Perplexity endpoint
236
+ if context.mode is None or context.mode == MODE_CHAT:
237
+ if context.model is not None:
238
+ if not context.model.is_supported(MODE_CHAT):
239
+ if context.model.is_supported(MODE_RESEARCH):
240
+ context.mode = MODE_RESEARCH
241
+
234
242
  # default: OpenAI API call
235
243
  return self.window.core.gpt.quick_call(
236
244
  context=context,
@@ -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: 2024.12.14 08:00:00 #
9
+ # Updated Date: 2025.03.02 19:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  import copy
@@ -28,6 +28,7 @@ from pygpt_net.core.types import (
28
28
  MODE_LANGCHAIN,
29
29
  MODE_LLAMA_INDEX,
30
30
  MODE_VISION,
31
+ MODE_RESEARCH,
31
32
  )
32
33
  from pygpt_net.item.ctx import CtxItem, CtxMeta, CtxGroup
33
34
  from pygpt_net.provider.core.ctx.base import BaseProvider
@@ -81,6 +82,7 @@ class Ctx:
81
82
  MODE_AGENT,
82
83
  MODE_EXPERT,
83
84
  MODE_AUDIO,
85
+ MODE_RESEARCH,
84
86
  ]
85
87
  self.allowed_modes = {
86
88
  MODE_CHAT: self.all_modes,
@@ -94,6 +96,7 @@ class Ctx:
94
96
  MODE_EXPERT: self.all_modes,
95
97
  MODE_AUDIO: self.all_modes,
96
98
  MODE_AGENT_LLAMA: [MODE_AGENT_LLAMA],
99
+ MODE_RESEARCH: self.all_modes,
97
100
  }
98
101
  self.current_sys_prompt = ""
99
102
  self.groups_loaded = False
@@ -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: 2024.11.26 19:00:00 #
9
+ # Updated Date: 2025.03.02 19:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  import os
@@ -23,6 +23,7 @@ from pygpt_net.core.types import (
23
23
  MODE_LANGCHAIN,
24
24
  MODE_LLAMA_INDEX,
25
25
  MODE_VISION,
26
+ MODE_RESEARCH,
26
27
  )
27
28
 
28
29
  class PresetsDebug:
@@ -66,6 +67,7 @@ class PresetsDebug:
66
67
  MODE_AGENT_LLAMA: preset.agent_llama,
67
68
  MODE_EXPERT: preset.expert,
68
69
  MODE_AUDIO: preset.audio,
70
+ MODE_RESEARCH: preset.research,
69
71
  'temperature': preset.temperature,
70
72
  'version': preset.version,
71
73
  }
@@ -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: 2024.12.14 08:00:00 #
9
+ # Updated Date: 2025.03.02 19:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from typing import Optional
@@ -48,6 +48,7 @@ class ControlEvent(BaseEvent):
48
48
  INPUT_SEND = "input.send"
49
49
  INPUT_APPEND = "input.append"
50
50
  MODE_CHAT = "mode.chat"
51
+ MODE_RESEARCH = "mode.research"
51
52
  MODE_LLAMA_INDEX = "mode.llama_index"
52
53
  MODE_NEXT = "mode.next"
53
54
  MODE_PREV = "mode.prev"
@@ -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: 2024.12.14 08:00:00 #
9
+ # Updated Date: 2025.03.02 19:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from typing import Dict, List
@@ -20,6 +20,7 @@ from pygpt_net.core.types import (
20
20
  MODE_LLAMA_INDEX,
21
21
  MODE_VISION,
22
22
  MODE_AUDIO,
23
+ MODE_RESEARCH,
23
24
  )
24
25
  from pygpt_net.core.bridge.context import BridgeContext
25
26
  from pygpt_net.core.events import Event, KernelEvent, RenderEvent
@@ -42,6 +43,7 @@ class Experts:
42
43
  MODE_LANGCHAIN,
43
44
  MODE_LLAMA_INDEX,
44
45
  MODE_AUDIO,
46
+ MODE_RESEARCH,
45
47
  ]
46
48
  self.allowed_cmds = ["expert_call"]
47
49
 
@@ -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.02.01 11:00:00 #
9
+ # Updated Date: 2025.03.02 19:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  import copy
@@ -18,6 +18,7 @@ from pygpt_net.core.types import (
18
18
  MODE_CHAT,
19
19
  MODE_LANGCHAIN,
20
20
  MODE_LLAMA_INDEX,
21
+ MODE_RESEARCH,
21
22
  )
22
23
  from pygpt_net.item.model import ModelItem
23
24
  from pygpt_net.provider.core.model.json_file import JsonFileProvider
@@ -385,6 +386,10 @@ class Models:
385
386
  self.window.core.debug.info(
386
387
  "WARNING: Switching to chat mode (model not supported in: {})".format(mode))
387
388
  mode = MODE_CHAT
389
+ elif model.is_supported(MODE_RESEARCH):
390
+ self.window.core.debug.info(
391
+ "WARNING: Switching to research mode (model not supported in: {})".format(mode))
392
+ mode = MODE_RESEARCH
388
393
  elif model.is_supported(MODE_LLAMA_INDEX):
389
394
  self.window.core.debug.info(
390
395
  "WARNING: Switching to llama_index mode (model not supported in: {})".format(mode))
@@ -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: 2024.12.14 22:00:00 #
9
+ # Updated Date: 2025.03.02 19:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from typing import Dict, List
@@ -24,6 +24,7 @@ from pygpt_net.core.types import (
24
24
  MODE_LANGCHAIN,
25
25
  MODE_LLAMA_INDEX,
26
26
  MODE_VISION,
27
+ MODE_RESEARCH,
27
28
  )
28
29
 
29
30
 
@@ -50,6 +51,7 @@ class Modes:
50
51
  MODE_LANGCHAIN,
51
52
  MODE_LLAMA_INDEX,
52
53
  MODE_VISION,
54
+ MODE_RESEARCH,
53
55
  ]
54
56
  self.items = {}
55
57
 
@@ -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: 2024.12.14 22:00:00 #
9
+ # Updated Date: 2025.03.02 19:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  import copy
@@ -26,6 +26,7 @@ from pygpt_net.core.types import (
26
26
  MODE_LANGCHAIN,
27
27
  MODE_LLAMA_INDEX,
28
28
  MODE_VISION,
29
+ MODE_RESEARCH,
29
30
  )
30
31
  from pygpt_net.item.preset import PresetItem
31
32
  from pygpt_net.provider.core.preset.json_file import JsonFileProvider
@@ -233,6 +234,8 @@ class Presets:
233
234
  return MODE_EXPERT
234
235
  if preset.audio:
235
236
  return MODE_AUDIO
237
+ if preset.research:
238
+ return MODE_RESEARCH
236
239
  return None
237
240
 
238
241
  def has(self, mode: str, id: str) -> bool:
@@ -303,6 +306,7 @@ class Presets:
303
306
  or (mode == MODE_AGENT and self.items[id].agent) \
304
307
  or (mode == MODE_AGENT_LLAMA and self.items[id].agent_llama) \
305
308
  or (mode == MODE_EXPERT and self.items[id].expert) \
309
+ or (mode == MODE_RESEARCH and self.items[id].research) \
306
310
  or (mode == MODE_AUDIO and self.items[id].audio):
307
311
  presets[id] = self.items[id]
308
312
  return presets
@@ -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.02.26 23:00:00 #
9
+ # Updated Date: 2025.03.05 23:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  import re
@@ -33,6 +33,9 @@ class Helpers:
33
33
  pattern = r"~###~(.*?)~###~"
34
34
  def repl(match):
35
35
  code = match.group(1)
36
+ # restore tags first
37
+ code = code.replace("&lt;", "<")
38
+ code = code.replace("&gt;", ">")
36
39
  escaped_code = html.escape(code)
37
40
  return f'<p class="cmd">{escaped_code}</p>'
38
41
  return re.sub(pattern, repl, text, flags=re.DOTALL)
@@ -48,12 +51,14 @@ class Helpers:
48
51
  text = text.replace("#~###~", "~###~") # fix for #~###~ in text (previous versions)
49
52
  text = text.replace("# ~###~", "~###~") # fix for # ~###~ in text (previous versions)
50
53
 
51
- #text = text.replace("<think>", "{{{{think}}}}")
52
- #text = text.replace("</think>", "{{{{/think}}}}")
53
- #text = text.replace("<", "&lt;")
54
- #text = text.replace(">", "&gt;")
55
- #text = text.replace("{{{{think}}}}", "<think>")
56
- #text = text.replace("{{{{/think}}}}", "</think>")
54
+ # replace HTML tags
55
+ text = text.replace("<think>", "{{{{think}}}}")
56
+ text = text.replace("</think>", "{{{{/think}}}}")
57
+ text = text.replace("<", "&lt;")
58
+ text = text.replace(">", "&gt;")
59
+ text = text.replace("{{{{think}}}}", "<think>")
60
+ text = text.replace("{{{{/think}}}}", "</think>")
61
+ text = text.replace("<think>\n", "<think>")
57
62
 
58
63
  # replace cmd tags
59
64
  text = self.replace_code_tags(text)
@@ -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: 2024.11.21 22:00:00 #
9
+ # Updated Date: 2025.03.05 23:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  import os
@@ -32,9 +32,7 @@ class Parser:
32
32
  self.block_idx = 1
33
33
 
34
34
  def init(self):
35
- """
36
- Initialize markdown parser
37
- """
35
+ """Initialize markdown parser"""
38
36
  if self.md is None:
39
37
  self.md = markdown.Markdown(extensions=[
40
38
  'fenced_code',
@@ -42,6 +40,9 @@ class Parser:
42
40
  'sane_lists',
43
41
  MathExtension(enable_dollar_delimiter=True) # math formulas
44
42
  ])
43
+ # disable code blocks parsing (without ` and ```)
44
+ if 'code' in self.md.parser.blockprocessors:
45
+ self.md.parser.blockprocessors.deregister('code')
45
46
 
46
47
  def reset(self):
47
48
  """
@@ -78,7 +79,8 @@ class Parser:
78
79
  self.init()
79
80
  try:
80
81
  text = self.prepare_paths(text.strip())
81
- soup = BeautifulSoup(self.md.convert(text), 'html.parser')
82
+ html = self.md.convert(text)
83
+ soup = BeautifulSoup(html, 'html.parser')
82
84
  self.strip_whitespace_lists(soup) # strip whitespace from codeblocks
83
85
  # if self.window.core.config.get("ctx.convert_lists"):
84
86
  # self.convert_lists_to_paragraphs(soup) # convert lists to paragraphs, DISABLED: 2024-11-03