pygpt-net 2.6.64__py3-none-any.whl → 2.6.65__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 (38) hide show
  1. pygpt_net/CHANGELOG.txt +10 -0
  2. pygpt_net/__init__.py +3 -3
  3. pygpt_net/app.py +3 -1
  4. pygpt_net/controller/files/files.py +71 -2
  5. pygpt_net/controller/presets/editor.py +137 -22
  6. pygpt_net/core/agents/custom/__init__.py +18 -2
  7. pygpt_net/core/agents/custom/runner.py +2 -2
  8. pygpt_net/core/attachments/clipboard.py +146 -0
  9. pygpt_net/core/render/web/renderer.py +33 -11
  10. pygpt_net/data/config/config.json +3 -3
  11. pygpt_net/data/config/models.json +3 -3
  12. pygpt_net/data/css/style.dark.css +12 -0
  13. pygpt_net/data/css/style.light.css +12 -0
  14. pygpt_net/data/icons/pin2.svg +1 -0
  15. pygpt_net/data/icons/pin3.svg +3 -0
  16. pygpt_net/data/icons/point.svg +1 -0
  17. pygpt_net/data/icons/target.svg +1 -0
  18. pygpt_net/data/js/app/ui.js +19 -2
  19. pygpt_net/data/js/app/user.js +22 -54
  20. pygpt_net/data/js/app.min.js +7 -9
  21. pygpt_net/data/locale/locale.en.ini +4 -0
  22. pygpt_net/icons.qrc +4 -0
  23. pygpt_net/icons_rc.py +274 -137
  24. pygpt_net/js_rc.py +2038 -2075
  25. pygpt_net/provider/core/config/patch.py +8 -0
  26. pygpt_net/ui/__init__.py +6 -1
  27. pygpt_net/ui/dialog/preset.py +9 -4
  28. pygpt_net/ui/layout/chat/attachments.py +18 -1
  29. pygpt_net/ui/layout/status.py +3 -3
  30. pygpt_net/ui/widget/element/status.py +55 -0
  31. pygpt_net/ui/widget/filesystem/explorer.py +116 -2
  32. pygpt_net/ui/widget/lists/context.py +26 -16
  33. pygpt_net/ui/widget/textarea/input.py +71 -17
  34. {pygpt_net-2.6.64.dist-info → pygpt_net-2.6.65.dist-info}/METADATA +12 -2
  35. {pygpt_net-2.6.64.dist-info → pygpt_net-2.6.65.dist-info}/RECORD +38 -32
  36. {pygpt_net-2.6.64.dist-info → pygpt_net-2.6.65.dist-info}/LICENSE +0 -0
  37. {pygpt_net-2.6.64.dist-info → pygpt_net-2.6.65.dist-info}/WHEEL +0 -0
  38. {pygpt_net-2.6.64.dist-info → pygpt_net-2.6.65.dist-info}/entry_points.txt +0 -0
@@ -168,6 +168,14 @@ class Patch:
168
168
  patch_css('style.dark.css', True)
169
169
  updated = True
170
170
 
171
+ # < 2.6.65
172
+ if old < parse_version("2.6.65"):
173
+ print("Migrating config from < 2.6.65...")
174
+ # add: status bar css
175
+ patch_css('style.light.css', True)
176
+ patch_css('style.dark.css', True)
177
+ updated = True
178
+
171
179
  # update file
172
180
  migrated = False
173
181
  if updated:
pygpt_net/ui/__init__.py CHANGED
@@ -113,6 +113,8 @@ class UI:
113
113
  """Set default sizes"""
114
114
  def set_initial_splitter_height():
115
115
  """Set initial splitter height"""
116
+ if 'main.output' not in self.window.ui.splitters:
117
+ return
116
118
  total_height = self.window.ui.splitters['main.output'].size().height()
117
119
  if total_height > 0:
118
120
  size_output = int(total_height * 0.9)
@@ -124,6 +126,8 @@ class UI:
124
126
 
