pygpt-net 2.4.41__py3-none-any.whl → 2.4.43__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 (146) hide show
  1. CHANGELOG.md +13 -0
  2. README.md +142 -70
  3. pygpt_net/CHANGELOG.txt +13 -0
  4. pygpt_net/__init__.py +3 -3
  5. pygpt_net/app.py +3 -1
  6. pygpt_net/controller/audio/__init__.py +2 -2
  7. pygpt_net/controller/camera.py +1 -10
  8. pygpt_net/controller/chat/attachment.py +36 -23
  9. pygpt_net/controller/chat/audio.py +2 -2
  10. pygpt_net/controller/config/placeholder.py +15 -1
  11. pygpt_net/controller/ui/mode.py +16 -21
  12. pygpt_net/core/attachments/__init__.py +1 -1
  13. pygpt_net/core/attachments/context.py +10 -8
  14. pygpt_net/core/audio/__init__.py +4 -1
  15. pygpt_net/core/audio/whisper.py +37 -0
  16. pygpt_net/core/bridge/worker.py +2 -2
  17. pygpt_net/core/db/__init__.py +2 -1
  18. pygpt_net/core/debug/events.py +22 -10
  19. pygpt_net/core/debug/tabs.py +6 -3
  20. pygpt_net/core/history.py +3 -2
  21. pygpt_net/core/idx/__init__.py +16 -4
  22. pygpt_net/core/idx/chat.py +15 -5
  23. pygpt_net/core/idx/indexing.py +24 -8
  24. pygpt_net/core/installer.py +2 -4
  25. pygpt_net/core/models.py +62 -17
  26. pygpt_net/core/modes.py +11 -13
  27. pygpt_net/core/notepad.py +4 -4
  28. pygpt_net/core/plugins.py +27 -16
  29. pygpt_net/core/presets.py +20 -9
  30. pygpt_net/core/profile.py +11 -3
  31. pygpt_net/core/render/web/parser.py +3 -1
  32. pygpt_net/core/settings.py +5 -5
  33. pygpt_net/core/tabs/tab.py +10 -2
  34. pygpt_net/core/tokens.py +8 -6
  35. pygpt_net/core/web/__init__.py +105 -0
  36. pygpt_net/core/{web.py → web/helpers.py} +93 -67
  37. pygpt_net/data/config/config.json +3 -3
  38. pygpt_net/data/config/models.json +3 -3
  39. pygpt_net/data/config/modes.json +3 -3
  40. pygpt_net/data/locale/locale.en.ini +1 -0
  41. pygpt_net/data/locale/plugin.cmd_web.en.ini +2 -0
  42. pygpt_net/data/locale/plugin.mailer.en.ini +21 -0
  43. pygpt_net/item/ctx.py +66 -3
  44. pygpt_net/migrations/Version20241215110000.py +25 -0
  45. pygpt_net/migrations/__init__.py +3 -1
  46. pygpt_net/plugin/agent/__init__.py +7 -2
  47. pygpt_net/plugin/audio_output/__init__.py +6 -1
  48. pygpt_net/plugin/base/plugin.py +58 -26
  49. pygpt_net/plugin/base/worker.py +20 -17
  50. pygpt_net/plugin/cmd_history/config.py +2 -2
  51. pygpt_net/plugin/cmd_web/__init__.py +3 -4
  52. pygpt_net/plugin/cmd_web/config.py +71 -3
  53. pygpt_net/plugin/cmd_web/websearch.py +20 -12
  54. pygpt_net/plugin/cmd_web/worker.py +67 -4
  55. pygpt_net/plugin/idx_llama_index/config.py +3 -3
  56. pygpt_net/plugin/mailer/__init__.py +123 -0
  57. pygpt_net/plugin/mailer/config.py +149 -0
  58. pygpt_net/plugin/mailer/runner.py +285 -0
  59. pygpt_net/plugin/mailer/worker.py +123 -0
  60. pygpt_net/provider/agents/base.py +5 -2
  61. pygpt_net/provider/agents/openai.py +4 -2
  62. pygpt_net/provider/agents/openai_assistant.py +4 -2
  63. pygpt_net/provider/agents/planner.py +4 -2
  64. pygpt_net/provider/agents/react.py +4 -2
  65. pygpt_net/provider/audio_output/openai_tts.py +5 -11
  66. pygpt_net/provider/core/assistant/base.py +5 -3
  67. pygpt_net/provider/core/assistant/json_file.py +8 -5
  68. pygpt_net/provider/core/assistant_file/base.py +4 -3
  69. pygpt_net/provider/core/assistant_file/db_sqlite/__init__.py +4 -3
  70. pygpt_net/provider/core/assistant_file/db_sqlite/storage.py +3 -2
  71. pygpt_net/provider/core/assistant_store/base.py +6 -4
  72. pygpt_net/provider/core/assistant_store/db_sqlite/__init__.py +5 -4
  73. pygpt_net/provider/core/assistant_store/db_sqlite/storage.py +5 -3
  74. pygpt_net/provider/core/attachment/base.py +5 -3
  75. pygpt_net/provider/core/attachment/json_file.py +4 -3
  76. pygpt_net/provider/core/calendar/base.py +5 -3
  77. pygpt_net/provider/core/calendar/db_sqlite/__init__.py +6 -5
  78. pygpt_net/provider/core/calendar/db_sqlite/storage.py +5 -4
  79. pygpt_net/provider/core/config/base.py +8 -6
  80. pygpt_net/provider/core/config/json_file.py +9 -7
  81. pygpt_net/provider/core/ctx/base.py +27 -25
  82. pygpt_net/provider/core/ctx/db_sqlite/__init__.py +51 -35
  83. pygpt_net/provider/core/ctx/db_sqlite/storage.py +92 -38
  84. pygpt_net/provider/core/ctx/db_sqlite/utils.py +37 -11
  85. pygpt_net/provider/core/index/base.py +129 -23
  86. pygpt_net/provider/core/index/db_sqlite/__init__.py +130 -23
  87. pygpt_net/provider/core/index/db_sqlite/storage.py +130 -23
  88. pygpt_net/provider/core/index/db_sqlite/utils.py +4 -2
  89. pygpt_net/provider/core/mode/base.py +5 -3
  90. pygpt_net/provider/core/mode/json_file.py +7 -6
  91. pygpt_net/provider/core/model/base.py +6 -4
  92. pygpt_net/provider/core/model/json_file.py +9 -7
  93. pygpt_net/provider/core/notepad/base.py +5 -3
  94. pygpt_net/provider/core/notepad/db_sqlite/__init__.py +5 -4
  95. pygpt_net/provider/core/notepad/db_sqlite/storage.py +4 -3
  96. pygpt_net/provider/core/plugin_preset/base.py +4 -2
  97. pygpt_net/provider/core/plugin_preset/json_file.py +5 -3
  98. pygpt_net/provider/core/preset/base.py +6 -4
  99. pygpt_net/provider/core/preset/json_file.py +9 -9
  100. pygpt_net/provider/core/prompt/base.py +6 -3
  101. pygpt_net/provider/core/prompt/json_file.py +11 -6
  102. pygpt_net/provider/gpt/assistants.py +15 -6
  103. pygpt_net/provider/gpt/audio.py +5 -5
  104. pygpt_net/provider/gpt/chat.py +7 -5
  105. pygpt_net/provider/gpt/completion.py +8 -4
  106. pygpt_net/provider/gpt/image.py +3 -3
  107. pygpt_net/provider/gpt/store.py +46 -12
  108. pygpt_net/provider/gpt/vision.py +16 -11
  109. pygpt_net/provider/llms/anthropic.py +7 -2
  110. pygpt_net/provider/llms/azure_openai.py +26 -5
  111. pygpt_net/provider/llms/base.py +47 -9
  112. pygpt_net/provider/llms/google.py +7 -2
  113. pygpt_net/provider/llms/hugging_face.py +13 -3
  114. pygpt_net/provider/llms/hugging_face_api.py +18 -4
  115. pygpt_net/provider/llms/local.py +7 -2
  116. pygpt_net/provider/llms/ollama.py +30 -6
  117. pygpt_net/provider/llms/openai.py +32 -6
  118. pygpt_net/provider/vector_stores/__init__.py +45 -14
  119. pygpt_net/provider/vector_stores/base.py +35 -8
  120. pygpt_net/provider/vector_stores/chroma.py +13 -3
  121. pygpt_net/provider/vector_stores/ctx_attachment.py +32 -13
  122. pygpt_net/provider/vector_stores/elasticsearch.py +12 -3
  123. pygpt_net/provider/vector_stores/pinecode.py +12 -3
  124. pygpt_net/provider/vector_stores/redis.py +12 -3
  125. pygpt_net/provider/vector_stores/simple.py +12 -3
  126. pygpt_net/provider/vector_stores/temp.py +16 -4
  127. pygpt_net/provider/web/base.py +10 -3
  128. pygpt_net/provider/web/google_custom_search.py +9 -3
  129. pygpt_net/provider/web/microsoft_bing.py +9 -3
  130. pygpt_net/tools/__init__.py +13 -5
  131. pygpt_net/tools/audio_transcriber/__init__.py +4 -3
  132. pygpt_net/tools/base.py +15 -8
  133. pygpt_net/tools/code_interpreter/__init__.py +4 -3
  134. pygpt_net/tools/html_canvas/__init__.py +4 -3
  135. pygpt_net/tools/image_viewer/__init__.py +10 -4
  136. pygpt_net/tools/indexer/__init__.py +8 -7
  137. pygpt_net/tools/media_player/__init__.py +4 -3
  138. pygpt_net/tools/text_editor/__init__.py +36 -10
  139. pygpt_net/ui/layout/chat/output.py +2 -2
  140. pygpt_net/ui/layout/ctx/ctx_list.py +1 -1
  141. pygpt_net/ui/menu/audio.py +12 -1
  142. {pygpt_net-2.4.41.dist-info → pygpt_net-2.4.43.dist-info}/METADATA +143 -71
  143. {pygpt_net-2.4.41.dist-info → pygpt_net-2.4.43.dist-info}/RECORD +146 -138
  144. {pygpt_net-2.4.41.dist-info → pygpt_net-2.4.43.dist-info}/LICENSE +0 -0
  145. {pygpt_net-2.4.41.dist-info → pygpt_net-2.4.43.dist-info}/WHEEL +0 -0
  146. {pygpt_net-2.4.41.dist-info → pygpt_net-2.4.43.dist-info}/entry_points.txt +0 -0
