arpakitlib 1.8.69__py3-none-any.whl → 1.8.71__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.
- arpakitlib/_arpakit_project_template_v_5/arpakitlib_project_template_info.json +1 -1
- arpakitlib/_arpakit_project_template_v_5/project/api/router/admin/create_operation.py +7 -14
- arpakitlib/_arpakit_project_template_v_5/project/sandbox/sandbox_1.py +3 -2
- arpakitlib/_arpakit_project_template_v_5/project/tg_bot/filter_/prod_mode_filter.py +1 -1
- arpakitlib/_arpakit_project_template_v_5/project/tg_bot/util/notify_admins.py +5 -1
- arpakitlib/ar_openai_api_client_util.py +12 -5
- {arpakitlib-1.8.69.dist-info → arpakitlib-1.8.71.dist-info}/METADATA +1 -1
- {arpakitlib-1.8.69.dist-info → arpakitlib-1.8.71.dist-info}/RECORD +11 -11
- {arpakitlib-1.8.69.dist-info → arpakitlib-1.8.71.dist-info}/LICENSE +0 -0
- {arpakitlib-1.8.69.dist-info → arpakitlib-1.8.71.dist-info}/WHEEL +0 -0
- {arpakitlib-1.8.69.dist-info → arpakitlib-1.8.71.dist-info}/entry_points.txt +0 -0
@@ -3,7 +3,6 @@ from typing import Any
|
|
3
3
|
import fastapi
|
4
4
|
from fastapi import APIRouter
|
5
5
|
|
6
|
-
from arpakitlib.ar_type_util import NotSet, is_set
|
7
6
|
from project.api.authorize import require_api_key_dbm_api_authorize_middleware, \
|
8
7
|
require_user_token_dbm_api_authorize_middleware, APIAuthorizeData, api_authorize
|
9
8
|
from project.api.schema.common import BaseSI
|
@@ -14,10 +13,10 @@ from project.sqlalchemy_db_.sqlalchemy_model import UserDBM, OperationDBM
|
|
14
13
|
|
15
14
|
|
16
15
|
class _CreateOperationAdminSI(BaseSI):
|
17
|
-
slug: str | None =
|
16
|
+
slug: str | None = None
|
18
17
|
type: str
|
19
|
-
title: str | None =
|
20
|
-
input_data: dict[str, Any] =
|
18
|
+
title: str | None = None
|
19
|
+
input_data: dict[str, Any] = None
|
21
20
|
|
22
21
|
|
23
22
|
api_router = APIRouter()
|
@@ -48,23 +47,17 @@ async def _(
|
|
48
47
|
status=OperationDBM.Statuses.waiting_for_execution
|
49
48
|
)
|
50
49
|
|
51
|
-
if
|
50
|
+
if "slug" in create_operation_admin_si.model_fields_set:
|
52
51
|
operation_dbm.slug = create_operation_admin_si.slug
|
53
|
-
else:
|
54
|
-
operation_dbm.slug = None
|
55
52
|
|
56
|
-
if
|
53
|
+
if "type" in create_operation_admin_si.model_fields_set:
|
57
54
|
operation_dbm.type = create_operation_admin_si.type
|
58
55
|
|
59
|
-
if
|
56
|
+
if "title" in create_operation_admin_si.model_fields_set:
|
60
57
|
operation_dbm.title = create_operation_admin_si.title
|
61
|
-
else:
|
62
|
-
operation_dbm.title = None
|
63
58
|
|
64
|
-
if
|
59
|
+
if "input_data" in create_operation_admin_si.model_fields_set:
|
65
60
|
operation_dbm.input_data = create_operation_admin_si.input_data
|
66
|
-
else:
|
67
|
-
operation_dbm.input_data = {}
|
68
61
|
|
69
62
|
async with get_cached_sqlalchemy_db().new_async_session() as async_session:
|
70
63
|
async_session.add(operation_dbm)
|
@@ -1,12 +1,13 @@
|
|
1
1
|
import asyncio
|
2
2
|
|
3
|
+
from pydantic import BaseModel
|
4
|
+
|
3
5
|
from project.sqlalchemy_db_.sqlalchemy_db import get_cached_sqlalchemy_db
|
4
6
|
from project.sqlalchemy_db_.sqlalchemy_model import ApiKeyDBM
|
5
7
|
|
6
8
|
|
7
9
|
def __sandbox():
|
8
|
-
|
9
|
-
ApiKeyDBM()
|
10
|
+
pass
|
10
11
|
|
11
12
|
|
12
13
|
async def __async_sandbox():
|
@@ -50,7 +50,14 @@ class OpenAIAPIClient:
|
|
50
50
|
self._logger.error(e)
|
51
51
|
return False
|
52
52
|
|
53
|
-
def simple_ask(
|
53
|
+
def simple_ask(
|
54
|
+
self,
|
55
|
+
*,
|
56
|
+
prompt: str | None = None,
|
57
|
+
content: str,
|
58
|
+
model: str = "gpt-4o",
|
59
|
+
max_tokens: int = 300
|
60
|
+
) -> ChatCompletion:
|
54
61
|
messages = []
|
55
62
|
if prompt is not None:
|
56
63
|
messages.append({
|
@@ -59,15 +66,15 @@ class OpenAIAPIClient:
|
|
59
66
|
})
|
60
67
|
messages.append({
|
61
68
|
"role": "user",
|
62
|
-
"content":
|
69
|
+
"content": content
|
63
70
|
})
|
64
71
|
response: ChatCompletion = self.open_ai.chat.completions.create(
|
65
|
-
model=
|
72
|
+
model=model,
|
66
73
|
messages=messages,
|
67
74
|
n=1,
|
68
75
|
temperature=0.1,
|
69
76
|
top_p=0.9,
|
70
|
-
max_tokens=
|
77
|
+
max_tokens=max_tokens
|
71
78
|
)
|
72
79
|
return response
|
73
80
|
|
@@ -121,7 +128,7 @@ async def __async_example():
|
|
121
128
|
print(await client.async_is_conn_good())
|
122
129
|
|
123
130
|
response = client.simple_ask(
|
124
|
-
|
131
|
+
content="Привет, проверяю тебя"
|
125
132
|
)
|
126
133
|
print(response.choices[0].message.content)
|
127
134
|
|
@@ -8,7 +8,7 @@ arpakitlib/_arpakit_project_template_v_5/alembic/env.py,sha256=Qesmnj5A2kB-Doeuf
|
|
8
8
|
arpakitlib/_arpakit_project_template_v_5/alembic/script.py.mako,sha256=MEqL-2qATlST9TAOeYgscMn1uy6HUS9NFvDgl93dMj8,635
|
9
9
|
arpakitlib/_arpakit_project_template_v_5/alembic/versions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
10
10
|
arpakitlib/_arpakit_project_template_v_5/alembic.ini,sha256=8fuyeEvGBiPGbxEFy8ISBV3xX_fgVmuhEGpB10_B5Uo,3733
|
11
|
-
arpakitlib/_arpakit_project_template_v_5/arpakitlib_project_template_info.json,sha256=
|
11
|
+
arpakitlib/_arpakit_project_template_v_5/arpakitlib_project_template_info.json,sha256=jzAYgWiiMnqi8c38yKZ6E1MRRfui4ZLOpgAISXI_OR4,98
|
12
12
|
arpakitlib/_arpakit_project_template_v_5/command/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
13
13
|
arpakitlib/_arpakit_project_template_v_5/command/alembic_history.sh,sha256=OMnDNtHIksGh9iavWnzbtxcudZW4vjdcISsBXvzZSPw,22
|
14
14
|
arpakitlib/_arpakit_project_template_v_5/command/alembic_revision_autogenerate.sh,sha256=yW2i-SBOtBx15Ya0poVQqKkJM5t2JZp06r9AEW-DmGE,46
|
@@ -96,7 +96,7 @@ arpakitlib/_arpakit_project_template_v_5/project/api/router/__init__.py,sha256=4
|
|
96
96
|
arpakitlib/_arpakit_project_template_v_5/project/api/router/admin/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
97
97
|
arpakitlib/_arpakit_project_template_v_5/project/api/router/admin/check_sqlalchemy_db.py,sha256=JGe2HvUSvXaIOaFG0ezNBhANCjvHJJFIG3aBtWF2dTY,1218
|
98
98
|
arpakitlib/_arpakit_project_template_v_5/project/api/router/admin/clear_log_file.py,sha256=HZYc4isEPEDx92v0cxTomS5j3hG7Nm2vn71hqkajM4M,1354
|
99
|
-
arpakitlib/_arpakit_project_template_v_5/project/api/router/admin/create_operation.py,sha256=
|
99
|
+
arpakitlib/_arpakit_project_template_v_5/project/api/router/admin/create_operation.py,sha256=aZFZzJM36knQIf2I2jCOjqzQ6nn70WgcPv88V18u8Ho,2358
|
100
100
|
arpakitlib/_arpakit_project_template_v_5/project/api/router/admin/get_arpakitlib_project_template_info.py,sha256=z6w7WajDfd6H5nb3IE_U37xcaCepGJSeJ2BDrHCpDBE,1260
|
101
101
|
arpakitlib/_arpakit_project_template_v_5/project/api/router/admin/get_auth_data.py,sha256=Hpjkucwnb2LtytWpMMA2WMROY2cTLn0q_tnUFijk0so,1195
|
102
102
|
arpakitlib/_arpakit_project_template_v_5/project/api/router/admin/get_log_file.py,sha256=rzEPco45I-4FzrlbI3z5B-smhrHFIVIsDiHtTULoE4g,1162
|
@@ -206,7 +206,7 @@ arpakitlib/_arpakit_project_template_v_5/project/resource/static/swagger-ui/swag
|
|
206
206
|
arpakitlib/_arpakit_project_template_v_5/project/resource/static/swagger-ui/swagger-ui.js.map,sha256=jeX-b8zAm2jsTGGCznrc49McbLKSfXspwECPhEAp0Xc,1159444
|
207
207
|
arpakitlib/_arpakit_project_template_v_5/project/resource/templates/healthcheck.txt,sha256=sxSHRe2D3mnWbLKY320QdFehtXS-zAgMQmmu7tAQIG0,11
|
208
208
|
arpakitlib/_arpakit_project_template_v_5/project/sandbox/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
209
|
-
arpakitlib/_arpakit_project_template_v_5/project/sandbox/sandbox_1.py,sha256=
|
209
|
+
arpakitlib/_arpakit_project_template_v_5/project/sandbox/sandbox_1.py,sha256=ylf2ETDk7NwcjO8ZTvyHQSj5jumvbzHhrVQhr2aYkRg,332
|
210
210
|
arpakitlib/_arpakit_project_template_v_5/project/sandbox/sandbox_2.py,sha256=xKSp7tIBu3Ffp_kgJkwVtdam3BcoFZ44JPVHoRRaP0E,163
|
211
211
|
arpakitlib/_arpakit_project_template_v_5/project/sandbox/sandbox_3.py,sha256=xKSp7tIBu3Ffp_kgJkwVtdam3BcoFZ44JPVHoRRaP0E,163
|
212
212
|
arpakitlib/_arpakit_project_template_v_5/project/sandbox/sandbox_4.py,sha256=xKSp7tIBu3Ffp_kgJkwVtdam3BcoFZ44JPVHoRRaP0E,163
|
@@ -267,7 +267,7 @@ arpakitlib/_arpakit_project_template_v_5/project/tg_bot/filter_/__init__.py,sha2
|
|
267
267
|
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/filter_/is_private_chat.py,sha256=2anQo68KqkNYQnfIZDXSOX0P9hU59oSSSIJ36bWQdo8,500
|
268
268
|
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/filter_/message_text.py,sha256=OdQSWtdqAQeiJt2hr1z5XMreT-esVkBHLBLvMx4PzAw,1326
|
269
269
|
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/filter_/not_prod_mode_filter.py,sha256=WY2Bl6_vznUi2bT0WMbVUkQq_JQ783hMFFwLs4u9Whk,236
|
270
|
-
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/filter_/prod_mode_filter.py,sha256=
|
270
|
+
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/filter_/prod_mode_filter.py,sha256=WfbAnzW8X4wJVtv_lHbr6u2SXXGwLhplTKPaHpuWQZ4,229
|
271
271
|
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/filter_/user_roles_has_admin.py,sha256=HBHDLTX6lRQcn_8NSIfP-YYfajldsToSGMafGx6AiFo,577
|
272
272
|
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/filter_/user_roles_has_client.py,sha256=vuVUssIlkpUAfMSVr6tabUiHe_Tr-KYI_pXN0YyeSA4,579
|
273
273
|
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/kb/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -322,7 +322,7 @@ arpakitlib/_arpakit_project_template_v_5/project/tg_bot/tg_bot.py,sha256=jMX_awQ
|
|
322
322
|
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/tg_bot_dispatcher.py,sha256=CUTYSiVEQrOcOe1pTl8BAHZIDIqurwVQEy0zCmab8Z8,660
|
323
323
|
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
324
324
|
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/util/etc.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
325
|
-
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/util/notify_admins.py,sha256=
|
325
|
+
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/util/notify_admins.py,sha256=csnBJPdHArFFnRnEoWriQ2PgJM0t8ttyP8EM5zhjTro,1949
|
326
326
|
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/util/set_tg_bot_commands.py,sha256=3Vp29YG9DGMrQSB2WPYciI4pdBHyT1vOGDBKfZ8OLTE,3483
|
327
327
|
arpakitlib/_arpakit_project_template_v_5/project/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
328
328
|
arpakitlib/_arpakit_project_template_v_5/project/util/arpakitlib_project_template.py,sha256=syA_IuszHVub0zm0sVdB4_7rPJXwXRW4JmQ4qHbjXPk,396
|
@@ -359,7 +359,7 @@ arpakitlib/ar_list_util.py,sha256=2woOAHAU8oTIiVjZ8GLnx15odEaoQUq3Q0JPxlufFF0,45
|
|
359
359
|
arpakitlib/ar_logging_util.py,sha256=GLw87L6qUASHS4-eAoBW0kN2hHXVdmWcmE9huw-J5aI,1681
|
360
360
|
arpakitlib/ar_mongodb_util.py,sha256=2ECkTnGAZ92qxioL-fmN6R4yZOSr3bXdXLWTzT1C3vk,4038
|
361
361
|
arpakitlib/ar_need_type_util.py,sha256=l4ky_15KKwqgYf2WTgEaKfBI15jZbnszOeQjwC0YUmk,2312
|
362
|
-
arpakitlib/ar_openai_api_client_util.py,sha256=
|
362
|
+
arpakitlib/ar_openai_api_client_util.py,sha256=nMF8-ybcSx29Q7HK3X6vhliQIy7UnuNcpXiYOWgyMn0,3316
|
363
363
|
arpakitlib/ar_parse_command.py,sha256=1WTdQoWVshoDZ1jDaKeTzajfqaYHP3FNO0-REyo1aMY,3003
|
364
364
|
arpakitlib/ar_postgresql_util.py,sha256=1AuLjEaa1Lg4pzn-ukCVnDi35Eg1k91APRTqZhIJAdo,945
|
365
365
|
arpakitlib/ar_rat_func_util.py,sha256=Ca10o3RJwyx_DJLxjTxgHDO6NU3M6CWgUR4bif67OE4,2006
|
@@ -375,8 +375,8 @@ arpakitlib/ar_str_util.py,sha256=NisRtt4xwE7qthkkXzL49jvGKMGlvJ4KKcvpQfmRlIw,441
|
|
375
375
|
arpakitlib/ar_type_util.py,sha256=Cs_tef-Fc5xeyAF54KgISCsP11NHyzIsglm4S3Xx7iM,4049
|
376
376
|
arpakitlib/ar_yookassa_api_client_util.py,sha256=VozuZeCJjmLd1zj2BdC9WfiAQ3XYOrIMsdpNK-AUlm0,5347
|
377
377
|
arpakitlib/ar_zabbix_api_client_util.py,sha256=oHNS-2WckQxp7cVqsRne9JgkP9I7RQGBKVKZSMLN8zw,9427
|
378
|
-
arpakitlib-1.8.
|
379
|
-
arpakitlib-1.8.
|
380
|
-
arpakitlib-1.8.
|
381
|
-
arpakitlib-1.8.
|
382
|
-
arpakitlib-1.8.
|
378
|
+
arpakitlib-1.8.71.dist-info/LICENSE,sha256=GPEDQMam2r7FSTYqM1mm7aKnxLaWcBotH7UvQtea-ec,11355
|
379
|
+
arpakitlib-1.8.71.dist-info/METADATA,sha256=YCV6y7y6s4YscTOOEcGkX2Qw8Wp302JqKtJivnSEt0o,3475
|
380
|
+
arpakitlib-1.8.71.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
|
381
|
+
arpakitlib-1.8.71.dist-info/entry_points.txt,sha256=36xqR3PJFT2kuwjkM_EqoIy0qFUDPKSm_mJaI7emewE,87
|
382
|
+
arpakitlib-1.8.71.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|