125
127
  def set_initial_splitter_width():
126
128
  """Set initial splitter width"""
129
+ if 'main' not in self.window.ui.splitters:
130
+ return
127
131
  total_width = self.window.ui.splitters['main'].size().width()
128
132
  if total_width > 0:
129
133
  size_output = int(total_width * 0.75)
@@ -139,7 +143,8 @@ class UI:
139
143
  suffix = self.window.core.platforms.get_env_suffix()
140
144
  profile_name = self.window.core.config.profile.get_current_name()
141
145
  self.window.setWindowTitle(
142
- f"PyGPT - Desktop AI Assistant {self.window.meta['version']} | build {self.window.meta['build'].replace('.', '-')}{suffix} ({profile_name})"
146
+ f"PyGPT - Desktop AI Assistant {self.window.meta['version']} | "
147
+ f"build {self.window.meta['build'].replace('.', '-')}{suffix} ({profile_name})"
143
148
  )
144
149
 
145
150
  def post_setup(self):
@@ -6,13 +6,13 @@
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.25 13:04:51 #
9
+ # Updated Date: 2025.09.28 08:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from PySide6.QtCore import Qt
13
13
  from PySide6.QtGui import QIcon
14
14
  from PySide6.QtWidgets import QPushButton, QHBoxLayout, QLabel, QVBoxLayout, QSplitter, QWidget, QSizePolicy, \
15
- QTabWidget, QFileDialog
15
+ QTabWidget, QFileDialog, QScrollArea, QFrame
16
16
 
