Add update session functionality and enhance scenario support

- Introduce UpdateSessionRequest model for partial updates to session state, allowing modification of situation and characters.
- Implement updateSession method in SessionService to handle updates, ensuring omitted fields remain unchanged.
- Enhance InMemorySessionService to support scenario-based session creation, populating initial situation and characters.
- Update SessionResource to delegate update requests to the SessionService.
- Add corresponding API documentation for the update session endpoint in OpenAPI specification.
- Enhance frontend components to allow editing of session scene and characters, integrating with the new update functionality.
- Include unit tests to verify the behavior of session updates and scenario handling.
This commit is contained in:
Konrad Neitzel
2026-02-21 10:04:07 +01:00
parent ffb97f6b8e
commit f21f1e7520
12 changed files with 942 additions and 5 deletions
+9
View File
@@ -20,5 +20,14 @@ quarkus:
url: http://debian:11434
connect-timeout: 5000
read-timeout: 120000
logging:
scope: request-response
body-limit: 2048
rest:
path: /api/v1
log:
category:
"de.neitzel.roleplay.fascade.OllamaClient":
level: DEBUG
"org.jboss.resteasy.reactive.client.logging":
level: DEBUG
@@ -101,6 +101,40 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
patch:
operationId: updateSession
summary: Update session state
description: |
Partially updates an existing session. Provide situation and/or characters
to replace the current values. Omitted fields are left unchanged.
tags:
- sessions
parameters:
- $ref: '#/components/parameters/SessionId'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateSessionRequest'
responses:
"200":
description: Session updated; full state returned.
content:
application/json:
schema:
$ref: '#/components/schemas/SessionResponse'
"404":
description: Session not found.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
"400":
description: Invalid request body.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/sessions/{sessionId}/turns:
post:
@@ -245,6 +279,19 @@ components:
items:
$ref: '#/components/schemas/CharacterDefinition'
UpdateSessionRequest:
type: object
description: Request body for partially updating a session.
properties:
situation:
$ref: '#/components/schemas/SituationState'
description: Replace session situation when provided.
characters:
type: array
items:
$ref: '#/components/schemas/CharacterState'
description: Replace session character list when provided.
CharacterDefinition:
type: object
description: Definition of a character for session initialisation.