@@ -37,7 +37,9 @@ class Parser:
37
37
  """
38
38
  if self.md is None:
39
39
  self.md = markdown.Markdown(extensions=[
40
- 'fenced_code', # code blocks
40
+ 'fenced_code',
41
+ 'tables',
42
+ 'sane_lists',
41
43
  MathExtension(enable_dollar_delimiter=True) # math formulas
42
44
  ])
43
45
 
@@ -6,14 +6,14 @@
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 00:00:00 #
9
+ # Updated Date: 2024.12.14 22:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  import copy
13
13
  import json
14
14
  import os
15
15
  import shutil
16
- from typing import Optional
16
+ from typing import Optional, Dict, Any, List
17
17
 
18
18
  from pygpt_net.core.events import RenderEvent
19
19
 
@@ -38,7 +38,7 @@ class Settings:
38
38
  for id in self.ids:
39
39
  self.active[id] = False
40
40
 
41
- def get_options(self, id: Optional[str] = None) -> dict:
41
+ def get_options(self, id: Optional[str] = None) -> Dict[str, Any]:
42
42
  """
43
43
  Return options for given id
44
44
 
@@ -52,7 +52,7 @@ class Settings:
52
52
  if id in self.options:
53
53
  return self.options[id]
54
54
 
55
- def get_sections(self, id: Optional[str] = None) -> dict:
55
+ def get_sections(self, id: Optional[str] = None) -> Dict[str, Any]:
56
56
  """
57
57
  Return sections for given id
58
58
 
@@ -66,7 +66,7 @@ class Settings:
66
66
  if id in self.sections:
67
67
  return self.sections[id]
68
68
 
69
- def get_persist_options(self) -> list:
69
+ def get_persist_options(self) -> List[str]:
70
70
  """
