pygpt-net 2.6.0.post2__py3-none-any.whl → 2.6.2__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 +8 -0
- pygpt_net/__init__.py +3 -3
- pygpt_net/app.py +27 -9
- pygpt_net/controller/chat/response.py +10 -4
- pygpt_net/controller/chat/stream.py +40 -2
- pygpt_net/controller/model/editor.py +45 -4
- pygpt_net/controller/plugins/plugins.py +25 -0
- pygpt_net/controller/presets/editor.py +100 -100
- pygpt_net/controller/presets/experts.py +20 -1
- pygpt_net/controller/presets/presets.py +5 -4
- pygpt_net/controller/ui/mode.py +17 -66
- pygpt_net/core/agents/provider.py +2 -1
- pygpt_net/core/agents/runner.py +123 -9
- pygpt_net/core/agents/runners/helpers.py +3 -2
- pygpt_net/core/agents/runners/llama_workflow.py +176 -22
- pygpt_net/core/agents/runners/loop.py +22 -13
- pygpt_net/core/experts/experts.py +19 -25
- pygpt_net/core/idx/chat.py +24 -34
- pygpt_net/core/idx/response.py +5 -2
- pygpt_net/core/locale/locale.py +73 -45
- pygpt_net/core/render/web/body.py +152 -207
- pygpt_net/core/render/web/renderer.py +4 -2
- pygpt_net/data/config/config.json +3 -3
- pygpt_net/data/config/models.json +3 -3
- pygpt_net/data/locale/locale.de.ini +12 -8
- pygpt_net/data/locale/locale.en.ini +12 -8
- pygpt_net/data/locale/locale.es.ini +12 -8
- pygpt_net/data/locale/locale.fr.ini +12 -8
- pygpt_net/data/locale/locale.it.ini +12 -8
- pygpt_net/data/locale/locale.pl.ini +12 -8
- pygpt_net/data/locale/locale.uk.ini +12 -8
- pygpt_net/data/locale/locale.zh.ini +12 -8
- pygpt_net/item/ctx.py +2 -1
- pygpt_net/plugin/base/plugin.py +35 -3
- pygpt_net/plugin/bitbucket/__init__.py +12 -0
- pygpt_net/plugin/bitbucket/config.py +267 -0
- pygpt_net/plugin/bitbucket/plugin.py +125 -0
- pygpt_net/plugin/bitbucket/worker.py +569 -0
- pygpt_net/plugin/cmd_files/worker.py +19 -16
- pygpt_net/plugin/facebook/__init__.py +12 -0
- pygpt_net/plugin/facebook/config.py +359 -0
- pygpt_net/plugin/facebook/plugin.py +114 -0
- pygpt_net/plugin/facebook/worker.py +698 -0
- pygpt_net/plugin/github/__init__.py +12 -0
- pygpt_net/plugin/github/config.py +441 -0
- pygpt_net/plugin/github/plugin.py +124 -0
- pygpt_net/plugin/github/worker.py +674 -0
- pygpt_net/plugin/google/__init__.py +12 -0
- pygpt_net/plugin/google/config.py +367 -0
- pygpt_net/plugin/google/plugin.py +126 -0
- pygpt_net/plugin/google/worker.py +826 -0
- pygpt_net/plugin/slack/__init__.py +12 -0
- pygpt_net/plugin/slack/config.py +349 -0
- pygpt_net/plugin/slack/plugin.py +116 -0
- pygpt_net/plugin/slack/worker.py +639 -0
- pygpt_net/plugin/telegram/__init__.py +12 -0
- pygpt_net/plugin/telegram/config.py +308 -0
- pygpt_net/plugin/telegram/plugin.py +118 -0
- pygpt_net/plugin/telegram/worker.py +563 -0
- pygpt_net/plugin/twitter/__init__.py +12 -0
- pygpt_net/plugin/twitter/config.py +491 -0
- pygpt_net/plugin/twitter/plugin.py +126 -0
- pygpt_net/plugin/twitter/worker.py +837 -0
- pygpt_net/provider/agents/base.py +4 -1
- pygpt_net/provider/agents/llama_index/codeact_workflow.py +95 -0
- pygpt_net/provider/agents/llama_index/legacy/__init__.py +0 -0
- pygpt_net/provider/agents/llama_index/{openai.py → legacy/openai.py} +2 -2
- pygpt_net/provider/agents/llama_index/{openai_assistant.py → legacy/openai_assistant.py} +37 -5
- pygpt_net/provider/agents/llama_index/{planner.py → legacy/planner.py} +3 -3
- pygpt_net/provider/agents/llama_index/{react.py → legacy/react.py} +3 -3
- pygpt_net/provider/agents/llama_index/openai_workflow.py +52 -0
- pygpt_net/provider/agents/llama_index/planner_workflow.py +115 -0
- pygpt_net/provider/agents/llama_index/react_workflow.py +6 -4
- pygpt_net/provider/agents/llama_index/workflow/__init__.py +0 -0
- pygpt_net/provider/agents/llama_index/{codeact_agent_custom.py → workflow/codeact.py} +124 -8
- pygpt_net/provider/agents/llama_index/workflow/events.py +24 -0
- pygpt_net/provider/agents/llama_index/workflow/openai.py +634 -0
- pygpt_net/provider/agents/llama_index/workflow/planner.py +601 -0
- pygpt_net/provider/agents/openai/agent.py +1 -0
- pygpt_net/provider/agents/openai/agent_b2b.py +2 -0
- pygpt_net/provider/agents/openai/agent_planner.py +1 -0
- pygpt_net/provider/agents/openai/agent_with_experts.py +1 -0
- pygpt_net/provider/agents/openai/agent_with_experts_feedback.py +1 -0
- pygpt_net/provider/agents/openai/agent_with_feedback.py +1 -0
- pygpt_net/provider/agents/openai/evolve.py +1 -0
- pygpt_net/provider/core/preset/patch.py +11 -17
- pygpt_net/ui/base/config_dialog.py +4 -0
- pygpt_net/ui/dialog/preset.py +34 -77
- pygpt_net/ui/layout/toolbox/presets.py +2 -2
- pygpt_net/ui/main.py +3 -1
- pygpt_net/ui/widget/lists/experts.py +3 -2
- {pygpt_net-2.6.0.post2.dist-info → pygpt_net-2.6.2.dist-info}/METADATA +155 -4
- {pygpt_net-2.6.0.post2.dist-info → pygpt_net-2.6.2.dist-info}/RECORD +96 -62
- pygpt_net/data/config/presets/agent_react_workflow.json +0 -34
- pygpt_net/provider/agents/llama_index/code_act.py +0 -58
- {pygpt_net-2.6.0.post2.dist-info → pygpt_net-2.6.2.dist-info}/LICENSE +0 -0
- {pygpt_net-2.6.0.post2.dist-info → pygpt_net-2.6.2.dist-info}/WHEEL +0 -0
- {pygpt_net-2.6.0.post2.dist-info → pygpt_net-2.6.2.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,267 @@
|
|
|
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.08.15 00:00:00 #
|
|
10
|
+
# ================================================== #
|
|
11
|
+
|
|
12
|
+
from pygpt_net.plugin.base.config import BaseConfig, BasePlugin
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class Config(BaseConfig):
|
|
16
|
+
def __init__(self, plugin: BasePlugin = None, *args, **kwargs):
|
|
17
|
+
super(Config, self).__init__(plugin)
|
|
18
|
+
self.plugin = plugin
|
|
19
|
+
|
|
20
|
+
def from_defaults(self, plugin: BasePlugin = None):
|
|
21
|
+
# HTTP / Endpoints
|
|
22
|
+
plugin.add_option("api_base", type="text", value="https://api.bitbucket.org/2.0",
|
|
23
|
+
label="API base", description="Bitbucket Cloud API 2.0 base URL.")
|
|
24
|
+
plugin.add_option("http_timeout", type="int", value=30,
|
|
25
|
+
label="HTTP timeout (s)", description="Requests timeout in seconds.")
|
|
26
|
+
|
|
27
|
+
# Auth options
|
|
28
|
+
plugin.add_option("auth_mode", type="combo", value="auto",
|
|
29
|
+
label="Auth mode", description="auto|basic|bearer", keys=["auto", "basic", "bearer"],)
|
|
30
|
+
plugin.add_option("bb_username", type="text", value="",
|
|
31
|
+
label="Username", description="Bitbucket username (handle, not email).")
|
|
32
|
+
plugin.add_option("bb_app_password", type="textarea", value="",
|
|
33
|
+
label="App Password", description="Bitbucket App Password (Basic).", secret=True)
|
|
34
|
+
plugin.add_option("bb_access_token", type="textarea", value="",
|
|
35
|
+
label="Bearer token", description="OAuth access token (Bearer).", secret=True)
|
|
36
|
+
|
|
37
|
+
# Cached convenience
|
|
38
|
+
plugin.add_option("user_uuid", type="text", value="", label="(auto) User UUID", description="Cached after bb_me.")
|
|
39
|
+
plugin.add_option("username", type="text", value="", label="(auto) Username", description="Cached after bb_me.")
|
|
40
|
+
|
|
41
|
+
# ---------------- Commands ----------------
|
|
42
|
+
|
|
43
|
+
# Auth
|
|
44
|
+
plugin.add_cmd("bb_auth_set_mode",
|
|
45
|
+
instruction="Set auth mode: auto|basic|bearer.",
|
|
46
|
+
params=[{"name": "mode", "type": "str", "required": True, "description": "auto|basic|bearer"}],
|
|
47
|
+
enabled=True, description="Auth: set mode", tab="auth")
|
|
48
|
+
|
|
49
|
+
plugin.add_cmd("bb_set_app_password",
|
|
50
|
+
instruction="Set App Password credentials.",
|
|
51
|
+
params=[
|
|
52
|
+
{"name": "username", "type": "str", "required": True, "description": "Bitbucket username"},
|
|
53
|
+
{"name": "app_password", "type": "str", "required": True, "description": "App password"},
|
|
54
|
+
{"name": "set_mode", "type": "bool", "required": False, "description": "Switch to basic"},
|
|
55
|
+
],
|
|
56
|
+
enabled=True, description="Auth: set App Password", tab="auth")
|
|
57
|
+
|
|
58
|
+
plugin.add_cmd("bb_set_bearer",
|
|
59
|
+
instruction="Set Bearer token.",
|
|
60
|
+
params=[
|
|
61
|
+
{"name": "access_token", "type": "str", "required": True, "description": "OAuth access token"},
|
|
62
|
+
{"name": "set_mode", "type": "bool", "required": False, "description": "Switch to bearer"},
|
|
63
|
+
],
|
|
64
|
+
enabled=True, description="Auth: set Bearer", tab="auth")
|
|
65
|
+
|
|
66
|
+
plugin.add_cmd("bb_auth_check",
|
|
67
|
+
instruction="Diagnostics: show auth result for /user.",
|
|
68
|
+
params=[],
|
|
69
|
+
enabled=True, description="Auth: check", tab="auth")
|
|
70
|
+
|
|
71
|
+
# Users / Workspaces
|
|
72
|
+
plugin.add_cmd("bb_me",
|
|
73
|
+
instruction="Get authenticated user.",
|
|
74
|
+
params=[], enabled=True, description="Users: me", tab="users")
|
|
75
|
+
|
|
76
|
+
plugin.add_cmd("bb_user_get",
|
|
77
|
+
instruction="Get user by username.",
|
|
78
|
+
params=[{"name": "username", "type": "str", "required": True, "description": "Bitbucket username"}],
|
|
79
|
+
enabled=True, description="Users: get", tab="users")
|
|
80
|
+
|
|
81
|
+
plugin.add_cmd("bb_workspaces_list",
|
|
82
|
+
instruction="List accessible workspaces.",
|
|
83
|
+
params=[
|
|
84
|
+
{"name": "page", "type": "int", "required": False, "description": "Page"},
|
|
85
|
+
{"name": "pagelen", "type": "int", "required": False, "description": "Items per page"},
|
|
86
|
+
],
|
|
87
|
+
enabled=True, description="Workspaces: list", tab="users")
|
|
88
|
+
|
|
89
|
+
# Repos
|
|
90
|
+
plugin.add_cmd("bb_repos_list",
|
|
91
|
+
instruction="List repositories.",
|
|
92
|
+
params=[
|
|
93
|
+
{"name": "workspace", "type": "str", "required": False, "description": "Workspace id"},
|
|
94
|
+
{"name": "role", "type": "str", "required": False, "description": "owner|contributor|member"},
|
|
95
|
+
{"name": "q", "type": "str", "required": False, "description": "BBQL filter"},
|
|
96
|
+
{"name": "sort", "type": "str", "required": False, "description": "Sort expression"},
|
|
97
|
+
{"name": "page", "type": "int", "required": False, "description": "Page"},
|
|
98
|
+
{"name": "pagelen", "type": "int", "required": False, "description": "Items per page"},
|
|
99
|
+
{"name": "after", "type": "str", "required": False, "description": "Cursor"},
|
|
100
|
+
],
|
|
101
|
+
enabled=True, description="Repos: list", tab="repos")
|
|
102
|
+
|
|
103
|
+
plugin.add_cmd("bb_repo_get",
|
|
104
|
+
instruction="Get repository details.",
|
|
105
|
+
params=[
|
|
106
|
+
{"name": "workspace", "type": "str", "required": True, "description": "Workspace id"},
|
|
107
|
+
{"name": "repo", "type": "str", "required": True, "description": "Repo slug"},
|
|
108
|
+
],
|
|
109
|
+
enabled=True, description="Repos: get", tab="repos")
|
|
110
|
+
|
|
111
|
+
plugin.add_cmd("bb_repo_create",
|
|
112
|
+
instruction="Create repository.",
|
|
113
|
+
params=[
|
|
114
|
+
{"name": "workspace", "type": "str", "required": True, "description": "Workspace id"},
|
|
115
|
+
{"name": "repo", "type": "str", "required": True, "description": "Repo slug"},
|
|
116
|
+
{"name": "description", "type": "str", "required": False, "description": "Description"},
|
|
117
|
+
{"name": "is_private", "type": "bool", "required": False, "description": "Default True"},
|
|
118
|
+
{"name": "scm", "type": "str", "required": False, "description": "git"},
|
|
119
|
+
{"name": "project_key", "type": "str", "required": False, "description": "Project key"},
|
|
120
|
+
],
|
|
121
|
+
enabled=True, description="Repos: create", tab="repos")
|
|
122
|
+
|
|
123
|
+
plugin.add_cmd("bb_repo_delete",
|
|
124
|
+
instruction="Delete repository.",
|
|
125
|
+
params=[
|
|
126
|
+
{"name": "workspace", "type": "str", "required": True, "description": "Workspace id"},
|
|
127
|
+
{"name": "repo", "type": "str", "required": True, "description": "Repo slug"},
|
|
128
|
+
{"name": "confirm", "type": "bool", "required": False, "description": "Must be true"},
|
|
129
|
+
],
|
|
130
|
+
enabled=False, description="Repos: delete", tab="repos")
|
|
131
|
+
|
|
132
|
+
# Contents
|
|
133
|
+
plugin.add_cmd("bb_contents_get",
|
|
134
|
+
instruction="Get file or list directory contents.",
|
|
135
|
+
params=[
|
|
136
|
+
{"name": "workspace", "type": "str", "required": True, "description": "Workspace id"},
|
|
137
|
+
{"name": "repo", "type": "str", "required": True, "description": "Repo slug"},
|
|
138
|
+
{"name": "path", "type": "str", "required": False, "description": "Path inside repo"},
|
|
139
|
+
{"name": "ref", "type": "str", "required": False, "description": "Branch/tag/commit"},
|
|
140
|
+
{"name": "format", "type": "str", "required": False, "description": "meta|rendered"},
|
|
141
|
+
{"name": "q", "type": "str", "required": False, "description": "Filter (BBQL)"},
|
|
142
|
+
{"name": "sort", "type": "str", "required": False, "description": "Sort"},
|
|
143
|
+
{"name": "max_depth", "type": "int", "required": False, "description": "Depth"},
|
|
144
|
+
],
|
|
145
|
+
enabled=True, description="Contents: get", tab="contents")
|
|
146
|
+
|
|
147
|
+
plugin.add_cmd("bb_file_put",
|
|
148
|
+
instruction="Create or update a file (POST /src).",
|
|
149
|
+
params=[
|
|
150
|
+
{"name": "workspace", "type": "str", "required": True, "description": "Workspace"},
|
|
151
|
+
{"name": "repo", "type": "str", "required": True, "description": "Repo"},
|
|
152
|
+
{"name": "path", "type": "str", "required": True, "description": "Remote path"},
|
|
153
|
+
{"name": "message", "type": "str", "required": False, "description": "Commit message"},
|
|
154
|
+
{"name": "content", "type": "str", "required": False, "description": "Raw text content"},
|
|
155
|
+
{"name": "local_path", "type": "str", "required": False, "description": "Local file to upload"},
|
|
156
|
+
{"name": "branch", "type": "str", "required": False, "description": "Branch"},
|
|
157
|
+
{"name": "parents", "type": "str", "required": False, "description": "Parent commit SHA1"},
|
|
158
|
+
],
|
|
159
|
+
enabled=True, description="Contents: put file", tab="contents")
|
|
160
|
+
|
|
161
|
+
plugin.add_cmd("bb_file_delete",
|
|
162
|
+
instruction="Delete file(s) (POST /src with files=...).",
|
|
163
|
+
params=[
|
|
164
|
+
{"name": "workspace", "type": "str", "required": True, "description": "Workspace"},
|
|
165
|
+
{"name": "repo", "type": "str", "required": True, "description": "Repo"},
|
|
166
|
+
{"name": "paths", "type": "list", "required": True, "description": "List of paths to delete"},
|
|
167
|
+
{"name": "message", "type": "str", "required": False, "description": "Commit message"},
|
|
168
|
+
{"name": "branch", "type": "str", "required": False, "description": "Branch"},
|
|
169
|
+
{"name": "parents", "type": "str", "required": False, "description": "Parent SHA1"},
|
|
170
|
+
],
|
|
171
|
+
enabled=True, description="Contents: delete files", tab="contents")
|
|
172
|
+
|
|
173
|
+
# Issues
|
|
174
|
+
plugin.add_cmd("bb_issues_list",
|
|
175
|
+
instruction="List repository issues.",
|
|
176
|
+
params=[
|
|
177
|
+
{"name": "workspace", "type": "str", "required": True, "description": "Workspace"},
|
|
178
|
+
{"name": "repo", "type": "str", "required": True, "description": "Repo"},
|
|
179
|
+
{"name": "q", "type": "str", "required": False, "description": "BBQL filter"},
|
|
180
|
+
{"name": "state", "type": "str", "required": False, "description": "open|resolved|closed|..."},
|
|
181
|
+
{"name": "sort", "type": "str", "required": False, "description": "Sort"},
|
|
182
|
+
{"name": "page", "type": "int", "required": False, "description": "Page"},
|
|
183
|
+
{"name": "pagelen", "type": "int", "required": False, "description": "Items per page"},
|
|
184
|
+
],
|
|
185
|
+
enabled=True, description="Issues: list", tab="issues")
|
|
186
|
+
|
|
187
|
+
plugin.add_cmd("bb_issue_create",
|
|
188
|
+
instruction="Create an issue.",
|
|
189
|
+
params=[
|
|
190
|
+
{"name": "workspace", "type": "str", "required": True, "description": "Workspace"},
|
|
191
|
+
{"name": "repo", "type": "str", "required": True, "description": "Repo"},
|
|
192
|
+
{"name": "title", "type": "str", "required": True, "description": "Title"},
|
|
193
|
+
{"name": "content", "type": "str", "required": False, "description": "Body"},
|
|
194
|
+
{"name": "assignee", "type": "str", "required": False, "description": "Assignee username"},
|
|
195
|
+
],
|
|
196
|
+
enabled=True, description="Issues: create", tab="issues")
|
|
197
|
+
|
|
198
|
+
plugin.add_cmd("bb_issue_comment",
|
|
199
|
+
instruction="Comment on an issue.",
|
|
200
|
+
params=[
|
|
201
|
+
{"name": "workspace", "type": "str", "required": True, "description": "Workspace"},
|
|
202
|
+
{"name": "repo", "type": "str", "required": True, "description": "Repo"},
|
|
203
|
+
{"name": "id", "type": "int", "required": True, "description": "Issue id"},
|
|
204
|
+
{"name": "content", "type": "str", "required": True, "description": "Comment body"},
|
|
205
|
+
],
|
|
206
|
+
enabled=True, description="Issues: comment", tab="issues")
|
|
207
|
+
|
|
208
|
+
plugin.add_cmd("bb_issue_update",
|
|
209
|
+
instruction="Update an issue.",
|
|
210
|
+
params=[
|
|
211
|
+
{"name": "workspace", "type": "str", "required": True, "description": "Workspace"},
|
|
212
|
+
{"name": "repo", "type": "str", "required": True, "description": "Repo"},
|
|
213
|
+
{"name": "id", "type": "int", "required": True, "description": "Issue id"},
|
|
214
|
+
{"name": "state", "type": "str", "required": False, "description": "open|resolved|closed|..."},
|
|
215
|
+
{"name": "title", "type": "str", "required": False, "description": "New title"},
|
|
216
|
+
{"name": "content", "type": "str", "required": False, "description": "New body"},
|
|
217
|
+
],
|
|
218
|
+
enabled=True, description="Issues: update", tab="issues")
|
|
219
|
+
|
|
220
|
+
# Pull requests
|
|
221
|
+
plugin.add_cmd("bb_prs_list",
|
|
222
|
+
instruction="List pull requests.",
|
|
223
|
+
params=[
|
|
224
|
+
{"name": "workspace", "type": "str", "required": True, "description": "Workspace"},
|
|
225
|
+
{"name": "repo", "type": "str", "required": True, "description": "Repo"},
|
|
226
|
+
{"name": "state", "type": "str", "required": False, "description": "open|merged|declined|superseded"},
|
|
227
|
+
{"name": "q", "type": "str", "required": False, "description": "BBQL filter"},
|
|
228
|
+
{"name": "sort", "type": "str", "required": False, "description": "Sort"},
|
|
229
|
+
{"name": "page", "type": "int", "required": False, "description": "Page"},
|
|
230
|
+
{"name": "pagelen", "type": "int", "required": False, "description": "Items per page"},
|
|
231
|
+
],
|
|
232
|
+
enabled=True, description="PR: list", tab="pulls")
|
|
233
|
+
|
|
234
|
+
plugin.add_cmd("bb_pr_create",
|
|
235
|
+
instruction="Create a pull request.",
|
|
236
|
+
params=[
|
|
237
|
+
{"name": "workspace", "type": "str", "required": True, "description": "Workspace"},
|
|
238
|
+
{"name": "repo", "type": "str", "required": True, "description": "Repo"},
|
|
239
|
+
{"name": "title", "type": "str", "required": True, "description": "PR title"},
|
|
240
|
+
{"name": "source_branch", "type": "str", "required": True, "description": "Source branch"},
|
|
241
|
+
{"name": "destination_branch", "type": "str", "required": True, "description": "Target branch"},
|
|
242
|
+
{"name": "description", "type": "str", "required": False, "description": "PR description"},
|
|
243
|
+
{"name": "draft", "type": "bool", "required": False, "description": "Draft PR"},
|
|
244
|
+
],
|
|
245
|
+
enabled=True, description="PR: create", tab="pulls")
|
|
246
|
+
|
|
247
|
+
plugin.add_cmd("bb_pr_merge",
|
|
248
|
+
instruction="Merge a pull request.",
|
|
249
|
+
params=[
|
|
250
|
+
{"name": "workspace", "type": "str", "required": True, "description": "Workspace"},
|
|
251
|
+
{"name": "repo", "type": "str", "required": True, "description": "Repo"},
|
|
252
|
+
{"name": "id", "type": "int", "required": True, "description": "PR id"},
|
|
253
|
+
{"name": "message", "type": "str", "required": False, "description": "Commit message"},
|
|
254
|
+
{"name": "close_source_branch", "type": "bool", "required": False, "description": "Close source"},
|
|
255
|
+
],
|
|
256
|
+
enabled=True, description="PR: merge", tab="pulls")
|
|
257
|
+
|
|
258
|
+
# Search
|
|
259
|
+
plugin.add_cmd("bb_search_repos",
|
|
260
|
+
instruction="Search repositories (BBQL via ?q=).",
|
|
261
|
+
params=[
|
|
262
|
+
{"name": "q", "type": "str", "required": False, "description": "Query string (BBQL)"},
|
|
263
|
+
{"name": "sort", "type": "str", "required": False, "description": "Sort expression"},
|
|
264
|
+
{"name": "page", "type": "int", "required": False, "description": "Page"},
|
|
265
|
+
{"name": "pagelen", "type": "int", "required": False, "description": "Items per page"},
|
|
266
|
+
],
|
|
267
|
+
enabled=True, description="Search: repositories", tab="search")
|
|
@@ -0,0 +1,125 @@
|
|
|
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.08.15 00:00:00 #
|
|
10
|
+
# ================================================== #
|
|
11
|
+
|
|
12
|
+
from pygpt_net.plugin.base.plugin import BasePlugin
|
|
13
|
+
from pygpt_net.core.events import Event
|
|
14
|
+
from pygpt_net.item.ctx import CtxItem
|
|
15
|
+
|
|
16
|
+
from .config import Config
|
|
17
|
+
from .worker import Worker
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class Plugin(BasePlugin):
|
|
21
|
+
def __init__(self, *args, **kwargs):
|
|
22
|
+
super(Plugin, self).__init__(*args, **kwargs)
|
|
23
|
+
self.id = "bitbucket"
|
|
24
|
+
self.name = "Bitbucket"
|
|
25
|
+
self.description = "Access Bitbucket API to manage repositories, issues, and pull requests."
|
|
26
|
+
self.prefix = "API"
|
|
27
|
+
self.order = 100
|
|
28
|
+
self.allowed_cmds = [
|
|
29
|
+
"bb_auth_set_mode",
|
|
30
|
+
"bb_set_app_password",
|
|
31
|
+
"bb_set_bearer",
|
|
32
|
+
"bb_auth_check",
|
|
33
|
+
"bb_me",
|
|
34
|
+
"bb_user_get",
|
|
35
|
+
"bb_workspaces_list",
|
|
36
|
+
"bb_repos_list",
|
|
37
|
+
"bb_repo_get",
|
|
38
|
+
"bb_repo_create",
|
|
39
|
+
"bb_repo_delete",
|
|
40
|
+
"bb_contents_get",
|
|
41
|
+
"bb_file_put",
|
|
42
|
+
"bb_file_delete",
|
|
43
|
+
"bb_issues_list",
|
|
44
|
+
"bb_issue_create",
|
|
45
|
+
"bb_issue_comment",
|
|
46
|
+
"bb_issue_update",
|
|
47
|
+
"bb_prs_list",
|
|
48
|
+
"bb_pr_create",
|
|
49
|
+
"bb_pr_merge",
|
|
50
|
+
"bb_search_repos"
|
|
51
|
+
]
|
|
52
|
+
|
|
53
|
+
self.use_locale = False
|
|
54
|
+
self.worker = None
|
|
55
|
+
self.config = Config(self)
|
|
56
|
+
self.init_options()
|
|
57
|
+
|
|
58
|
+
def init_options(self):
|
|
59
|
+
"""Initialize options"""
|
|
60
|
+
self.config.from_defaults(self)
|
|
61
|
+
|
|
62
|
+
def handle(self, event: Event, *args, **kwargs):
|
|
63
|
+
"""
|
|
64
|
+
Handle dispatched event
|
|
65
|
+
|
|
66
|
+
:param event: event object
|
|
67
|
+
:param args: event args
|
|
68
|
+
:param kwargs: event kwargs
|
|
69
|
+
"""
|
|
70
|
+
name = event.name
|
|
71
|
+
data = event.data
|
|
72
|
+
ctx = event.ctx
|
|
73
|
+
|
|
74
|
+
if name == Event.CMD_SYNTAX:
|
|
75
|
+
self.cmd_syntax(data)
|
|
76
|
+
|
|
77
|
+
elif name == Event.CMD_EXECUTE:
|
|
78
|
+
self.cmd(
|
|
79
|
+
ctx,
|
|
80
|
+
data['commands'],
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
def cmd_syntax(self, data: dict):
|
|
84
|
+
"""
|
|
85
|
+
Event: CMD_SYNTAX
|
|
86
|
+
|
|
87
|
+
:param data: event data dict
|
|
88
|
+
"""
|
|
89
|
+
for option in self.allowed_cmds:
|
|
90
|
+
if self.has_cmd(option):
|
|
91
|
+
data['cmd'].append(self.get_cmd(option)) # append command
|
|
92
|
+
|
|
93
|
+
def cmd(self, ctx: CtxItem, cmds: list):
|
|
94
|
+
"""
|
|
95
|
+
Event: CMD_EXECUTE
|
|
96
|
+
|
|
97
|
+
:param ctx: CtxItem
|
|
98
|
+
:param cmds: commands dict
|
|
99
|
+
"""
|
|
100
|
+
is_cmd = False
|
|
101
|
+
my_commands = []
|
|
102
|
+
for item in cmds:
|
|
103
|
+
if item["cmd"] in self.allowed_cmds:
|
|
104
|
+
my_commands.append(item)
|
|
105
|
+
is_cmd = True
|
|
106
|
+
|
|
107
|
+
if not is_cmd:
|
|
108
|
+
return
|
|
109
|
+
|
|
110
|
+
# set state: busy
|
|
111
|
+
self.cmd_prepare(ctx, my_commands)
|
|
112
|
+
|
|
113
|
+
try:
|
|
114
|
+
worker = Worker()
|
|
115
|
+
worker.from_defaults(self)
|
|
116
|
+
worker.cmds = my_commands
|
|
117
|
+
worker.ctx = ctx
|
|
118
|
+
|
|
119
|
+
if not self.is_async(ctx):
|
|
120
|
+
worker.run()
|
|
121
|
+
return
|
|
122
|
+
worker.run_async()
|
|
123
|
+
|
|
124
|
+
except Exception as e:
|
|
125
|
+
self.error(e)
|