py-aidol 0.5.0__tar.gz → 0.6.0__tar.gz
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.
- {py_aidol-0.5.0 → py_aidol-0.6.0}/PKG-INFO +1 -1
- {py_aidol-0.5.0 → py_aidol-0.6.0}/aidol/api/aidol.py +22 -8
- {py_aidol-0.5.0 → py_aidol-0.6.0}/aidol/api/chatroom.py +19 -3
- {py_aidol-0.5.0 → py_aidol-0.6.0}/aidol/api/companion.py +21 -40
- {py_aidol-0.5.0 → py_aidol-0.6.0}/aidol/api/lead.py +2 -2
- {py_aidol-0.5.0 → py_aidol-0.6.0}/aidol/protocols.py +5 -5
- {py_aidol-0.5.0 → py_aidol-0.6.0}/aidol/repositories/aidol.py +6 -7
- {py_aidol-0.5.0 → py_aidol-0.6.0}/aidol/repositories/chatroom.py +3 -3
- {py_aidol-0.5.0 → py_aidol-0.6.0}/aidol/schemas/__init__.py +4 -0
- {py_aidol-0.5.0 → py_aidol-0.6.0}/aidol/schemas/aidol.py +13 -6
- {py_aidol-0.5.0 → py_aidol-0.6.0}/aidol/schemas/chatroom.py +10 -4
- {py_aidol-0.5.0 → py_aidol-0.6.0}/pyproject.toml +1 -1
- {py_aidol-0.5.0 → py_aidol-0.6.0}/README.md +0 -0
- {py_aidol-0.5.0 → py_aidol-0.6.0}/aidol/__init__.py +0 -0
- {py_aidol-0.5.0 → py_aidol-0.6.0}/aidol/api/__init__.py +0 -0
- {py_aidol-0.5.0 → py_aidol-0.6.0}/aidol/api/common.py +0 -0
- {py_aidol-0.5.0 → py_aidol-0.6.0}/aidol/context/__init__.py +0 -0
- {py_aidol-0.5.0 → py_aidol-0.6.0}/aidol/context/builder.py +0 -0
- {py_aidol-0.5.0 → py_aidol-0.6.0}/aidol/factories.py +0 -0
- {py_aidol-0.5.0 → py_aidol-0.6.0}/aidol/models/__init__.py +0 -0
- {py_aidol-0.5.0 → py_aidol-0.6.0}/aidol/models/aidol.py +0 -0
- {py_aidol-0.5.0 → py_aidol-0.6.0}/aidol/models/aidol_lead.py +0 -0
- {py_aidol-0.5.0 → py_aidol-0.6.0}/aidol/models/chatroom.py +0 -0
- {py_aidol-0.5.0 → py_aidol-0.6.0}/aidol/models/companion.py +0 -0
- {py_aidol-0.5.0 → py_aidol-0.6.0}/aidol/providers/__init__.py +0 -0
- {py_aidol-0.5.0 → py_aidol-0.6.0}/aidol/providers/llm/__init__.py +0 -0
- {py_aidol-0.5.0 → py_aidol-0.6.0}/aidol/providers/llm/base.py +0 -0
- {py_aidol-0.5.0 → py_aidol-0.6.0}/aidol/providers/llm/openai.py +0 -0
- {py_aidol-0.5.0 → py_aidol-0.6.0}/aidol/py.typed +0 -0
- {py_aidol-0.5.0 → py_aidol-0.6.0}/aidol/repositories/__init__.py +0 -0
- {py_aidol-0.5.0 → py_aidol-0.6.0}/aidol/repositories/aidol_lead.py +0 -0
- {py_aidol-0.5.0 → py_aidol-0.6.0}/aidol/repositories/companion.py +0 -0
- {py_aidol-0.5.0 → py_aidol-0.6.0}/aidol/schemas/aidol_lead.py +0 -0
- {py_aidol-0.5.0 → py_aidol-0.6.0}/aidol/schemas/companion.py +0 -0
- {py_aidol-0.5.0 → py_aidol-0.6.0}/aidol/schemas/model_settings.py +0 -0
- {py_aidol-0.5.0 → py_aidol-0.6.0}/aidol/schemas/persona.py +0 -0
- {py_aidol-0.5.0 → py_aidol-0.6.0}/aidol/services/__init__.py +0 -0
- {py_aidol-0.5.0 → py_aidol-0.6.0}/aidol/services/companion_service.py +0 -0
- {py_aidol-0.5.0 → py_aidol-0.6.0}/aidol/services/image_generation_service.py +0 -0
- {py_aidol-0.5.0 → py_aidol-0.6.0}/aidol/services/response_generation_service.py +0 -0
- {py_aidol-0.5.0 → py_aidol-0.6.0}/aidol/settings.py +0 -0
|
@@ -6,11 +6,13 @@ Public endpoints for AIdol group creation and retrieval.
|
|
|
6
6
|
Public access pattern: no authentication required.
|
|
7
7
|
"""
|
|
8
8
|
|
|
9
|
+
from typing import Annotated
|
|
10
|
+
|
|
9
11
|
from aioia_core.auth import UserInfoProvider
|
|
10
12
|
from aioia_core.errors import ErrorResponse
|
|
11
13
|
from aioia_core.fastapi import BaseCrudRouter
|
|
12
14
|
from aioia_core.settings import JWTSettings
|
|
13
|
-
from fastapi import APIRouter, Depends, HTTPException,
|
|
15
|
+
from fastapi import APIRouter, Cookie, Depends, HTTPException, status
|
|
14
16
|
from pydantic import BaseModel
|
|
15
17
|
from sqlalchemy.orm import sessionmaker
|
|
16
18
|
|
|
@@ -20,7 +22,13 @@ from aidol.protocols import (
|
|
|
20
22
|
AIdolRepositoryProtocol,
|
|
21
23
|
ImageStorageProtocol,
|
|
22
24
|
)
|
|
23
|
-
from aidol.schemas import
|
|
25
|
+
from aidol.schemas import (
|
|
26
|
+
AIdol,
|
|
27
|
+
AIdolCreate,
|
|
28
|
+
AIdolCreateWithClaim,
|
|
29
|
+
AIdolPublic,
|
|
30
|
+
AIdolUpdate,
|
|
31
|
+
)
|
|
24
32
|
from aidol.settings import GoogleGenAISettings
|
|
25
33
|
|
|
26
34
|
|
|
@@ -31,7 +39,7 @@ class AIdolCreateResponse(BaseModel):
|
|
|
31
39
|
|
|
32
40
|
|
|
33
41
|
class AIdolRouter(
|
|
34
|
-
BaseCrudRouter[AIdol,
|
|
42
|
+
BaseCrudRouter[AIdol, AIdolCreateWithClaim, AIdolUpdate, AIdolRepositoryProtocol]
|
|
35
43
|
):
|
|
36
44
|
"""
|
|
37
45
|
AIdol router with public endpoints.
|
|
@@ -106,15 +114,21 @@ class AIdolRouter(
|
|
|
106
114
|
)
|
|
107
115
|
async def create_aidol(
|
|
108
116
|
request: AIdolCreate,
|
|
109
|
-
|
|
117
|
+
claim_token: Annotated[str | None, Cookie(alias="ClaimToken")] = None,
|
|
110
118
|
repository: AIdolRepositoryProtocol = Depends(self.get_repository_dep),
|
|
111
119
|
):
|
|
112
120
|
"""Create a new AIdol group."""
|
|
113
|
-
|
|
121
|
+
if not claim_token:
|
|
122
|
+
raise HTTPException(
|
|
123
|
+
status_code=status.HTTP_400_BAD_REQUEST,
|
|
124
|
+
detail="ClaimToken cookie is required",
|
|
125
|
+
)
|
|
114
126
|
|
|
115
|
-
#
|
|
116
|
-
|
|
117
|
-
|
|
127
|
+
# Convert body schema to internal schema with claim_token from Cookie
|
|
128
|
+
create_data = AIdolCreateWithClaim(
|
|
129
|
+
**request.model_dump(), claim_token=claim_token
|
|
130
|
+
)
|
|
131
|
+
created = repository.create(create_data)
|
|
118
132
|
|
|
119
133
|
# Return only id
|
|
120
134
|
return AIdolCreateResponse(id=created.id)
|
|
@@ -4,11 +4,13 @@ Chatroom API router
|
|
|
4
4
|
Implements BaseCrudRouter pattern for consistency with aioia-core patterns.
|
|
5
5
|
"""
|
|
6
6
|
|
|
7
|
+
from typing import Annotated
|
|
8
|
+
|
|
7
9
|
from aioia_core.auth import UserInfoProvider
|
|
8
10
|
from aioia_core.errors import ErrorResponse
|
|
9
11
|
from aioia_core.fastapi import BaseCrudRouter
|
|
10
12
|
from aioia_core.settings import JWTSettings, OpenAIAPISettings
|
|
11
|
-
from fastapi import APIRouter, Depends, HTTPException, status
|
|
13
|
+
from fastapi import APIRouter, Cookie, Depends, HTTPException, status
|
|
12
14
|
from humps import camelize
|
|
13
15
|
from langchain_core.messages import AIMessage, BaseMessage, HumanMessage
|
|
14
16
|
from pydantic import BaseModel, ConfigDict, Field
|
|
@@ -28,6 +30,7 @@ from aidol.schemas import (
|
|
|
28
30
|
CompanionMessageCreate,
|
|
29
31
|
Message,
|
|
30
32
|
MessageCreate,
|
|
33
|
+
MessageCreateWithClaim,
|
|
31
34
|
ModelSettings,
|
|
32
35
|
Persona,
|
|
33
36
|
SenderType,
|
|
@@ -181,19 +184,32 @@ class ChatroomRouter(
|
|
|
181
184
|
async def send_message(
|
|
182
185
|
item_id: str,
|
|
183
186
|
request: MessageCreate,
|
|
187
|
+
claim_token: Annotated[str | None, Cookie(alias="ClaimToken")] = None,
|
|
184
188
|
repository: ChatroomRepositoryProtocol = Depends(self.get_repository_dep),
|
|
185
189
|
):
|
|
186
190
|
"""Send a message to a chatroom."""
|
|
191
|
+
# Guard Clause: ClaimToken cookie is required
|
|
192
|
+
if not claim_token:
|
|
193
|
+
raise HTTPException(
|
|
194
|
+
status_code=status.HTTP_400_BAD_REQUEST,
|
|
195
|
+
detail="ClaimToken cookie is required",
|
|
196
|
+
)
|
|
197
|
+
|
|
187
198
|
# Verify chatroom exists
|
|
188
199
|
self._get_item_or_404(repository, item_id)
|
|
189
200
|
|
|
190
201
|
# Enforce sender_type as USER to prevent spoofing
|
|
191
202
|
request.sender_type = SenderType.USER
|
|
192
203
|
|
|
193
|
-
#
|
|
204
|
+
# Convert to internal schema with claim_token from Cookie
|
|
205
|
+
message_data = MessageCreateWithClaim(
|
|
206
|
+
**request.model_dump(), claim_token=claim_token
|
|
207
|
+
)
|
|
208
|
+
|
|
209
|
+
# Pass MessageCreateWithClaim to repository
|
|
194
210
|
return repository.add_message_to_chatroom(
|
|
195
211
|
chatroom_id=item_id,
|
|
196
|
-
message=
|
|
212
|
+
message=message_data,
|
|
197
213
|
)
|
|
198
214
|
|
|
199
215
|
def _register_generate_response_route(self) -> None:
|
|
@@ -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]
|
|
@@ -8,7 +8,7 @@ from typing import Annotated
|
|
|
8
8
|
|
|
9
9
|
from aioia_core.fastapi import BaseCrudRouter
|
|
10
10
|
from aioia_core.settings import JWTSettings
|
|
11
|
-
from fastapi import APIRouter,
|
|
11
|
+
from fastapi import APIRouter, Cookie, Depends, status
|
|
12
12
|
from pydantic import BaseModel
|
|
13
13
|
from sqlalchemy.orm import Session, sessionmaker
|
|
14
14
|
|
|
@@ -60,7 +60,7 @@ class LeadRouter(
|
|
|
60
60
|
)
|
|
61
61
|
async def create_lead(
|
|
62
62
|
request: AIdolLeadCreate,
|
|
63
|
-
claim_token: Annotated[str | None,
|
|
63
|
+
claim_token: Annotated[str | None, Cookie(alias="ClaimToken")] = None,
|
|
64
64
|
db_session: Session = Depends(self.get_db_dep),
|
|
65
65
|
lead_repository: AIdolLeadRepositoryProtocol = Depends(
|
|
66
66
|
self.get_repository_dep
|
|
@@ -16,7 +16,7 @@ from sqlalchemy.orm import Session
|
|
|
16
16
|
|
|
17
17
|
from aidol.schemas import (
|
|
18
18
|
AIdol,
|
|
19
|
-
|
|
19
|
+
AIdolCreateWithClaim,
|
|
20
20
|
AIdolLead,
|
|
21
21
|
AIdolLeadCreate,
|
|
22
22
|
AIdolUpdate,
|
|
@@ -27,7 +27,7 @@ from aidol.schemas import (
|
|
|
27
27
|
CompanionCreate,
|
|
28
28
|
CompanionUpdate,
|
|
29
29
|
Message,
|
|
30
|
-
|
|
30
|
+
MessageCreateWithClaim,
|
|
31
31
|
)
|
|
32
32
|
|
|
33
33
|
|
|
@@ -64,13 +64,13 @@ class ChatroomRepositoryProtocol(
|
|
|
64
64
|
...
|
|
65
65
|
|
|
66
66
|
def add_message_to_chatroom(
|
|
67
|
-
self, chatroom_id: str, message:
|
|
67
|
+
self, chatroom_id: str, message: MessageCreateWithClaim
|
|
68
68
|
) -> Message:
|
|
69
69
|
"""Add a message to a chatroom.
|
|
70
70
|
|
|
71
71
|
Args:
|
|
72
72
|
chatroom_id: Chatroom ID.
|
|
73
|
-
message:
|
|
73
|
+
message: MessageCreateWithClaim or CompanionMessageCreate schema (with claim_token).
|
|
74
74
|
"""
|
|
75
75
|
...
|
|
76
76
|
|
|
@@ -95,7 +95,7 @@ class ChatroomRepositoryFactoryProtocol(Protocol):
|
|
|
95
95
|
|
|
96
96
|
|
|
97
97
|
class AIdolRepositoryProtocol(
|
|
98
|
-
CrudRepositoryProtocol[AIdol,
|
|
98
|
+
CrudRepositoryProtocol[AIdol, AIdolCreateWithClaim, AIdolUpdate], Protocol
|
|
99
99
|
):
|
|
100
100
|
"""Protocol defining AIdol repository expectations.
|
|
101
101
|
|
|
@@ -13,7 +13,7 @@ from aioia_core.repositories import BaseRepository
|
|
|
13
13
|
from sqlalchemy.orm import Session
|
|
14
14
|
|
|
15
15
|
from aidol.models import DBAIdol
|
|
16
|
-
from aidol.schemas import AIdol,
|
|
16
|
+
from aidol.schemas import AIdol, AIdolCreateWithClaim, AIdolUpdate
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
def _convert_db_aidol_to_model(db_aidol: DBAIdol) -> AIdol:
|
|
@@ -35,15 +35,14 @@ def _convert_db_aidol_to_model(db_aidol: DBAIdol) -> AIdol:
|
|
|
35
35
|
)
|
|
36
36
|
|
|
37
37
|
|
|
38
|
-
def _convert_aidol_create_to_db(schema:
|
|
39
|
-
"""Convert
|
|
40
|
-
|
|
41
|
-
Includes claim_token for ownership verification.
|
|
42
|
-
"""
|
|
38
|
+
def _convert_aidol_create_to_db(schema: AIdolCreateWithClaim) -> dict:
|
|
39
|
+
"""Convert AIdolCreateWithClaim schema to DB model data dict."""
|
|
43
40
|
return schema.model_dump(exclude_unset=True)
|
|
44
41
|
|
|
45
42
|
|
|
46
|
-
class AIdolRepository(
|
|
43
|
+
class AIdolRepository(
|
|
44
|
+
BaseRepository[AIdol, DBAIdol, AIdolCreateWithClaim, AIdolUpdate]
|
|
45
|
+
):
|
|
47
46
|
"""
|
|
48
47
|
Database-backed AIdol repository.
|
|
49
48
|
|
|
@@ -17,7 +17,7 @@ from aidol.schemas import (
|
|
|
17
17
|
ChatroomUpdate,
|
|
18
18
|
CompanionMessage,
|
|
19
19
|
Message,
|
|
20
|
-
|
|
20
|
+
MessageCreateWithClaim,
|
|
21
21
|
SenderType,
|
|
22
22
|
)
|
|
23
23
|
|
|
@@ -81,7 +81,7 @@ class ChatroomRepository(
|
|
|
81
81
|
# ========================================
|
|
82
82
|
|
|
83
83
|
def add_message_to_chatroom(
|
|
84
|
-
self, chatroom_id: str, message:
|
|
84
|
+
self, chatroom_id: str, message: MessageCreateWithClaim
|
|
85
85
|
) -> Message:
|
|
86
86
|
"""
|
|
87
87
|
Add message to chatroom.
|
|
@@ -91,7 +91,7 @@ class ChatroomRepository(
|
|
|
91
91
|
|
|
92
92
|
Args:
|
|
93
93
|
chatroom_id: Chatroom ID
|
|
94
|
-
message:
|
|
94
|
+
message: MessageCreateWithClaim or CompanionMessageCreate schema (with claim_token)
|
|
95
95
|
|
|
96
96
|
Returns:
|
|
97
97
|
Message or CompanionMessage with id guaranteed to be set
|
|
@@ -6,6 +6,7 @@ from aidol.schemas.aidol import (
|
|
|
6
6
|
AIdol,
|
|
7
7
|
AIdolBase,
|
|
8
8
|
AIdolCreate,
|
|
9
|
+
AIdolCreateWithClaim,
|
|
9
10
|
AIdolPublic,
|
|
10
11
|
AIdolUpdate,
|
|
11
12
|
ImageGenerationData,
|
|
@@ -24,6 +25,7 @@ from aidol.schemas.chatroom import (
|
|
|
24
25
|
Message,
|
|
25
26
|
MessageBase,
|
|
26
27
|
MessageCreate,
|
|
28
|
+
MessageCreateWithClaim,
|
|
27
29
|
SenderType,
|
|
28
30
|
)
|
|
29
31
|
from aidol.schemas.companion import (
|
|
@@ -45,6 +47,7 @@ __all__ = [
|
|
|
45
47
|
"AIdol",
|
|
46
48
|
"AIdolBase",
|
|
47
49
|
"AIdolCreate",
|
|
50
|
+
"AIdolCreateWithClaim",
|
|
48
51
|
"AIdolPublic",
|
|
49
52
|
"AIdolUpdate",
|
|
50
53
|
"ImageGenerationData",
|
|
@@ -65,6 +68,7 @@ __all__ = [
|
|
|
65
68
|
"Message",
|
|
66
69
|
"MessageBase",
|
|
67
70
|
"MessageCreate",
|
|
71
|
+
"MessageCreateWithClaim",
|
|
68
72
|
"SenderType",
|
|
69
73
|
# Companion
|
|
70
74
|
"Companion",
|
|
@@ -3,7 +3,8 @@ AIdol (group) schemas
|
|
|
3
3
|
|
|
4
4
|
Schema hierarchy:
|
|
5
5
|
- AIdolBase: Mutable fields (used in Create/Update)
|
|
6
|
-
- AIdolCreate:
|
|
6
|
+
- AIdolCreate: API body (claim_token excluded, read from Cookie)
|
|
7
|
+
- AIdolCreateWithClaim: Internal (claim_token included, for repository)
|
|
7
8
|
- AIdolUpdate: Base fields only
|
|
8
9
|
- AIdol: Response with all fields including claim_token (internal use)
|
|
9
10
|
- AIdolPublic: Response without sensitive fields (API use)
|
|
@@ -32,14 +33,20 @@ class AIdolBase(BaseModel):
|
|
|
32
33
|
|
|
33
34
|
|
|
34
35
|
class AIdolCreate(AIdolBase):
|
|
35
|
-
"""
|
|
36
|
+
"""API body schema for creating an AIdol group.
|
|
36
37
|
|
|
37
|
-
claim_token is
|
|
38
|
+
claim_token is excluded (read from Cookie by router).
|
|
38
39
|
"""
|
|
39
40
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
|
|
42
|
+
class AIdolCreateWithClaim(AIdolBase):
|
|
43
|
+
"""Internal schema for repository with claim_token.
|
|
44
|
+
|
|
45
|
+
Used by router to pass Cookie-based claim_token to repository.
|
|
46
|
+
"""
|
|
47
|
+
|
|
48
|
+
claim_token: str | None = Field(
|
|
49
|
+
default=None, description="Ownership token from Cookie"
|
|
43
50
|
)
|
|
44
51
|
|
|
45
52
|
|
|
@@ -82,10 +82,16 @@ class CompanionMessage(Message):
|
|
|
82
82
|
|
|
83
83
|
|
|
84
84
|
class MessageCreate(MessageBase):
|
|
85
|
-
"""
|
|
85
|
+
"""API body schema for creating a message (no id, no timestamp).
|
|
86
86
|
|
|
87
|
-
claim_token is
|
|
88
|
-
|
|
87
|
+
claim_token is excluded (read from Cookie by router).
|
|
88
|
+
"""
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
class MessageCreateWithClaim(MessageBase):
|
|
92
|
+
"""Internal schema for repository with claim_token.
|
|
93
|
+
|
|
94
|
+
Used by router to pass Cookie-based claim_token to repository.
|
|
89
95
|
"""
|
|
90
96
|
|
|
91
97
|
claim_token: str | None = Field(
|
|
@@ -93,7 +99,7 @@ class MessageCreate(MessageBase):
|
|
|
93
99
|
)
|
|
94
100
|
|
|
95
101
|
|
|
96
|
-
class CompanionMessageCreate(
|
|
102
|
+
class CompanionMessageCreate(MessageCreateWithClaim):
|
|
97
103
|
"""Schema for creating a companion message.
|
|
98
104
|
|
|
99
105
|
companion_id is optional for aidol standalone but may be required for platform integration.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|