Initial commit: NexusArchitect Professional Workstation Overhaul
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
using NexusReader.Application.Abstractions.Messaging;
|
||||
|
||||
namespace NexusReader.Application.Queries.Graph;
|
||||
|
||||
public record GetKnowledgeGraphQuery : IQuery<GraphDataDto>;
|
||||
@@ -0,0 +1,30 @@
|
||||
using FluentResults;
|
||||
using NexusReader.Application.Abstractions.Messaging;
|
||||
|
||||
namespace NexusReader.Application.Queries.Graph;
|
||||
|
||||
internal sealed class GetKnowledgeGraphQueryHandler : IQueryHandler<GetKnowledgeGraphQuery, GraphDataDto>
|
||||
{
|
||||
public Task<Result<GraphDataDto>> Handle(GetKnowledgeGraphQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
var nodes = new List<GraphNodeDto>
|
||||
{
|
||||
new("renesans-intro", "Renesans", "Concept"),
|
||||
new("florencja", "Florencja", "Location"),
|
||||
new("medyceusze", "Medyceusze", "Entity"),
|
||||
new("da-vinci-ai", "Leonardo da Vinci", "Person"),
|
||||
new("humanizm", "Humanizm", "Concept")
|
||||
};
|
||||
|
||||
var links = new List<GraphLinkDto>
|
||||
{
|
||||
new("renesans-intro", "florencja", 1),
|
||||
new("florencja", "medyceusze", 2),
|
||||
new("medyceusze", "da-vinci-ai", 3),
|
||||
new("renesans-intro", "humanizm", 1),
|
||||
new("da-vinci-ai", "humanizm", 2)
|
||||
};
|
||||
|
||||
return Task.FromResult(Result.Ok(new GraphDataDto(nodes, links)));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
namespace NexusReader.Application.Queries.Graph;
|
||||
|
||||
public record GraphNodeDto(string Id, string Label, string Group);
|
||||
public record GraphLinkDto(string Source, string Target, int Value);
|
||||
public record GraphDataDto(List<GraphNodeDto> Nodes, List<GraphLinkDto> Links);
|
||||
@@ -0,0 +1,5 @@
|
||||
using NexusReader.Application.Abstractions.Messaging;
|
||||
|
||||
namespace NexusReader.Application.Queries.Quiz;
|
||||
|
||||
public record GetQuizQuestionsQuery(string ContextBlockId) : IQuery<QuizDto>;
|
||||
@@ -0,0 +1,20 @@
|
||||
using FluentResults;
|
||||
using NexusReader.Application.Abstractions.Messaging;
|
||||
using NexusReader.Application.Abstractions.Services;
|
||||
|
||||
namespace NexusReader.Application.Queries.Quiz;
|
||||
|
||||
internal sealed class GetQuizQuestionsQueryHandler : IQueryHandler<GetQuizQuestionsQuery, QuizDto>
|
||||
{
|
||||
private readonly IAiGenerateQuizService _aiService;
|
||||
|
||||
public GetQuizQuestionsQueryHandler(IAiGenerateQuizService aiService)
|
||||
{
|
||||
_aiService = aiService;
|
||||
}
|
||||
|
||||
public async Task<Result<QuizDto>> Handle(GetQuizQuestionsQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
return await _aiService.GenerateQuizAsync(request.ContextBlockId, cancellationToken);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
namespace NexusReader.Application.Queries.Quiz;
|
||||
|
||||
public record QuizQuestionDto(string Question, List<string> Options, int CorrectIndex);
|
||||
public record QuizDto(List<QuizQuestionDto> Questions);
|
||||
@@ -0,0 +1,5 @@
|
||||
using NexusReader.Application.Abstractions.Messaging;
|
||||
|
||||
namespace NexusReader.Application.Queries.Reader;
|
||||
|
||||
public record GetReaderPageQuery : IQuery<ReaderPageViewModel>;
|
||||
@@ -0,0 +1,20 @@
|
||||
using FluentResults;
|
||||
using NexusReader.Application.Abstractions.Messaging;
|
||||
|
||||
namespace NexusReader.Application.Queries.Reader;
|
||||
|
||||
internal sealed class GetReaderPageQueryHandler : IQueryHandler<GetReaderPageQuery, ReaderPageViewModel>
|
||||
{
|
||||
public Task<Result<ReaderPageViewModel>> Handle(GetReaderPageQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
var blocks = new List<ContentBlock>
|
||||
{
|
||||
new TextSegmentBlock("renesans-intro", "Renesans, nazywany również odrodzeniem, to epoka w historii kultury europejskiej, która zapoczątkowała odejście od średniowiecznego teocentryzmu na rzecz humanizmu. Narodził się we Włoszech, a dokładnie we Florencji, w XV wieku, skąd promieniował na całą Europę."),
|
||||
new TextSegmentBlock("medyceusze", "Głównym mecenasem sztuki i nauki we Florencji był potężny ród Medyceuszy. To dzięki ich wsparciu miasto stało się kolebką nowożytnej myśli, gromadząc wokół siebie najwybitniejsze umysły tamtych czasów."),
|
||||
new AiActionTriggerBlock("da-vinci-ai", "Leonardo da Vinci był jednym z najważniejszych twórców tego okresu. Czy chciałbyś dowiedzieć się więcej o jego najważniejszych wynalazkach, czy wolisz sprawdzić swoją dotychczasową wiedzę?", new List<string> { "Pokaż więcej", "Rozwiąż quiz" }),
|
||||
new TextSegmentBlock("leonardo-detail", "Człowiek renesansu, uosabiany właśnie przez Leonarda, był wszechstronnie wykształcony. Interesował się sztuką, inżynierią, anatomią i filozofią, stawiając jednostkę w centrum wszechświata.")
|
||||
};
|
||||
|
||||
return Task.FromResult(Result.Ok(new ReaderPageViewModel(blocks)));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace NexusReader.Application.Queries.Reader;
|
||||
|
||||
public abstract record ContentBlock(string Id);
|
||||
public record TextSegmentBlock(string Id, string Content) : ContentBlock(Id);
|
||||
public record AiActionTriggerBlock(string Id, string Dialogue, List<string> ActionOptions) : ContentBlock(Id);
|
||||
|
||||
public record ReaderPageViewModel(List<ContentBlock> Blocks);
|
||||
@@ -0,0 +1,5 @@
|
||||
using NexusReader.Application.Abstractions.Messaging;
|
||||
|
||||
namespace NexusReader.Application.Queries.System;
|
||||
|
||||
public record GetInitializationStatusQuery : IQuery<string>;
|
||||
@@ -0,0 +1,12 @@
|
||||
using FluentResults;
|
||||
using NexusReader.Application.Abstractions.Messaging;
|
||||
|
||||
namespace NexusReader.Application.Queries.System;
|
||||
|
||||
internal sealed class GetInitializationStatusQueryHandler : IQueryHandler<GetInitializationStatusQuery, string>
|
||||
{
|
||||
public Task<Result<string>> Handle(GetInitializationStatusQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
return Task.FromResult(Result.Ok("Nexus E-Reader Application is fully initialized and operational."));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user