pygpt-net 2.6.43__py3-none-any.whl → 2.6.45__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.
- pygpt_net/CHANGELOG.txt +13 -0
- pygpt_net/__init__.py +3 -3
- pygpt_net/app.py +1 -1
- pygpt_net/controller/ctx/ctx.py +6 -0
- pygpt_net/controller/debug/debug.py +7 -19
- pygpt_net/controller/debug/fixtures.py +103 -0
- pygpt_net/core/debug/console/console.py +2 -1
- pygpt_net/core/debug/debug.py +1 -1
- pygpt_net/core/fixtures/stream/__init__.py +0 -0
- pygpt_net/{provider/api/fake → core/fixtures/stream}/generator.py +2 -3
- pygpt_net/core/render/web/body.py +294 -23
- pygpt_net/core/render/web/helpers.py +26 -0
- pygpt_net/core/render/web/renderer.py +457 -704
- pygpt_net/data/config/config.json +10 -6
- pygpt_net/data/config/models.json +3 -3
- pygpt_net/data/config/settings.json +59 -19
- pygpt_net/data/fixtures/fake_stream.txt +5733 -0
- pygpt_net/data/js/app.js +2617 -1315
- pygpt_net/data/locale/locale.en.ini +12 -5
- pygpt_net/js_rc.py +14272 -10602
- pygpt_net/provider/api/openai/__init__.py +4 -12
- pygpt_net/provider/core/config/patch.py +14 -1
- pygpt_net/ui/base/context_menu.py +3 -2
- pygpt_net/ui/layout/chat/output.py +1 -1
- pygpt_net/ui/layout/ctx/ctx_list.py +3 -3
- pygpt_net/ui/menu/debug.py +36 -23
- pygpt_net/ui/widget/lists/context.py +233 -51
- pygpt_net/ui/widget/textarea/web.py +4 -4
- pygpt_net/utils.py +3 -2
- {pygpt_net-2.6.43.dist-info → pygpt_net-2.6.45.dist-info}/METADATA +72 -14
- {pygpt_net-2.6.43.dist-info → pygpt_net-2.6.45.dist-info}/RECORD +35 -32
- /pygpt_net/{provider/api/fake/__init__.py → core/fixtures/__init__} +0 -0
- {pygpt_net-2.6.43.dist-info → pygpt_net-2.6.45.dist-info}/LICENSE +0 -0
- {pygpt_net-2.6.43.dist-info → pygpt_net-2.6.45.dist-info}/WHEEL +0 -0
- {pygpt_net-2.6.43.dist-info → pygpt_net-2.6.45.dist-info}/entry_points.txt +0 -0
pygpt_net/CHANGELOG.txt
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
2.6.45 (2025-09-13)
|
|
2
|
+
|
|
3
|
+
- Improved: Parsing of custom markup in the stream.
|
|
4
|
+
- Improved: Message block parsing moved to JavaScript.
|
|
5
|
+
|
|
6
|
+
2.6.44 (2025-09-12)
|
|
7
|
+
|
|
8
|
+
- Added: Auto-collapse for large user input blocks.
|
|
9
|
+
- Added: Configuration for syntax highlighting intervals.
|
|
10
|
+
- Improved: Visibility of label icons.
|
|
11
|
+
- Improved: Scrolling of code blocks.
|
|
12
|
+
- Fixed: Parsing of quotes in custom markdown blocks.
|
|
13
|
+
|
|
1
14
|
2.6.43 (2025-09-12)
|
|
2
15
|
|
|
3
16
|
- Fixed: preset restoration when switching profiles.
|
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.09.
|
|
9
|
+
# Updated Date: 2025.09.13 00: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.6.
|
|
17
|
-
__build__ = "2025-09-
|
|
16
|
+
__version__ = "2.6.45"
|
|
17
|
+
__build__ = "2025-09-13"
|
|
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"
|
pygpt_net/app.py
CHANGED
|
@@ -38,7 +38,7 @@ os.environ["QTWEBENGINE_CHROMIUM_FLAGS"] = (
|
|
|
38
38
|
# by default, optimize for low-end devices
|
|
39
39
|
os.environ.setdefault(
|
|
40
40
|
"QTWEBENGINE_CHROMIUM_FLAGS",
|
|
41
|
-
"--
|
|
41
|
+
"--enable-low-end-device-mode"
|
|
42
42
|
)
|
|
43
43
|
|
|
44
44
|
_original_open = builtins.open
|
pygpt_net/controller/ctx/ctx.py
CHANGED
|
@@ -1284,6 +1284,12 @@ class Ctx:
|
|
|
1284
1284
|
"""Clear selected list"""
|
|
1285
1285
|
self.selected.clear()
|
|
1286
1286
|
|
|
1287
|
+
def fresh_current_output(self):
|
|
1288
|
+
"""Fresh output for current context"""
|
|
1289
|
+
meta = self.window.core.ctx.get_meta_by_id(self.window.core.ctx.get_current())
|
|
1290
|
+
if meta is not None:
|
|
1291
|
+
self.fresh_output(meta)
|
|
1292
|
+
|
|
1287
1293
|
def fresh_output(self, meta: CtxMeta):
|
|
1288
1294
|
"""
|
|
1289
1295
|
Fresh output for new 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: 2025.09.
|
|
9
|
+
# Updated Date: 2025.09.12 20:00:00 #
|
|
10
10
|
# ================================================== #
|
|
11
11
|
|
|
12
12
|
from datetime import datetime
|
|
@@ -18,6 +18,8 @@ from PySide6.QtGui import QTextCursor
|
|
|
18
18
|
|
|
19
19
|
from pygpt_net.core.events import RenderEvent
|
|
20
20
|
|
|
21
|
+
from .fixtures import Fixtures
|
|
22
|
+
|
|
21
23
|
|
|
22
24
|
class Debug(QObject):
|
|
23
25
|
def __init__(self, window=None):
|
|
@@ -28,6 +30,7 @@ class Debug(QObject):
|
|
|
28
30
|
"""
|
|
29
31
|
super(Debug, self).__init__()
|
|
30
32
|
self.window = window
|
|
33
|
+
self.fixtures = Fixtures(window)
|
|
31
34
|
self.is_logger = False # logger window opened
|
|
32
35
|
self.is_app_log = False # app log window opened
|
|
33
36
|
self.is_fake_stream = False # fake stream enabled
|
|
@@ -37,6 +40,7 @@ class Debug(QObject):
|
|
|
37
40
|
def update(self):
|
|
38
41
|
"""Update debug"""
|
|
39
42
|
self.update_menu()
|
|
43
|
+
self.fixtures.update()
|
|
40
44
|
|
|
41
45
|
def update_menu(self):
|
|
42
46
|
"""Update debug menu"""
|
|
@@ -127,6 +131,8 @@ class Debug(QObject):
|
|
|
127
131
|
print("[LOGGER] Switching to: " + level)
|
|
128
132
|
self.set_log_level(level)
|
|
129
133
|
|
|
134
|
+
self.fixtures.setup()
|
|
135
|
+
|
|
130
136
|
def connect_signals(self):
|
|
131
137
|
"""Connect signals"""
|
|
132
138
|
# webengine debug signals
|
|
@@ -189,14 +195,6 @@ class Debug(QObject):
|
|
|
189
195
|
cur.insertText("\n")
|
|
190
196
|
self.window.logger.setTextCursor(cur) # Update visible cursor
|
|
191
197
|
|
|
192
|
-
def fake_stream_enabled(self) -> bool:
|
|
193
|
-
"""
|
|
194
|
-
Check if fake stream is enabled
|
|
195
|
-
|
|
196
|
-
:return: True if enabled, False otherwise
|
|
197
|
-
"""
|
|
198
|
-
return self.is_fake_stream
|
|
199
|
-
|
|
200
198
|
def logger_enabled(self) -> bool:
|
|
201
199
|
"""
|
|
202
200
|
Check if debug window is enabled
|
|
@@ -252,16 +250,6 @@ class Debug(QObject):
|
|
|
252
250
|
# update menu
|
|
253
251
|
self.update()
|
|
254
252
|
|
|
255
|
-
def toggle_fake_stream(self):
|
|
256
|
-
"""
|
|
257
|
-
Toggle fake stream debug
|
|
258
|
-
"""
|
|
259
|
-
value = self.window.ui.menu['debug.fake_stream'].isChecked()
|
|
260
|
-
self.is_fake_stream = value
|
|
261
|
-
self.log(f"debug.fake_stream set to {value}")
|
|
262
|
-
# update menu
|
|
263
|
-
self.update()
|
|
264
|
-
|
|
265
253
|
def on_close(self, id: str):
|
|
266
254
|
"""
|
|
267
255
|
Handle debug window close event
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
# ================================================== #
|
|
4
|
+
# This file is a part of PYGPT package #
|
|
5
|
+
# Website: https://pygpt.net #
|
|
6
|
+
# GitHub: https://github.com/szczyglis-dev/py-gpt #
|
|
7
|
+
# MIT License #
|
|
8
|
+
# Created By : Marcin Szczygliński #
|
|
9
|
+
# Updated Date: 2025.09.12 20:00:00 #
|
|
10
|
+
# ================================================== #
|
|
11
|
+
|
|
12
|
+
import os
|
|
13
|
+
from typing import Iterable
|
|
14
|
+
|
|
15
|
+
from pygpt_net.core.fixtures.stream.generator import FakeOpenAIStream
|
|
16
|
+
from pygpt_net.item.ctx import CtxItem
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class Fixtures:
|
|
20
|
+
def __init__(self, window=None):
|
|
21
|
+
"""
|
|
22
|
+
Fixtures controller
|
|
23
|
+
|
|
24
|
+
:param window: Window instance
|
|
25
|
+
"""
|
|
26
|
+
self.window = window
|
|
27
|
+
self.enabled = {
|
|
28
|
+
"stream": False,
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
def is_enabled(self, name: str) -> bool:
|
|
32
|
+
"""
|
|
33
|
+
Check if fixture is enabled by name
|
|
34
|
+
|
|
35
|
+
:param name: fixture name
|
|
36
|
+
"""
|
|
37
|
+
return self.enabled.get(name, False)
|
|
38
|
+
|
|
39
|
+
def enable(self, name: str):
|
|
40
|
+
"""
|
|
41
|
+
Enable fixture by name
|
|
42
|
+
|
|
43
|
+
:param name: fixture name
|
|
44
|
+
"""
|
|
45
|
+
if name in self.enabled:
|
|
46
|
+
self.enabled[name] = True
|
|
47
|
+
|
|
48
|
+
def disable(self, name: str):
|
|
49
|
+
"""
|
|
50
|
+
Disable fixture by name
|
|
51
|
+
|
|
52
|
+
:param name: fixture name
|
|
53
|
+
e"""
|
|
54
|
+
if name in self.enabled:
|
|
55
|
+
self.enabled[name] = False
|
|
56
|
+
|
|
57
|
+
def toggle(self, name: str):
|
|
58
|
+
"""
|
|
59
|
+
Toggle fixture by name
|
|
60
|
+
|
|
61
|
+
:param name: fixture name
|
|
62
|
+
"""
|
|
63
|
+
if name in self.enabled:
|
|
64
|
+
self.enabled[name] = not self.enabled[name]
|
|
65
|
+
|
|
66
|
+
def toggle_from_menu(self, name: str):
|
|
67
|
+
"""
|
|
68
|
+
Toggle fake stream debug
|
|
69
|
+
|
|
70
|
+
:param name: fixture name
|
|
71
|
+
"""
|
|
72
|
+
k = f"debug.fixtures.{name}"
|
|
73
|
+
if k not in self.window.ui.menu:
|
|
74
|
+
return
|
|
75
|
+
value = self.window.ui.menu[k].isChecked()
|
|
76
|
+
self.enable("stream") if value else self.disable("stream")
|
|
77
|
+
self.window.controller.debug.update() # update menu
|
|
78
|
+
|
|
79
|
+
def get_stream_generator(self, ctx: CtxItem) -> Iterable:
|
|
80
|
+
"""
|
|
81
|
+
Get fake stream generator
|
|
82
|
+
|
|
83
|
+
:param ctx: context item
|
|
84
|
+
:return: stream generator
|
|
85
|
+
"""
|
|
86
|
+
ctx.use_responses_api = False
|
|
87
|
+
path = os.path.join(self.window.core.config.get_app_path(), "data", "fixtures", "fake_stream.txt")
|
|
88
|
+
return FakeOpenAIStream(code_path=path).stream(
|
|
89
|
+
api="raw",
|
|
90
|
+
chunk="code",
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
def setup(self):
|
|
94
|
+
"""Set up fixtures"""
|
|
95
|
+
pass
|
|
96
|
+
|
|
97
|
+
def update(self):
|
|
98
|
+
"""Update fixtures"""
|
|
99
|
+
pass
|
|
100
|
+
|
|
101
|
+
def reload(self):
|
|
102
|
+
"""Reload fixtures"""
|
|
103
|
+
pass
|
|
@@ -56,7 +56,8 @@ class Console:
|
|
|
56
56
|
res = "\n" + self.window.core.debug.mem("Console")
|
|
57
57
|
self.log(res)
|
|
58
58
|
elif msg == "free":
|
|
59
|
-
|
|
59
|
+
self.window.controller.ctx.fresh_current_output()
|
|
60
|
+
mem_clean(force=True)
|
|
60
61
|
self.log("Memory cleaned")
|
|
61
62
|
elif msg in ["quit", "exit", "/q"]:
|
|
62
63
|
self.window.close()
|
pygpt_net/core/debug/debug.py
CHANGED
|
File without changes
|
|
@@ -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.
|
|
9
|
+
# Updated Date: 2025.09.12 20:00:00 #
|
|
10
10
|
# ================================================== #
|
|
11
11
|
|
|
12
12
|
import asyncio
|
|
@@ -140,9 +140,8 @@ class FakeOpenAIStream:
|
|
|
140
140
|
# Chat: often the first delta with a role
|
|
141
141
|
if api == "chat" and cfg.include_chat_role:
|
|
142
142
|
prefix_payloads.append(self._wrap_chat_delta({"role": "assistant", "content": ""}))
|
|
143
|
-
# Code: we start with ```python\n
|
|
144
143
|
if chunk == "code":
|
|
145
|
-
prefix_payloads.append(self._wrap_payload(cfg, "
|
|
144
|
+
prefix_payloads.append(self._wrap_payload(cfg, ""))
|
|
146
145
|
|
|
147
146
|
self._code_mode = (chunk == "code")
|
|
148
147
|
return prefix_payloads, sleep_dt
|