Plusieurs gros ajouts :
- Possibilité de discuter avec un PDF ; RAG ou analyse approfondie. Enlèvement de l'autre outil PDF de discussion qui analysait d'abord un PDF en proposant directement une intégration sans attendre qu'on pose de question - Mise en place de l'import directement dans les outils dans la sidebar - Mise en place d'un outil pour créer des tables aléatoires avec possibilité d'utiliser pendant la partie - Mise en place d'un outil pour mettre en place des PNJ, scènes, chapitre.... directement à partir de la discussion avec le PDF - Mise en place RAG avec mistal-embeding ou nomic si on utilise ollama - Mise en place mistral, google en fournisseurs alternatifs pour l'IA dans le cloud - version 0.11.0-bêta
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { LucideAngularModule, ArrowLeft, Edit3, Dices } from 'lucide-angular';
|
||||
import { RandomTableService } from '../../../services/random-table.service';
|
||||
import { CampaignSidebarService } from '../../../services/campaign-sidebar.service';
|
||||
import { RandomTable, RandomTableEntry } from '../../../services/random-table.model';
|
||||
import { DiceUtils, DiceRoll } from '../../../shared/dice.utils';
|
||||
|
||||
/**
|
||||
* Vue d'une table aléatoire : affiche les entrées et permet de LANCER le dé
|
||||
* (jet côté client) → surligne l'entrée tombée + montre son détail.
|
||||
* Route : /campaigns/:campaignId/random-tables/:tableId
|
||||
*/
|
||||
@Component({
|
||||
selector: 'app-random-table-view',
|
||||
standalone: true,
|
||||
imports: [CommonModule, LucideAngularModule],
|
||||
templateUrl: './random-table-view.component.html',
|
||||
styleUrls: ['./random-table-view.component.scss']
|
||||
})
|
||||
export class RandomTableViewComponent implements OnInit {
|
||||
readonly ArrowLeft = ArrowLeft;
|
||||
readonly Edit3 = Edit3;
|
||||
readonly Dices = Dices;
|
||||
|
||||
campaignId: string | null = null;
|
||||
tableId: string | null = null;
|
||||
table: RandomTable | null = null;
|
||||
|
||||
lastRoll: DiceRoll | null = null;
|
||||
matched: RandomTableEntry | null = null;
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private service: RandomTableService,
|
||||
private campaignSidebar: CampaignSidebarService
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
const params = this.route.snapshot.paramMap;
|
||||
this.campaignId = params.get('campaignId');
|
||||
this.tableId = params.get('tableId');
|
||||
if (this.tableId) {
|
||||
this.service.getById(this.tableId).subscribe({
|
||||
next: t => this.table = t,
|
||||
error: () => this.back()
|
||||
});
|
||||
}
|
||||
if (this.campaignId) {
|
||||
this.campaignSidebar.show(this.campaignId);
|
||||
}
|
||||
}
|
||||
|
||||
roll(): void {
|
||||
if (!this.table) return;
|
||||
const result = DiceUtils.roll(this.table.diceFormula);
|
||||
if (!result) { this.lastRoll = null; this.matched = null; return; }
|
||||
this.lastRoll = result;
|
||||
this.matched = this.table.entries.find(
|
||||
e => result.total >= e.minRoll && result.total <= e.maxRoll
|
||||
) ?? null;
|
||||
}
|
||||
|
||||
isMatched(entry: RandomTableEntry): boolean {
|
||||
return this.matched === entry;
|
||||
}
|
||||
|
||||
rangeLabel(entry: RandomTableEntry): string {
|
||||
return entry.minRoll === entry.maxRoll
|
||||
? String(entry.minRoll)
|
||||
: `${entry.minRoll}–${entry.maxRoll}`;
|
||||
}
|
||||
|
||||
edit(): void {
|
||||
if (this.campaignId && this.tableId) {
|
||||
this.router.navigate(['/campaigns', this.campaignId, 'random-tables', this.tableId, 'edit']);
|
||||
}
|
||||
}
|
||||
|
||||
back(): void {
|
||||
this.router.navigate(this.campaignId ? ['/campaigns', this.campaignId] : ['/campaigns']);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user