17
17
  from pygpt_net.core.types import (
18
18
  MODE_AGENT,
@@ -169,7 +169,6 @@ class Preset(BaseConfigDialog):
169
169
  desc.setContentsMargins(0, 5, 0, 5)
170
170
  self.window.ui.nodes['preset.editor.description'] = desc
171
171
 
172
-
173
172
  # prompt + extra options
174
173
  prompt_layout = QVBoxLayout()
175
174
  prompt_layout.addWidget(widgets['prompt'])
@@ -334,8 +333,14 @@ class Preset(BaseConfigDialog):
334
333
  self.window.ui.nodes['preset.editor.extra'] = {}
335
334
 
336
335
  tabs = QTabWidget()
336
+
337
+ # Make the prompt tab scrollable to avoid vertical overlap in narrow layouts.
338
+ scroll_prompt = QScrollArea()
339
+ scroll_prompt.setWidget(prompt_widget)
340
+ scroll_prompt.setWidgetResizable(True)
341
+ scroll_prompt.setFrameShape(QFrame.NoFrame)
337
342
  tabs.addTab(
338
- prompt_widget,
343
+ scroll_prompt,
339
344
  trans("preset.prompt"),
340
345
  )
341
346
  tabs.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
@@ -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.24 23:00:00 #
9
+ # Updated Date: 2025.09.28 08:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  import os
@@ -19,8 +19,10 @@ from PySide6.QtWidgets import QVBoxLayout, QPushButton, QHBoxLayout, QCheckBox,
19
19
  from pygpt_net.item.attachment import AttachmentItem
20
20
  from pygpt_net.ui.widget.element.labels import HelpLabel
21
21
  from pygpt_net.ui.widget.lists.attachment import AttachmentList
22
+ from pygpt_net.core.attachments.clipboard import AttachmentDropHandler
22
23
  from pygpt_net.utils import trans
23
24
 
25
+
24
26
  class Attachments:
25
27
  def __init__(self, window=None):
26
28
  """
@@ -30,6 +32,8 @@ class Attachments:
30
32
  """
31
33
  self.window = window
32
34
  self.id = 'attachments'
35
+ # Keep a strong reference to DnD handler(s)
36
+ self._dnd_handlers = {}
33
37
 
34
38
  def setup(self) -> QVBoxLayout:
35
39
  """
@@ -132,6 +136,19 @@ class Attachments:
132
136
  self.window.ui.models[self.id] = self.create_model(self.window)
133
137
  self.window.ui.nodes[self.id].setModel(self.window.ui.models[self.id])
134
138
 
139
+ # Drag & Drop: allow dropping files/images/urls/text directly onto the list
140
+ try:
141
+ self._dnd_handlers[self.id] = AttachmentDropHandler(
142
+ self.window,
143
+ self.window.ui.nodes[self.id],
144
+ policy=AttachmentDropHandler.SWALLOW_ALL,
145
+ )
146
+ except Exception as e:
147
+ try:
148
+ self.window.core.debug.log(e)
149
+ except Exception:
150
+ pass
151
+
135
152
  def create_model(self, parent) -> QStandardItemModel:
136
153
  """
137
154
  Create list model
@@ -14,6 +14,7 @@ from PySide6.QtWidgets import QLabel, QHBoxLayout, QSizePolicy, QPushButton
14
14
 
15
15
  from pygpt_net.ui.widget.element.labels import HelpLabel
16
16
  from pygpt_net.ui.widget.anims.loader import Loader
17
+ from pygpt_net.ui.widget.element.status import BottomStatus
17
18
  from pygpt_net.utils import trans
18
19
 
19
20
 
@@ -34,8 +35,7 @@ class Status:
34
35
  """
35
36
  nodes = self.window.ui.nodes
36
37
 
37
- nodes['status'] = QLabel(trans('status.started'))
38
- nodes['status'].setParent(self.window)
38
+ nodes['status'] = BottomStatus(window=self.window)
39
39
 
40
40
  nodes['status.agent'] = HelpLabel("")
41
41
  nodes['status.agent'].setParent(self.window)
@@ -53,7 +53,7 @@ class Status:
53
53
  layout = QHBoxLayout()
54
54
  layout.addWidget(nodes['anim.loading.status'])
55
55
  layout.addWidget(nodes['status.agent'])
56
- layout.addWidget(nodes['status'])
56
+ layout.addWidget(nodes['status'].setup())
57
57
  layout.addWidget(nodes['global.stop'])
58
58
  layout.setAlignment(Qt.AlignLeft)
59
59
 
@@ -0,0 +1,55 @@
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.28 00:00:00 #
10
+ # ================================================== #
11
+
12
+ from PySide6.QtWidgets import QLabel, QHBoxLayout, QWidget
13
+
14
+ from datetime import datetime
15
+ from pygpt_net.utils import trans
16
+
17
+
18
+ class BottomStatus:
19
+ def __init__(self, window=None):
20
+ self.window = window
21
+ self.timer = QLabel(parent=self.window)
22
+ self.timer.setObjectName("StatusBarTimer")
23
+ self.msg = QLabel(parent=self.window)
24
+ self.msg.setObjectName("StatusBarMessage")
25
+ self.set_text(trans('status.started'))
26
+
27
+ def set_text(self, text):
28
+ """Set status text"""
29
+ self.msg.setText(text)
30
+ if text:
31
+ now = datetime.now()
32
+ self.timer.setText(now.strftime("%H:%M"))
33
+ else:
34
+ self.timer.setText("")
35
+
36
+ def setText(self, text):
37
+ """Fallback for set_text method"""
38
+ self.set_text(text)
39
+
40
+ def text(self) -> str:
41
+ """Get status text"""
42
+ return self.msg.text()
43
+
44
+ def setup(self):
45
+ """Setup status bar widget"""
46
+ self.timer.setText("00:00")
47
+ layout = QHBoxLayout()
48
+ layout.setContentsMargins(0, 0, 0, 0)
49
+ layout.setSpacing(5)
50
+ layout.addWidget(self.timer)
51
+ layout.addWidget(self.msg)
52
+ layout.addStretch()
53
+ widget = QWidget(self.window)
54
+ widget.setLayout(layout)
55
+ return widget
@@ -6,13 +6,13 @@
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.24 23:00:00 #
9
+ # Updated Date: 2025.09.28 08:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  import datetime
13
13
  import os
14
14
 
15
- from PySide6.QtCore import Qt, QModelIndex, QDir
15
+ from PySide6.QtCore import Qt, QModelIndex, QDir, QObject, QEvent
16
16
  from PySide6.QtGui import QAction, QIcon, QCursor, QResizeEvent
17
17
  from PySide6.QtWidgets import QTreeView, QMenu, QWidget, QVBoxLayout, QFileSystemModel, QLabel, QHBoxLayout, \
18
18
  QPushButton, QSizePolicy
@@ -23,6 +23,117 @@ from pygpt_net.ui.widget.element.labels import HelpLabel
23
23
  from pygpt_net.utils import trans
24
24
 
25
25
 
26
+ class ExplorerDropHandler(QObject):
27
+ """
28
+ Drag & drop handler for FileExplorer (uploads into target directory).
29
+ - Accepts local file and directory URLs.
30
+ - Determines target directory from drop position:
31
+ * directory item -> that directory
32
+ * file item -> parent directory
33
+ * empty area -> explorer root directory
34
+ - Uses Files controller to perform the actual copy and refresh view.
35
+ """
36
+ def __init__(self, explorer):
37
+ super().__init__(explorer)
38
+ self.explorer = explorer
39
+ self.view = explorer.treeView
40
+
41
+ # Enable drops on both the view and its viewport
42
+ try:
43
+ self.view.setAcceptDrops(True)
44
+ except Exception:
45
+ pass
46
+ vp = self.view.viewport()
47
+ if vp is not None:
48
+ try:
49
+ vp.setAcceptDrops(True)
50
+ except Exception:
51
+ pass
52
+ vp.installEventFilter(self)
53
+ self.view.installEventFilter(self)
54
+
55
+ def _mime_has_local_urls(self, md) -> bool:
56
+ try:
57
+ if md and md.hasUrls():
58
+ for url in md.urls():
59
+ if url.isLocalFile():
60
+ return True
61
+ except Exception:
62
+ pass
63
+ return False
64
+
65
+ def _local_paths_from_mime(self, md) -> list:
66
+ out = []
67
+ try:
68
+ if not (md and md.hasUrls()):
69
+ return out
70
+ for url in md.urls():
71
+ try:
72
+ if url.isLocalFile():
73
+ p = url.toLocalFile()
74
+ if p:
75
+ out.append(p)
76
+ except Exception:
77
+ continue
78
+ except Exception:
79
+ pass
80
+ return out
81
+
82
+ def _target_dir_from_pos(self, event) -> str:
83
+ # QDropEvent in Qt6: use position() -> QPointF
84
+ try:
85
+ pos = event.position().toPoint()
86
+ except Exception:
87
+ pos = event.pos()
88
+ idx = self.view.indexAt(pos)
89
+ if idx.isValid():
90
+ path = self.explorer.model.filePath(idx)
91
+ if os.path.isdir(path):
92
+ return path
93
+ return os.path.dirname(path)
94
+ # Fallback: explorer root directory
95
+ return self.explorer.directory
96
+
97
+ def eventFilter(self, obj, event):
98
+ et = event.type()
99
+
100
+ if et in (QEvent.DragEnter, QEvent.DragMove):
101
+ md = getattr(event, 'mimeData', lambda: None)()
102
+ if self._mime_has_local_urls(md):
103
+ try:
104
+ event.setDropAction(Qt.CopyAction)
105
+ event.acceptProposedAction()
106
+ except Exception:
107
+ event.accept()
108
+ return True
109
+ return False
110
+
111
+ if et == QEvent.Drop:
112
+ md = getattr(event, 'mimeData', lambda: None)()
113
+ if not self._mime_has_local_urls(md):
114
+ return False
115
+
116
+ paths = self._local_paths_from_mime(md)
117
+ target_dir = self._target_dir_from_pos(event)
118
+ try:
119
+ self.explorer.window.controller.files.upload_paths(paths, target_dir)
120
+ except Exception as e:
121
+ try:
122
+ self.explorer.window.core.debug.log(e)
123
+ except Exception:
124
+ pass
125
+
126
+ try:
127
+ event.setDropAction(Qt.CopyAction)
128
+ event.acceptProposedAction()
129
+ except Exception:
130
+ event.accept()
131
+ # Swallow so the view does not try to handle the drop itself
132
+ return True
133
+
134
+ return False
135
+
136
+
26
137
  class FileExplorer(QWidget):
27
138
  def __init__(self, window, directory, index_data):
28
139
  """
@@ -138,6 +249,9 @@ class FileExplorer(QWidget):
138
249
  'db': QIcon(":/icons/db.svg"),
139
250
  }
