Chat persistant pour la partie lore et la partie campagne pour chaque page / scène.....
All checks were successful
Build & Push Images / build (brain) (push) Successful in 52s
Build & Push Images / build (core) (push) Successful in 1m23s
Build & Push Images / build (web) (push) Successful in 1m26s

Correction du carroussel
Passage en v0.4.0
Correction du docker compose pour tout le temps utiliser le bon port que ce soit prod ou dev
This commit is contained in:
2026-04-21 23:35:43 +02:00
parent b0fe8de708
commit 49a82d05f7
45 changed files with 2153 additions and 202 deletions

View File

@@ -0,0 +1,64 @@
import { HttpClient, HttpParams } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import {
Conversation,
ConversationContext,
ConversationMessage,
CreateConversationPayload,
} from './conversation.model';
/**
* Service HTTP des conversations persistees.
*
* Le streaming (chat/stream) reste pris en charge par AiChatService. Ce
* service ne gere que la persistance (metadonnees + messages) et
* l'auto-titre declenche apres le 1er echange.
*/
@Injectable({ providedIn: 'root' })
export class ConversationService {
private readonly apiUrl = 'http://localhost:8080/api/conversations';
constructor(private http: HttpClient) {}
list(ctx: ConversationContext): Observable<Conversation[]> {
let params = new HttpParams();
if (ctx.loreId) params = params.set('loreId', ctx.loreId);
if (ctx.campaignId) params = params.set('campaignId', ctx.campaignId);
if (ctx.entityType) params = params.set('entityType', ctx.entityType);
if (ctx.entityId) params = params.set('entityId', ctx.entityId);
return this.http.get<Conversation[]>(this.apiUrl, { params });
}
getById(id: string): Observable<Conversation> {
return this.http.get<Conversation>(`${this.apiUrl}/${id}`);
}
create(payload: CreateConversationPayload): Observable<Conversation> {
return this.http.post<Conversation>(this.apiUrl, payload);
}
rename(id: string, title: string): Observable<void> {
return this.http.patch<void>(`${this.apiUrl}/${id}/title`, { title });
}
delete(id: string): Observable<void> {
return this.http.delete<void>(`${this.apiUrl}/${id}`);
}
appendMessage(
id: string,
role: 'user' | 'assistant' | 'system',
content: string,
): Observable<ConversationMessage> {
return this.http.post<ConversationMessage>(`${this.apiUrl}/${id}/messages`, {
role,
content,
});
}
/** Declenche la generation auto du titre cote Brain. */
autoTitle(id: string): Observable<{ title: string }> {
return this.http.post<{ title: string }>(`${this.apiUrl}/${id}/auto-title`, {});
}
}