71
71
  Return persist options keys (options that should be persisted when loading defaults)
72
72
 
@@ -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: 2024.12.14 17:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from datetime import datetime
@@ -70,4 +70,12 @@ class Tab:
70
70
  "updated_at": str(self.updated_at),
71
71
  "column_idx": self.column_idx,
72
72
  "tool_id": self.tool_id,
73
- }
73
+ }
74
+
75
+ def __str__(self) -> str:
76
+ """
77
+ String representation
78
+
79
+ :return: str
80
+ """
81
+ return str(self.to_dict())
pygpt_net/core/tokens.py CHANGED
@@ -6,13 +6,16 @@
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: 2024.12.14 22:00:00 #
10
10
  # ================================================== #
11
11
 
12
- from typing import Tuple
12
+ from typing import Tuple, List
13
13
 
14
14
  import tiktoken
15
15
 
16
+ from langchain_core.messages import ChatMessage as ChatMessageLangchain
17
+ from llama_index.core.base.llms.types import ChatMessage as ChatMessageLlama
18
+
16
19
  from pygpt_net.core.types import (
17
20
  MODE_AGENT,
18
21
  MODE_AGENT_LLAMA,
@@ -39,7 +42,6 @@ CHAT_MODES = [
39
42
  MODE_AUDIO,
40
43
  ]
41
44
 
42
-
43
45
  class Tokens:
44
46
  def __init__(self, window=None):
45
47
  """
@@ -151,7 +153,7 @@ class Tokens:
151
153
 
152
154
  @staticmethod
153
155
  def from_messages(
154
- messages: list,
156
+ messages: List[dict],
155
157
  model: str = "gpt-4"
156
158
  ) -> int:
157
159
  """
@@ -182,7 +184,7 @@ class Tokens:
182
184
 
183
185
  @staticmethod
184
186
  def from_langchain_messages(
185
- messages: list,
187
+ messages: List[ChatMessageLangchain],
186
188
  model: str = "gpt-4"
187
189
  ) -> int:
188
190
  """
@@ -203,7 +205,7 @@ class Tokens:
203
205
  @staticmethod
204
206
  def from_llama_messages(
205
207
  query: str,
206
- messages: list,
208
+ messages: List[ChatMessageLlama],
207
209
  model: str = "gpt-4"
208
210
  ) -> int:
209
211
  """
@@ -0,0 +1,105 @@
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: 2024.12.14 19:00:00 #
10
+ # ================================================== #
11
+
12
+ from typing import Optional, List, Dict
13
+
14
+ from pygpt_net.provider.web.base import BaseProvider
15
+
16
+ from .helpers import Helpers
17
+
18
+
19
+ class Web:
20
+
21
+ PROVIDER_SEARCH_ENGINE = "search_engine"
22
+
23
+ def __init__(self, window=None):
24
+ """
25
+ Web core
26
+
27
+ :param window: Window instance
28
+ """
29
+ self.window = window
30
+ self.helpers = Helpers(window)
31
+ self.providers = {
32
+ self.PROVIDER_SEARCH_ENGINE: {},
33
+ }
34
+
35
+ def is_registered(
36
+ self,
37
+ id: str,
38
+ type: str = PROVIDER_SEARCH_ENGINE
39
+ ) -> bool:
40
+ """
41
+ Check if provider is registered
42
+
43
+ :param id: provider id
44
+ :param type: provider type
45
+ :return: True if registered
46
+ """
47
+ if type in self.providers:
48
+ return id in self.providers[type]
49
+ return False
50
+
51
+ def get_providers(
52
+ self,
53
+ type: str = PROVIDER_SEARCH_ENGINE
54
+ ) -> Dict[str, BaseProvider]:
55
+ """
56
+ Get all providers
57
+
58
+ :param type: provider type
59
+ :return: providers dict
60
+ """
61
+ if type in self.providers:
62
+ return self.providers[type]
63
+ return {}
64
+
65
+ def get_ids(
66
+ self,
67
+ type: str = PROVIDER_SEARCH_ENGINE
68
+ ) -> List[str]:
69
+ """
70
+ Get all providers ids
71
+
72
+ :param type: provider type
73
+ :return: providers ids list
74
+ """
75
+ if type in self.providers:
76
+ return list(self.providers[type].keys())
77
+ return []
78
+
79
+ def get(
80
+ self,
81
+ id: str,
82
+ type: str = PROVIDER_SEARCH_ENGINE
83
+ ) -> Optional[BaseProvider]:
84
+ """
85
+ Get provider instance
86
+
87
+ :param id: provider id
88
+ :param type: provider type
89
+ :return: provider instance
90
+ """
91
+ if self.is_registered(id, type):
92
+ return self.providers[type][id]
93
+ return None
94
+
95
+ def register(self, provider: BaseProvider):
96
+ """
97
+ Register provider
98
+
99
+ :param provider: provider instance
100
+ """
101
+ id = provider.id
102
+ type = provider.type
103
+ for t in type:
104
+ if t in self.providers:
105
+ self.providers[t][id] = provider
@@ -6,90 +6,116 @@
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: 2024.12.15 01:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  import os
13
13
  import uuid
14
- from typing import Optional, List, Dict
14
+ from typing import Optional, List, Dict, Tuple, Union
15
15
 
16
16
  import requests
17
17
 
18
18
  from bs4 import BeautifulSoup
19
19
  from urllib.parse import urljoin
20
20
 
21
- from pygpt_net.provider.web.base import BaseProvider
22
21
 
23
-
24
- class Web:
22
+ class Helpers:
25
23
  def __init__(self, window=None):
26
24
  """
27
- Web access core
25
+ Web helpers core
28
26
 
29
27
  :param window: Window instance
30
28
  """
31
29
  self.window = window
32
- self.providers = {
33
- "search_engine": {},
34
- }
35
-
36
- def is_registered(self, id: str, type: str = "search_engine") -> bool:
37
- """
38
- Check if provider is registered
39
-
40
- :param id: provider id
41
- :param type: provider type
42
- :return: True if registered
43
- """
44
- if type in self.providers:
45
- return id in self.providers[type]
46
- return False
47
-
48
- def get_providers(self, type: str = "search_engine") -> dict:
49
- """
50
- Get all providers
51
-
52
- :param type: provider type
53
- :return: providers dict
54
- """
55
- if type in self.providers:
56
- return self.providers[type]
57
- return {}
58
-
59
- def get_ids(self, type: str = "search_engine") -> list:
60
- """
61
- Get all providers ids
62
30
 
63
- :param type: provider type
64
- :return: providers ids list
65
- """
66
- if type in self.providers:
67
- return list(self.providers[type].keys())
68
- return []
69
-
70
- def get(self, id: str, type: str = "search_engine") -> Optional[BaseProvider]:
71
- """
72
- Get provider instance
73
-
74
- :param id: provider id
75
- :param type: provider type
76
- :return: provider instance
77
- """
78
- if self.is_registered(id, type):
79
- return self.providers[type][id]
80
- return None
81
-
82
- def register(self, provider: BaseProvider):
83
- """
84
- Register provider
85
-
86
- :param provider: provider instance
87
- """
88
- id = provider.id
89
- type = provider.type
90
- for t in type:
91
- if t in self.providers:
92
- self.providers[t][id] = provider
31
+ def request(
32
+ self,
33
+ url: str = "",
34
+ method: str = "GET",
35
+ headers: Optional[dict] = None,
36
+ params: Optional[dict] = None,
37
+ data: Optional[Union[str, dict]] = None,
38
+ json: Optional[dict] = None,
39
+ files: Optional[dict] = None,
40
+ cookies: Optional[dict] = None,
41
+ timeout: int = 10,
42
+ disable_ssl_verify: bool = False,
43
+ allow_redirects: bool = True,
44
+ stream: bool = False,
45
+ user_agent: Optional[str] = None,
46
+ ) -> Tuple[Optional[int], Optional[str]]:
47
+ """
48
+ Make HTTP request
49
+
50
+ :param url: URL
51
+ :param method: HTTP method
52
+ :param headers: Headers
53
+ :param params: GET parameters
54
+ :param data: POST data
55
+ :param json: JSON data
56
+ :param files: Files
57
+ :param cookies: Cookies
58
+ :param timeout: Timeout
59
+ :param disable_ssl_verify: Disable SSL verification
60
+ :param allow_redirects: Allow redirects
61
+ :param stream: Stream
62
+ :param user_agent: User agent
63
+ :return: status code, response text
64
+ """
65
+ upload = {}
66
+ try:
67
+ method = method.upper()
68
+ session = requests.Session()
69
+ args = {}
70
+
71
+ if data:
72
+ args['data'] = data
73
+ if json:
74
+ args['json'] = json
75
+ if cookies:
76
+ args['cookies'] = cookies
77
+ if params:
78
+ args['params'] = params
79
+ if headers:
80
+ args['headers'] = headers
81
+
82
+ args['timeout'] = timeout
83
+ if disable_ssl_verify:
84
+ args['verify'] = False
85
+ if not allow_redirects:
86
+ args['allow_redirects'] = False
87
+ if stream:
88
+ args['stream'] = True
89
+ if user_agent:
90
+ if 'headers' not in args:
91
+ args['headers'] = {}
92
+ args['headers']['User-Agent'] = user_agent
93
+
94
+ if files:
95
+ for key, value in files.items():
96
+ if os.path.exists(value) and os.path.isfile(value):
97
+ upload[key] = open(value, 'rb')
98
+ args['files'] = upload
99
+
100
+ if method == 'GET':
101
+ response = session.get(url, **args)
102
+ elif method == 'POST':
103
+ response = session.post(url, **args)
104
+ elif method == 'PUT':
105
+ response = session.put(url, **args)
106
+ elif method == 'DELETE':
107
+ response = session.delete(url, **args)
108
+ elif method == 'PATCH':
109
+ response = session.patch(url, **args)
110
+ else:
111
+ return None, f'Invalid HTTP method: {method}'
112
+ for k in upload:
113
+ upload[k].close() # close files if opened
114
+ return response.status_code, response.text
115
+ except Exception as e:
116
+ for k in upload:
117
+ upload[k].close() # close files if opened
118
+ return None, f'Error: {e}'
93
119
 
94
120
  def get_main_image(self, url: str) -> Optional[str]:
95
121
  """
@@ -208,4 +234,4 @@ class Web:
208
234
  download_path = os.path.join(dir, name)
209
235
  with open(download_path, 'wb', ) as f:
210
236
  f.write(response.content)
211
- return self.window.core.filesystem.make_local(download_path)
237
+ return self.window.core.filesystem.make_local(download_path)
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "__meta__": {
3
- "version": "2.4.41",
4
- "app.version": "2.4.41",
5
- "updated_at": "2024-12-14T00:00:00"
3
+ "version": "2.4.43",
4
+ "app.version": "2.4.43",
5
+ "updated_at": "2024-12-15T00:00:00"
6
6
  },
7
7
  "access.audio.event.speech": false,
8
8
  "access.audio.event.speech.disabled": [],
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "__meta__": {
3
- "version": "2.4.41",
4
- "app.version": "2.4.41",
5
- "updated_at": "2024-12-14T00:00:00"
3
+ "version": "2.4.43",
4
+ "app.version": "2.4.43",
5
+ "updated_at": "2024-12-15T00:00:00"
6
6
  },
7
7
  "items": {
8
8
  "claude-3-5-sonnet-20240620": {
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "__meta__": {
3
- "version": "2.4.41",
4
- "app.version": "2.4.41",
5
- "updated_at": "2024-12-13T00:00:00"
3
+ "version": "2.4.43",
4
+ "app.version": "2.4.43",
5
+ "updated_at": "2024-12-15T00:00:00"
6
6
  },
7
7
  "items": {
8
8
  "chat": {
@@ -683,6 +683,7 @@ menu.audio.control.global = Voice control (global)
683
683
  menu.audio.control.plugin = Voice control (inline)
684
684
  menu.audio.input = Input: Speech recognition
685
685
  menu.audio.output = Output: Speech synthesis
686
+ menu.audio.stop = Stop audio playback
686
687
  menu.config = Config
687
688
  menu.config.access = Accessibility
688
689
  menu.config.change_dir = Change working directory...
@@ -17,6 +17,8 @@ cmd.web_index_query.description = Enable `web_index_query` command execution.\nI
17
17
  cmd.web_index_query.label = Enable: quick query the Web and external content
18
18
  cmd.web_index_query.tooltip = Example prompt: Query the Website http://example.com about (question).
19
19
  cmd.web_index.tooltip = Example prompt: Index the Website http://example.com.
20
+ cmd.web_request.description = Enable `web_request` command execution.\nIf enabled, model will be able to send any HTTP request to specified URL or API endpoint.
21
+ cmd.web_request.label = Enable: sending any HTTP requests
20
22
  cmd.web_search.description = Enable `web_search` command execution.\nIf enabled, the model will be able to search the Web.
21
23
  cmd.web_search.label = Enable: search the Web
22
24
  cmd.web_search.tooltip = Example prompt: Search the Web for (question).
@@ -0,0 +1,21 @@
1
+ [LOCALE]
2
+ cmd.send_mail.label = Enable: send email
3
+ cmd.send_mail.description = Allows for sending emails.
4
+ cmd.receive_emails.label = Enable: receive emails
5
+ cmd.receive_emails.description = Allows for receiving emails.
6
+ cmd.get_email_body.label = Enable: get email body
7
+ cmd.get_email_body.description = Allows for receive email body.
8
+ plugin.description = Provides the ability to send, receive and read emails.
9
+ plugin.name = Mailer
10
+ smtp_host.description = SMTP Host, e.g. smtp.domain.com
11
+ smtp_host.label = Host
12
+ smtp_port_inbox.description = SMTP Port (Inbox), default: 995
13
+ smtp_port_inbox.label = Port (Inbox)
14
+ smtp_port_outbox.description = SMTP Port (Outbox), default: 465
15
+ smtp_port_outbox.label = Port (Outbox)
16
+ smtp_user.description = SMTP User, e.g. user@domain.com
17
+ smtp_user.label = User
18
+ smtp_password.description = SMTP Password
19
+ smtp_password.label = Password
20
+ from_email.description = From (email), e.g. me@domain.com
21
+ from_email.label = From (email)
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: 2024.12.13 19:00:00 #
9
+ # Updated Date: 2024.12.14 18:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  import copy
@@ -20,7 +20,7 @@ class CtxItem:
20
20
  """
21
21
  Context item
22
22
 
23
- :param mode: Mode (completion, chat, img, vision, langchain, assistant, llama_index, agent)
23
+ :param mode: Mode (completion, chat, img, vision, langchain, assistant, llama_index, agent, expert)
24
24
  """
25
25
  self.id = None
26
26
  self.meta = None # CtxMeta object
@@ -137,6 +137,17 @@ class CtxItem:
137
137
  """
138
138
  return len(self.cmds) > 0 or len(self.tool_calls) > 0
139
139
 
140
+ def audio_read_allowed(self) -> bool:
141
+ """
142
+ Check if audio read allowed
143
+
144
+ :return: True if audio read allowed
145
+ """
146
+ allowed = True
147
+ if self.has_commands() or '~###~{"cmd":' in self.output:
148
+ allowed = False
149
+ return allowed
150
+
140
151
  def add_doc_meta(self, meta: dict):
141
152
  """
142
153
  Add document meta
@@ -351,18 +362,65 @@ class CtxMeta:
351
362
  self.label = 0 # label color
352
363
  self.indexes = {} # indexes data
353
364
  self.additional_ctx = [] # additional context data
365
+ self.group = None # parent group
354
366
  self.group_id = None
355
367
  self.root_id = None
356
368
  self.parent_id = None
357
369
  self.owner_uuid = None
358
370
 
371
+ def has_additional_ctx(self) -> bool:
372
+ """
373
+ Check if additional context data is attached
374
+
375
+ :return: True if additional context data is present
376
+ """
377
+ if self.additional_ctx is not None and len(self.additional_ctx) > 0:
378
+ return True
379
+ if self.group:
380
+ if self.group.additional_ctx is not None and len(self.group.additional_ctx) > 0:
381
+ return True
382
+ return False
383
+
384
+ def get_additional_ctx(self) -> list:
385
+ """
386
+ Get additional context data
387
+
388
+ :return: list
389
+ """
390
+ if self.group:
391
+ if self.group.additional_ctx:
392
+ return self.group.additional_ctx
393
+ if self.additional_ctx:
394
+ return self.additional_ctx
395
+ return []
396
+
397
+ def reset_additional_ctx(self):
398
+ """Delete additional context data"""
399
+ if self.group:
400
+ self.group.additional_ctx = []
401
+ else:
402
+ self.additional_ctx = []
403
+
404
+ def remove_additional_ctx(self, item: dict):
405
+ """
406
+ Remove additional context data item
407
+
408
+ :param item: dict
409
+ """
410
+ if self.group:
411
+ if item in self.group.additional_ctx:
412
+ self.group.additional_ctx.remove(item)
413
+ else:
414
+ if item in self.additional_ctx:
415
+ self.additional_ctx.remove(item)
416
+
359
417
  def to_dict(self) -> dict:
360
418
  """
361
419
  Dump context meta to dict
362
420
 
363
421
  :return: dict
364
422
  """
365
- return {
423
+ data = {
366
424
  "id": self.id,
367
425
  "external_id": self.external_id,
368
426
  "uuid": self.uuid,
@@ -393,6 +451,9 @@ class CtxMeta:
393
451
  "parent_id": self.parent_id,
394
452
  "owner_uuid": self.owner_uuid,
395
453
  }
454
+ if self.group:
455
+ data["__group__"] = self.group.to_dict()
456
+ return data
396
457
 
397
458
  def from_dict(self, data: dict):
398
459
  """
@@ -447,6 +508,7 @@ class CtxGroup:
447
508
  self.items = []
448
509
  self.created = int(time.time())
449
510
  self.updated = int(time.time())
511
+ self.additional_ctx = []
450
512
  self.count = 0
451
513
 
452
514
  def to_dict(self) -> dict:
@@ -460,6 +522,7 @@ class CtxGroup:
460
522
  "uuid": self.uuid,
461
523
  "name": self.name,
462
524
  "items": self.items,
525
+ "additional_ctx": self.additional_ctx,
463
526
  "created": self.created,
464
527
  "updated": self.updated,
465
528
  "count": self.count,
@@ -0,0 +1,25 @@
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: 2024.11.23 00:00:00 #
10
+ # ================================================== #
11
+
12
+ from sqlalchemy import text
13
+
14
+ from .base import BaseMigration
15
+
16
+
17
+ class Version20241215110000(BaseMigration):
18
+ def __init__(self, window=None):
19
+ super(Version20241215110000, self).__init__(window)
20
+ self.window = window
21
+
22
+ def up(self, conn):
23
+ conn.execute(text("""
24
+ ALTER TABLE ctx_group ADD COLUMN additional_ctx_json TEXT;
25
+ """))
@@ -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: 2024.12.15 11:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from .Version20231227152900 import Version20231227152900 # 2.0.59
@@ -22,6 +22,7 @@ from .Version20240426050000 import Version20240426050000 # 2.1.79
22
22
  from .Version20240501030000 import Version20240501030000 # 2.2.7
23
23
  from .Version20241122130000 import Version20241122130000 # 2.4.21
24
24
  from .Version20241126170000 import Version20241126170000 # 2.4.34
25
+ from .Version20241215110000 import Version20241215110000 # 2.4.43
25
26
 
26
27
  class Migrations:
27
28
  def __init__(self):
@@ -48,4 +49,5 @@ class Migrations:
48
49
  Version20240501030000(), # 2.2.7
49
50
  Version20241122130000(), # 2.4.21
50
51
  Version20241126170000(), # 2.4.34
52
+ Version20241215110000(), # 2.4.43
51
53
  ]