140
251
 
252
+ # Drag & Drop upload support
253
+ self._dnd_handler = ExplorerDropHandler(self)
254
+
141
255
  def eventFilter(self, source, event):
142
256
  """
143
257
  Focus event filter
@@ -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.15 22:00:00 #
9
+ # Updated Date: 2025.09.28 00:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  import datetime
@@ -40,7 +40,7 @@ class ContextList(BaseList):
40
40
  'chat': QIcon(":/icons/chat.svg"),
41
41
  'copy': QIcon(":/icons/copy.svg"),
42
42
  'close': QIcon(":/icons/close.svg"),
43
- 'pin': QIcon(":/icons/pin.svg"),
43
+ 'pin': QIcon(":/icons/pin3.svg"),
44
44
  'clock': QIcon(":/icons/clock.svg"),
45
45
  'db': QIcon(":/icons/db.svg"),
46
46
  'folder': QIcon(":/icons/folder_filled.svg"),
@@ -49,7 +49,8 @@ class ContextList(BaseList):
49
49
  self._color_icon_cache = {}
50
50
 
51
51
  # Use a custom delegate for labels/pinned/attachment indicators and group border indicator
52
- self.setItemDelegate(ImportantItemDelegate(self, self._icons['attachment']))
52
+ # Pass both: attachment icon and pin icon (pin2.svg) for pinned indicator rendering
53
+ self.setItemDelegate(ImportantItemDelegate(self, self._icons['attachment'], self._icons['pin']))
53
54
 
54
55
  # Ensure context menu works as before
55
56
  self.setContextMenuPolicy(Qt.CustomContextMenu)
@@ -467,15 +468,17 @@ class ImportantItemDelegate(QtWidgets.QStyledItemDelegate):
467
468
  """
