pygpt-net 2.6.34__py3-none-any.whl → 2.6.35__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 +7 -0
- pygpt_net/__init__.py +3 -3
- pygpt_net/controller/chat/common.py +8 -2
- pygpt_net/controller/chat/handler/stream_worker.py +55 -43
- pygpt_net/controller/painter/common.py +13 -1
- pygpt_net/controller/painter/painter.py +11 -2
- pygpt_net/core/bridge/bridge.py +1 -5
- pygpt_net/core/bridge/context.py +81 -36
- pygpt_net/core/bridge/worker.py +3 -1
- pygpt_net/core/ctx/bag.py +4 -0
- pygpt_net/core/events/app.py +10 -17
- pygpt_net/core/events/base.py +17 -25
- pygpt_net/core/events/control.py +9 -17
- pygpt_net/core/events/event.py +9 -62
- pygpt_net/core/events/kernel.py +8 -17
- pygpt_net/core/events/realtime.py +8 -17
- pygpt_net/core/events/render.py +9 -17
- pygpt_net/core/render/web/body.py +394 -36
- pygpt_net/core/render/web/pid.py +39 -24
- pygpt_net/core/render/web/renderer.py +146 -40
- pygpt_net/data/config/config.json +4 -3
- pygpt_net/data/config/models.json +3 -3
- pygpt_net/data/css/web-blocks.css +3 -2
- pygpt_net/data/css/web-chatgpt.css +3 -1
- pygpt_net/data/css/web-chatgpt_wide.css +3 -1
- pygpt_net/data/locale/locale.de.ini +1 -0
- pygpt_net/data/locale/locale.en.ini +3 -2
- pygpt_net/data/locale/locale.es.ini +1 -0
- pygpt_net/data/locale/locale.fr.ini +1 -0
- pygpt_net/data/locale/locale.it.ini +1 -0
- pygpt_net/data/locale/locale.pl.ini +2 -1
- pygpt_net/data/locale/locale.uk.ini +1 -0
- pygpt_net/data/locale/locale.zh.ini +1 -0
- pygpt_net/provider/api/google/__init__.py +14 -5
- pygpt_net/provider/api/openai/__init__.py +13 -10
- pygpt_net/provider/core/config/patch.py +9 -0
- pygpt_net/ui/layout/chat/painter.py +63 -4
- pygpt_net/ui/widget/draw/painter.py +702 -106
- pygpt_net/ui/widget/textarea/web.py +2 -0
- {pygpt_net-2.6.34.dist-info → pygpt_net-2.6.35.dist-info}/METADATA +9 -2
- {pygpt_net-2.6.34.dist-info → pygpt_net-2.6.35.dist-info}/RECORD +44 -44
- {pygpt_net-2.6.34.dist-info → pygpt_net-2.6.35.dist-info}/LICENSE +0 -0
- {pygpt_net-2.6.34.dist-info → pygpt_net-2.6.35.dist-info}/WHEEL +0 -0
- {pygpt_net-2.6.34.dist-info → pygpt_net-2.6.35.dist-info}/entry_points.txt +0 -0
pygpt_net/core/events/control.py
CHANGED
|
@@ -6,16 +6,22 @@
|
|
|
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.
|
|
9
|
+
# Updated Date: 2025.09.04 00:00:00 #
|
|
10
10
|
# ================================================== #
|
|
11
11
|
|
|
12
|
-
from
|
|
12
|
+
from dataclasses import dataclass
|
|
13
|
+
from typing import Optional, ClassVar
|
|
13
14
|
|
|
14
15
|
from .base import BaseEvent
|
|
16
|
+
from ...item.ctx import CtxItem
|
|
15
17
|
|
|
16
18
|
|
|
19
|
+
@dataclass(slots=True)
|
|
17
20
|
class ControlEvent(BaseEvent):
|
|
18
21
|
"""Events used for app control"""
|
|
22
|
+
# static id for event family
|
|
23
|
+
id: ClassVar[str] = "ControlEvent"
|
|
24
|
+
|
|
19
25
|
APP_EXIT = "app.exit"
|
|
20
26
|
APP_STATUS = "app.status"
|
|
21
27
|
AUDIO_INPUT_DISABLE = "audio.input.disable"
|
|
@@ -72,18 +78,4 @@ class ControlEvent(BaseEvent):
|
|
|
72
78
|
VOICE_CONTROL_UNRECOGNIZED = "unrecognized"
|
|
73
79
|
VOICE_MESSAGE_START = "voice_msg.start"
|
|
74
80
|
VOICE_MESSAGE_STOP = "voice_msg.stop"
|
|
75
|
-
VOICE_MESSAGE_TOGGLE = "voice_msg.toggle"
|
|
76
|
-
|
|
77
|
-
def __init__(
|
|
78
|
-
self,
|
|
79
|
-
name: Optional[str] = None,
|
|
80
|
-
data: Optional[dict] = None,
|
|
81
|
-
):
|
|
82
|
-
"""
|
|
83
|
-
Event object class
|
|
84
|
-
|
|
85
|
-
:param name: event name
|
|
86
|
-
:param data: event data
|
|
87
|
-
"""
|
|
88
|
-
super(ControlEvent, self).__init__(name, data)
|
|
89
|
-
self.id = "ControlEvent"
|
|
81
|
+
VOICE_MESSAGE_TOGGLE = "voice_msg.toggle"
|
pygpt_net/core/events/event.py
CHANGED
|
@@ -6,16 +6,22 @@
|
|
|
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.
|
|
9
|
+
# Updated Date: 2025.09.04 00:00:00 #
|
|
10
10
|
# ================================================== #
|
|
11
11
|
|
|
12
12
|
import json
|
|
13
|
-
from
|
|
13
|
+
from dataclasses import dataclass
|
|
14
|
+
from typing import Optional, Dict, Any, ClassVar
|
|
14
15
|
|
|
15
16
|
from pygpt_net.item.ctx import CtxItem
|
|
16
17
|
from .base import BaseEvent
|
|
17
18
|
|
|
19
|
+
|
|
20
|
+
@dataclass(slots=True)
|
|
18
21
|
class Event(BaseEvent):
|
|
22
|
+
"""Generic event with context serialization"""
|
|
23
|
+
# static id for event family
|
|
24
|
+
id: ClassVar[str] = "Event"
|
|
19
25
|
|
|
20
26
|
# Events
|
|
21
27
|
AI_NAME = "ai.name"
|
|
@@ -63,63 +69,4 @@ class Event(BaseEvent):
|
|
|
63
69
|
UI_ATTACHMENTS = "ui.attachments"
|
|
64
70
|
UI_VISION = "ui.vision"
|
|
65
71
|
USER_NAME = "user.name"
|
|
66
|
-
USER_SEND = "user.send"
|
|
67
|
-
|
|
68
|
-
def __init__(
|
|
69
|
-
self,
|
|
70
|
-
name: Optional[str] = None,
|
|
71
|
-
data: Optional[dict] = None,
|
|
72
|
-
ctx: Optional[CtxItem] = None
|
|
73
|
-
):
|
|
74
|
-
"""
|
|
75
|
-
Event object class
|
|
76
|
-
|
|
77
|
-
:param name: event name
|
|
78
|
-
:param data: event data
|
|
79
|
-
:param ctx: context instance
|
|
80
|
-
"""
|
|
81
|
-
super(Event, self).__init__(name, data, ctx)
|
|
82
|
-
self.id = "Event"
|
|
83
|
-
self.name = name
|
|
84
|
-
self.data = data
|
|
85
|
-
if self.data is None:
|
|
86
|
-
self.data = {}
|
|
87
|
-
self.ctx = ctx # CtxItem
|
|
88
|
-
self.stop = False # True to stop propagation
|
|
89
|
-
self.internal = False
|
|
90
|
-
# internal event, not called from user
|
|
91
|
-
# internal event is handled synchronously, ctx item has internal flag
|
|
92
|
-
|
|
93
|
-
def to_dict(self) -> Dict[str, Any]:
|
|
94
|
-
"""
|
|
95
|
-
Dump event to dict
|
|
96
|
-
|
|
97
|
-
:return: Event dict
|
|
98
|
-
"""
|
|
99
|
-
return {
|
|
100
|
-
'name': self.name,
|
|
101
|
-
'data': self.data,
|
|
102
|
-
'ctx': self.ctx.to_dict() if self.ctx else None,
|
|
103
|
-
'stop': self.stop,
|
|
104
|
-
'internal': self.internal,
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
def dump(self) -> str:
|
|
108
|
-
"""
|
|
109
|
-
Dump event to json string
|
|
110
|
-
|
|
111
|
-
:return: JSON string
|
|
112
|
-
"""
|
|
113
|
-
try:
|
|
114
|
-
return json.dumps(self.to_dict())
|
|
115
|
-
except Exception as e:
|
|
116
|
-
pass
|
|
117
|
-
return ""
|
|
118
|
-
|
|
119
|
-
def __str__(self) -> str:
|
|
120
|
-
"""
|
|
121
|
-
String representation of event
|
|
122
|
-
|
|
123
|
-
:return: Event string
|
|
124
|
-
"""
|
|
125
|
-
return self.dump()
|
|
72
|
+
USER_SEND = "user.send"
|
pygpt_net/core/events/kernel.py
CHANGED
|
@@ -6,16 +6,21 @@
|
|
|
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.
|
|
9
|
+
# Updated Date: 2025.09.04 00:00:00 #
|
|
10
10
|
# ================================================== #
|
|
11
11
|
|
|
12
|
-
from
|
|
12
|
+
from dataclasses import dataclass
|
|
13
|
+
from typing import Optional, ClassVar
|
|
13
14
|
|
|
14
15
|
from .base import BaseEvent
|
|
16
|
+
from ...item.ctx import CtxItem
|
|
15
17
|
|
|
16
18
|
|
|
19
|
+
@dataclass(slots=True)
|
|
17
20
|
class KernelEvent(BaseEvent):
|
|
18
21
|
"""Kernel events"""
|
|
22
|
+
# static id for event family
|
|
23
|
+
id: ClassVar[str] = "KernelEvent"
|
|
19
24
|
|
|
20
25
|
# core, events sent from kernel
|
|
21
26
|
INIT = "kernel.init"
|
|
@@ -55,18 +60,4 @@ class KernelEvent(BaseEvent):
|
|
|
55
60
|
STATUS = "kernel.status"
|
|
56
61
|
|
|
57
62
|
LIVE_APPEND = "kernel.live.append"
|
|
58
|
-
LIVE_CLEAR = "kernel.live.clear"
|
|
59
|
-
|
|
60
|
-
def __init__(
|
|
61
|
-
self,
|
|
62
|
-
name: Optional[str] = None,
|
|
63
|
-
data: Optional[dict] = None,
|
|
64
|
-
):
|
|
65
|
-
"""
|
|
66
|
-
Event object class
|
|
67
|
-
|
|
68
|
-
:param name: event name
|
|
69
|
-
:param data: event data
|
|
70
|
-
"""
|
|
71
|
-
super(KernelEvent, self).__init__(name, data)
|
|
72
|
-
self.id = "KernelEvent"
|
|
63
|
+
LIVE_CLEAR = "kernel.live.clear"
|
|
@@ -6,14 +6,17 @@
|
|
|
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.
|
|
9
|
+
# Updated Date: 2025.09.04 00:00:00 #
|
|
10
10
|
# ================================================== #
|
|
11
11
|
|
|
12
|
-
from
|
|
12
|
+
from dataclasses import dataclass
|
|
13
|
+
from typing import Optional, ClassVar
|
|
13
14
|
|
|
14
15
|
from .base import BaseEvent
|
|
16
|
+
from ...item.ctx import CtxItem
|
|
15
17
|
|
|
16
18
|
|
|
19
|
+
@dataclass(slots=True)
|
|
17
20
|
class RealtimeEvent(BaseEvent):
|
|
18
21
|
"""
|
|
19
22
|
Realtime events
|
|
@@ -26,6 +29,8 @@ class RealtimeEvent(BaseEvent):
|
|
|
26
29
|
- RT_OUTPUT_AUDIO_ERROR - audio output error (STREAM_ERROR)
|
|
27
30
|
- RT_OUTPUT_AUDIO_VOLUME_CHANGED - audio output volume changed (volume level)
|
|
28
31
|
"""
|
|
32
|
+
# static id for event family
|
|
33
|
+
id: ClassVar[str] = "RealtimeEvent"
|
|
29
34
|
|
|
30
35
|
# realtime events
|
|
31
36
|
RT_OUTPUT_AUDIO_DELTA = "rt.output.audio.delta"
|
|
@@ -38,18 +43,4 @@ class RealtimeEvent(BaseEvent):
|
|
|
38
43
|
RT_OUTPUT_TURN_END = "rt.output.turn.end"
|
|
39
44
|
RT_INPUT_AUDIO_DELTA = "rt.input.audio.delta"
|
|
40
45
|
RT_INPUT_AUDIO_MANUAL_START = "rt.input.audio.manual.start"
|
|
41
|
-
RT_INPUT_AUDIO_MANUAL_STOP = "rt.input.audio.manual.stop"
|
|
42
|
-
|
|
43
|
-
def __init__(
|
|
44
|
-
self,
|
|
45
|
-
name: Optional[str] = None,
|
|
46
|
-
data: Optional[dict] = None,
|
|
47
|
-
):
|
|
48
|
-
"""
|
|
49
|
-
Event object class
|
|
50
|
-
|
|
51
|
-
:param name: event name
|
|
52
|
-
:param data: event data
|
|
53
|
-
"""
|
|
54
|
-
super(RealtimeEvent, self).__init__(name, data)
|
|
55
|
-
self.id = "RealtimeEvent"
|
|
46
|
+
RT_INPUT_AUDIO_MANUAL_STOP = "rt.input.audio.manual.stop"
|
pygpt_net/core/events/render.py
CHANGED
|
@@ -6,16 +6,22 @@
|
|
|
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.
|
|
9
|
+
# Updated Date: 2025.09.04 00:00:00 #
|
|
10
10
|
# ================================================== #
|
|
11
11
|
|
|
12
|
-
from
|
|
12
|
+
from dataclasses import dataclass
|
|
13
|
+
from typing import Optional, ClassVar
|
|
13
14
|
|
|
14
15
|
from .base import BaseEvent
|
|
16
|
+
from ...item.ctx import CtxItem
|
|
15
17
|
|
|
16
18
|
|
|
19
|
+
@dataclass(slots=True)
|
|
17
20
|
class RenderEvent(BaseEvent):
|
|
18
21
|
"""Events used for rendering"""
|
|
22
|
+
# static id for event family
|
|
23
|
+
id: ClassVar[str] = "RenderEvent"
|
|
24
|
+
|
|
19
25
|
BEGIN = "render.begin"
|
|
20
26
|
END = "render.end"
|
|
21
27
|
FRESH = "render.fresh"
|
|
@@ -66,18 +72,4 @@ class RenderEvent(BaseEvent):
|
|
|
66
72
|
STATE_IDLE = "render.state.idle"
|
|
67
73
|
|
|
68
74
|
LIVE_APPEND = "render.live.append"
|
|
69
|
-
LIVE_CLEAR = "render.live.clear"
|
|
70
|
-
|
|
71
|
-
def __init__(
|
|
72
|
-
self,
|
|
73
|
-
name: Optional[str] = None,
|
|
74
|
-
data: Optional[dict] = None,
|
|
75
|
-
):
|
|
76
|
-
"""
|
|
77
|
-
Event object class
|
|
78
|
-
|
|
79
|
-
:param name: event name
|
|
80
|
-
:param data: event data
|
|
81
|
-
"""
|
|
82
|
-
super(RenderEvent, self).__init__(name, data)
|
|
83
|
-
self.id = "RenderEvent"
|
|
75
|
+
LIVE_CLEAR = "render.live.clear"
|