py-aidol 0.5.0__py3-none-any.whl → 0.5.1__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.
aidol/api/companion.py
CHANGED
|
@@ -20,13 +20,7 @@ from aidol.protocols import (
|
|
|
20
20
|
CompanionRepositoryProtocol,
|
|
21
21
|
ImageStorageProtocol,
|
|
22
22
|
)
|
|
23
|
-
from aidol.schemas import
|
|
24
|
-
Companion,
|
|
25
|
-
CompanionCreate,
|
|
26
|
-
CompanionPublic,
|
|
27
|
-
CompanionUpdate,
|
|
28
|
-
Gender,
|
|
29
|
-
)
|
|
23
|
+
from aidol.schemas import Companion, CompanionCreate, CompanionPublic, CompanionUpdate
|
|
30
24
|
from aidol.services.companion_service import to_companion_public
|
|
31
25
|
from aidol.settings import GoogleGenAISettings
|
|
32
26
|
|
|
@@ -90,45 +84,32 @@ class CompanionRouter(
|
|
|
90
84
|
response_model=CompanionPaginatedResponse,
|
|
91
85
|
status_code=status.HTTP_200_OK,
|
|
92
86
|
summary="List Companions",
|
|
93
|
-
description="List all Companions with
|
|
87
|
+
description="List all Companions with pagination, sorting, and filtering",
|
|
94
88
|
)
|
|
95
89
|
async def list_companions(
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
90
|
+
current: int = Query(1, ge=1, description="Current page number"),
|
|
91
|
+
page_size: int = Query(
|
|
92
|
+
10, alias="pageSize", ge=1, le=100, description="Items per page"
|
|
93
|
+
),
|
|
94
|
+
sort_param: str | None = Query(
|
|
95
|
+
None,
|
|
96
|
+
alias="sort",
|
|
97
|
+
description='Sorting criteria in JSON format. Example: [["createdAt","desc"]]',
|
|
98
|
+
),
|
|
99
|
+
filters_param: str | None = Query(
|
|
100
|
+
None,
|
|
101
|
+
alias="filters",
|
|
102
|
+
description="Filter conditions (JSON format)",
|
|
99
103
|
),
|
|
100
|
-
aidol_id: str | None = Query(None, description="Filter by AIdol Group ID"),
|
|
101
104
|
repository: CompanionRepositoryProtocol = Depends(self.get_repository_dep),
|
|
102
105
|
):
|
|
103
|
-
"""List Companions with
|
|
104
|
-
filter_list
|
|
105
|
-
|
|
106
|
-
# Add filters only if provided
|
|
107
|
-
if gender is not None:
|
|
108
|
-
filter_list.append(
|
|
109
|
-
{"field": "gender", "operator": "eq", "value": gender.value}
|
|
110
|
-
)
|
|
111
|
-
|
|
112
|
-
# Filter by aidol_id if provided
|
|
113
|
-
if aidol_id is not None:
|
|
114
|
-
filter_list.append(
|
|
115
|
-
{"field": "aidol_id", "operator": "eq", "value": aidol_id}
|
|
116
|
-
)
|
|
117
|
-
|
|
118
|
-
# isCast is derived from aidol_id presence
|
|
119
|
-
# isCast=true → aidol_id is not null (belongs to a group)
|
|
120
|
-
# isCast=false → aidol_id is null (not in a group)
|
|
121
|
-
if is_cast is True:
|
|
122
|
-
filter_list.append(
|
|
123
|
-
{"field": "aidol_id", "operator": "ne", "value": None}
|
|
124
|
-
)
|
|
125
|
-
elif is_cast is False:
|
|
126
|
-
filter_list.append(
|
|
127
|
-
{"field": "aidol_id", "operator": "eq", "value": None}
|
|
128
|
-
)
|
|
129
|
-
|
|
106
|
+
"""List Companions with pagination, sorting, and filtering."""
|
|
107
|
+
sort_list, filter_list = self._parse_query_params(sort_param, filters_param)
|
|
130
108
|
items, total = repository.get_all(
|
|
131
|
-
|
|
109
|
+
current=current,
|
|
110
|
+
page_size=page_size,
|
|
111
|
+
sort=sort_list,
|
|
112
|
+
filters=filter_list,
|
|
132
113
|
)
|
|
133
114
|
# Convert to Public schema (exclude system_prompt)
|
|
134
115
|
public_items = [to_companion_public(c) for c in items]
|
|
@@ -3,7 +3,7 @@ aidol/api/__init__.py,sha256=JWcwxYJ32_qzD_86_FR9wUAfSQMT6G2lqDtssrPJPj4,398
|
|
|
3
3
|
aidol/api/aidol.py,sha256=AIpDMTTOxht1eEVk4YITvmJzvklpYlDTpQVrIuSjeUw,6588
|
|
4
4
|
aidol/api/chatroom.py,sha256=wQ-NhjUqR_9BkNMBzwQlwc-_jse6GhqssC3zminWL4E,12154
|
|
5
5
|
aidol/api/common.py,sha256=w8ERo96t9tat4HPs1qw9JhyoJ8cj5crHCe92Hp3Usug,2198
|
|
6
|
-
aidol/api/companion.py,sha256=
|
|
6
|
+
aidol/api/companion.py,sha256=nFFUKdANH44hiLe5aM5W6tO1TTI9wPHVP8ssncY5oj8,10510
|
|
7
7
|
aidol/api/lead.py,sha256=RSf3GcIUVJu752rU9HG7Wy22UmnrRZnN_NGWkpTRDfE,3921
|
|
8
8
|
aidol/context/__init__.py,sha256=b_DP8Qlmiv2jhKVSE61XQUAcIujwbtob435pjkeVHAM,722
|
|
9
9
|
aidol/context/builder.py,sha256=XLKaj-buUNTyp9ucslGDshZ8TyTQ5xK7vACjtkV7x7o,12252
|
|
@@ -36,6 +36,6 @@ aidol/services/companion_service.py,sha256=tNNWiIFmJQ-I3UBW06baOANXhBx5oTKoT6nkq
|
|
|
36
36
|
aidol/services/image_generation_service.py,sha256=zDs9HP_JckHFJJZUIo2ADSsHGppat-8V-ttu8DlN-BU,3862
|
|
37
37
|
aidol/services/response_generation_service.py,sha256=S5Xt-uVbYRc-qH_xHJkb-2xhKWm96DtWvCM8lIUGmi0,1942
|
|
38
38
|
aidol/settings.py,sha256=mi8JN6C88Fv0vgRsnyupJVw6Wy_aFMxEkq635yar1_I,1178
|
|
39
|
-
py_aidol-0.5.
|
|
40
|
-
py_aidol-0.5.
|
|
41
|
-
py_aidol-0.5.
|
|
39
|
+
py_aidol-0.5.1.dist-info/METADATA,sha256=73T6ab34DA8aX_-SAX0lvli8ewYb0y7C9c_H9nGuX9w,3547
|
|
40
|
+
py_aidol-0.5.1.dist-info/WHEEL,sha256=kJCRJT_g0adfAJzTx2GUMmS80rTJIVHRCfG0DQgLq3o,88
|
|
41
|
+
py_aidol-0.5.1.dist-info/RECORD,,
|
|
File without changes
|