468
469
  Item delegate that paints:
469
470
  - Attachment icon on the right side (centered vertically),
470
- - Pinned indicator (small circle) in the top-right corner (overlays if needed),
471
+ - Pinned indicator (pin.svg icon) in the top-right corner (overlays if needed),
471
472
  - Label color as a full-height vertical bar on the left for labeled items,
472
473
  - Group enclosure indicator for expanded groups:
473
474
  - thin vertical bar (default 2 px) on the left side of child rows area,
474
475
  - thin horizontal bar (default 2 px) at the bottom of the last child row.
475
476
  """
476
- def __init__(self, parent=None, attachment_icon: QIcon = None):
477
+ def __init__(self, parent=None, attachment_icon: QIcon = None, pin_icon: QIcon = None):
477
478
  super().__init__(parent)
478
479
  self._attachment_icon = attachment_icon or QIcon(":/icons/attachment.svg")
480
+ # Use provided pin icon (transparent background) as pinned indicator
481
+ self._pin_icon = pin_icon or QIcon(":/icons/pin.svg")
479
482
 
480
483
  # Predefined label colors (status -> QColor)
481
484
  self._status_colors = {
@@ -490,8 +493,8 @@ class ImportantItemDelegate(QtWidgets.QStyledItemDelegate):
490
493
  }
491
494
 
492
495
  # Visual tuning constants
493
- self._pin_pen = QtGui.QPen(QtCore.Qt.black, 0.5, QtCore.Qt.SolidLine)
494
- self._pin_diameter = 4 # Small pinned circle diameter
496
+ self._pin_pen = QtGui.QPen(QtCore.Qt.black, 0.5, QtCore.Qt.SolidLine) # kept for compatibility
497
+ self._pin_diameter = 4 # legacy circle diameter (not used anymore)
495
498
  self._pin_margin = 3 # Margin from top and right edges
496
499
  self._attach_spacing = 4 # Kept for potential future layout tweaks
497
500
  self._label_bar_width = 4 # Full-height label bar width (left side)
@@ -507,6 +510,10 @@ class ImportantItemDelegate(QtWidgets.QStyledItemDelegate):
507
510
  self._group_indicator_gap = 6 # gap between child content left and the vertical bar
508
511
  self._group_indicator_bottom_offset = 6
509
512
 
513
+ # Pinned icon sizing (kept deliberately small, similar to previous yellow dot)
514
+ # The actual painted size is min(max_size, availableHeightWithMargins)
515
+ self._pin_icon_max_size = 12 # px
516
+
510
517
  # Try to load customization from application config (safe if missing)
511
518
  self._init_group_indicator_from_config()
512
519
 
@@ -665,20 +672,23 @@ class ImportantItemDelegate(QtWidgets.QStyledItemDelegate):
665
672
  )
666
673
  self._attachment_icon.paint(painter, icon_rect, QtCore.Qt.AlignCenter)
667
674
 
668
- # Pinned indicator (small circle) kept at a fixed top-right position.
669
- # It does not shift left when the attachment is present; it overlays above it.
675
+ # Pinned indicator: small pin.svg painted at fixed top-right position.
676
+ # It overlays above any other right-side icons.
670
677
  if is_important:
671
678
  painter.setRenderHint(QtGui.QPainter.Antialiasing, True)
672
679
  painter.setCompositionMode(QtGui.QPainter.CompositionMode_SourceOver)
673
- color = self.get_color_for_status(3)
674
680
 
675
- x = option.rect.x() + option.rect.width() - self._pin_margin - self._pin_diameter
676
- y = option.rect.y() + self._pin_margin
677
- pin_rect = QtCore.QRect(x, y, self._pin_diameter, self._pin_diameter)
681
+ # Compute a compact size similar in footprint to previous circle,
682
+ # but readable for vector icon; clamp to available height.
683
+ available = max(8, option.rect.height() - 2 * self._pin_margin)
684
+ pin_size = min(self._pin_icon_max_size, available)
678
685
 
679
- painter.setBrush(color)
680
- painter.setPen(self._pin_pen)
681
- painter.drawEllipse(pin_rect)
686
+ x = option.rect.right() - self._pin_margin - pin_size
687
+ y = option.rect.top() + self._pin_margin
688
+ pin_rect = QtCore.QRect(x, y, pin_size, pin_size)
689
+
690
+ # Paint the pin icon (transparent background)
691
+ self._pin_icon.paint(painter, pin_rect, QtCore.Qt.AlignCenter)
682
692
 
683
693
  # Label bar on the left with 3px vertical margins
684
694
  if label > 0:
@@ -6,11 +6,12 @@
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.26 12:00:00 #
9
+ # Updated Date: 2025.09.28 08:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from typing import Optional
13
13
  import math
14
+ import os
14
15
 
15
16
  from PySide6.QtCore import Qt, QSize, QTimer, QEvent
16
17
  from PySide6.QtGui import QAction, QIcon, QImage
@@ -24,6 +25,8 @@ from PySide6.QtWidgets import (
24
25
 
25
26
  from pygpt_net.core.events import Event
26
27
  from pygpt_net.utils import trans
28
+ from pygpt_net.core.attachments.clipboard import AttachmentDropHandler
29
+
27
30
 
28
31
  class ChatInput(QTextEdit):
29
32
 
@@ -127,6 +130,12 @@ class ChatInput(QTextEdit):
127
130
  # Paste/input safety limits
128
131
  self._paste_max_chars = 1000000000 # hard cap to prevent pathological pastes from freezing/crashing
129
132
 
133
+ # One-shot guard to avoid duplicate attachment processing on drops that also insert text.
134
+ self._skip_clipboard_on_next_insert = False
135
+
136
+ # Drag & Drop: add as attachments; do not insert file paths into text
137
+ self._dnd_handler = AttachmentDropHandler(self.window, self, policy=AttachmentDropHandler.INPUT_MIX)
138
+
130
139
  def _on_text_changed_tokens(self):
131
140
  """Schedule token count update with debounce."""
132
141
  self._tokens_timer.start()
@@ -157,27 +166,46 @@ class ChatInput(QTextEdit):
157
166
  except Exception:
158
167
  return False
159
168
 
169
+ def _mime_has_local_file_urls(self, source) -> bool:
170
+ """
171
+ Detects whether mime data contains any local file/directory URLs.
172
+ """
173
+ try:
174
+ if source and source.hasUrls():
175
+ for url in source.urls():
176
+ if url.isLocalFile():
177
+ return True
178
+ except Exception:
179
+ pass
180
+ return False
181
+
160
182
  def insertFromMimeData(self, source):
161
183
  """
162
184
  Insert from mime data
163
185
 
164
186
  :param source: source
165
187
  """
166
- # Always process attachments first; never break input pipeline on errors.
167
- try:
168
- self.handle_clipboard(source)
169
- except Exception as e:
188
+ has_local_files = self._mime_has_local_file_urls(source)
189
+
190
+ # Avoid double-processing when drop is allowed to fall through to default insertion.
191
+ should_skip = bool(getattr(self, "_skip_clipboard_on_next_insert", False))
192
+ if should_skip:
193
+ self._skip_clipboard_on_next_insert = False
194
+ else:
195
+ # Always process attachments first; never break input pipeline on errors.
170
196
  try:
171
- self.window.core.debug.log(e)
172
- except Exception:
173
- pass
197
+ self.handle_clipboard(source)
198
+ except Exception as e:
199
+ try:
200
+ self.window.core.debug.log(e)
201
+ except Exception:
202
+ pass
174
203
 
175
- # If an image is present, we treat it as attachment-only and do not insert textual representation.
204
+ # Do not insert textual representation for images nor local file URLs (including directories).
176
205
  try:
177
- if source and source.hasImage():
206
+ if source and (source.hasImage() or has_local_files):
178
207
  return
179
208
  except Exception:
180
- # fallback to text extraction below
181
209
  pass
182
210
 
183
211
  # Insert only sanitized plain text (no HTML, no custom formats).
@@ -194,24 +222,27 @@ class ChatInput(QTextEdit):
194
222
  def _safe_text_from_mime(self, source) -> str:
195
223
  """
196
224
  Extracts plain text from QMimeData safely, normalizes and sanitizes it.
197
- Falls back to URLs joined by space if textual content is not provided.
225
+ Falls back to URLs joined by space only for non-local URLs.
198
226
  """
199
227
  try:
200
228
  if source is None:
201
229
  return ""
230
+ # Prefer real text if present
202
231
  if source.hasText():
203
232
  return self._sanitize_text(source.text())
233
+ # Fallback: for non-local URLs we allow insertion as text (e.g., http/https)
204
234
  if source.hasUrls():
205
235
  parts = []
206
236
  for url in source.urls():
207
237
  try:
208
238
  if url.isLocalFile():
209
- parts.append(url.toLocalFile())
210
- else:
211
- parts.append(url.toString())
239
+ # Skip local files/dirs textual fallback; they are handled as attachments
240
+ continue
241
+ parts.append(url.toString())
212
242
  except Exception:
213
243
  continue
214
- return self._sanitize_text(" ".join([p for p in parts if p]))
244
+ if parts:
245
+ return self._sanitize_text(" ".join([p for p in parts if p]))
215
246
  except Exception as e:
216
247
  try:
217
248
  self.window.core.debug.log(e)
@@ -286,13 +317,36 @@ class ChatInput(QTextEdit):
286
317
  image = source.imageData()
287
318
  if isinstance(image, QImage):
288
319
  self.window.controller.attachment.from_clipboard_image(image)
320
+ else:
321
+ # Some platforms provide QPixmap; convert to QImage if possible
322
+ try:
323
+ img = image.toImage()
324
+ if isinstance(img, QImage):
325
+ self.window.controller.attachment.from_clipboard_image(img)
326
+ except Exception:
327
+ pass
289
328
  elif source.hasUrls():
290
329
  urls = source.urls()
291
330
  for url in urls:
292
331
  try:
293
332
  if url.isLocalFile():
294
333
  local_path = url.toLocalFile()
295
- self.window.controller.attachment.from_clipboard_url(local_path)
334
+ if not local_path:
335
+ continue
336
+ if os.path.isdir(local_path):
337
+ # Recursively add all files from the dropped directory
338
+ for root, _, files in os.walk(local_path):
339
+ for name in files:
340
+ fpath = os.path.join(root, name)
341
+ try:
342
+ self.window.controller.attachment.from_clipboard_url(fpath, all=True)
343
+ except Exception:
344
+ continue
345
+ else:
346
+ self.window.controller.attachment.from_clipboard_url(local_path, all=True)
347
+ else:
348
+ # Non-local URLs are handled as text (if any) by _safe_text_from_mime
349
+ pass
296
350
  except Exception:
297
351
  # Ignore broken URL entries
298
352
  continue
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pygpt-net
3
- Version: 2.6.64
3
+ Version: 2.6.65
4
4
  Summary: Desktop AI Assistant powered by: OpenAI GPT-5, GPT-4, o1, o3, Gemini, Claude, Grok, DeepSeek, and other models supported by Llama Index, and Ollama. Chatbot, agents, completion, image generation, vision analysis, speech-to-text, plugins, MCP, internet access, file handling, command execution and more.
5
5
  License: MIT
6
6
  Keywords: ai,api,api key,app,assistant,bielik,chat,chatbot,chatgpt,claude,dall-e,deepseek,desktop,gemini,gpt,gpt-3.5,gpt-4,gpt-4-vision,gpt-4o,gpt-5,gpt-oss,gpt3.5,gpt4,grok,langchain,llama-index,llama3,mistral,o1,o3,ollama,openai,presets,py-gpt,py_gpt,pygpt,pyside,qt,text completion,tts,ui,vision,whisper
@@ -117,7 +117,7 @@ Description-Content-Type: text/markdown
117
117
 
118
118
  [![pygpt](https://snapcraft.io/pygpt/badge.svg)](https://snapcraft.io/pygpt)
119
119
 
120
- Release: **2.6.64** | build: **2025-09-27** | Python: **>=3.10, <3.14**
120
+ Release: **2.6.65** | build: **2025-09-28** | Python: **>=3.10, <3.14**
121
121
 
122
122
  > Official website: https://pygpt.net | Documentation: https://pygpt.readthedocs.io
123
123
  >
@@ -3723,6 +3723,16 @@ may consume additional tokens that are not displayed in the main window.
3723
3723
 
3724
3724
  ## Recent changes:
3725
3725
 
3726
+ **2.6.65 (2025-09-28)**
3727
+
3728
+ - Added drag and drop functionality for files and directories from the filesystem in attachments and file explorer.
3729
+ - Added automatic thumbnail generation when uploading avatars.
3730
+ - Added a last status timer.
3731
+ - Added a fade effect to collapsed user messages.
3732
+ - Added a scroll area to the agent options in the presets editor.
3733
+ - Added a hover effect to lists.
3734
+ - Improved UI/UX.
3735
+
3726
3736
  **2.6.64 (2025-09-27)**
3727
3737
 
3728
3738
  - Added translations to agent headers.