adding new mindforge applications
All checks were successful
Mindforge API Build and Deploy / Build Mindforge API Image (push) Successful in 1m8s
Mindforge Cronjob Build and Deploy / Build Mindforge Cronjob Image (push) Successful in 1m19s
Mindforge API Build and Deploy / Deploy Mindforge API (internal) (push) Successful in 11s
Mindforge Cronjob Build and Deploy / Deploy Mindforge Cronjob (internal) (push) Successful in 10s
Mindforge Web Build and Deploy (internal) / Build Mindforge Web Image (push) Successful in 2m25s
Mindforge Web Build and Deploy (internal) / Deploy Mindforge Web (internal) (push) Successful in 12s
All checks were successful
Mindforge API Build and Deploy / Build Mindforge API Image (push) Successful in 1m8s
Mindforge Cronjob Build and Deploy / Build Mindforge Cronjob Image (push) Successful in 1m19s
Mindforge API Build and Deploy / Deploy Mindforge API (internal) (push) Successful in 11s
Mindforge Cronjob Build and Deploy / Deploy Mindforge Cronjob (internal) (push) Successful in 10s
Mindforge Web Build and Deploy (internal) / Build Mindforge Web Image (push) Successful in 2m25s
Mindforge Web Build and Deploy (internal) / Deploy Mindforge Web (internal) (push) Successful in 12s
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
name: Mindforge Web Build and Deploy
|
||||
name: Mindforge Web Build and Deploy (internal)
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -14,6 +14,7 @@ env:
|
||||
REGISTRY_USERNAME: ivanch
|
||||
IMAGE_WEB: ${{ env.REGISTRY_HOST }}/ivanch/mindforge-web
|
||||
KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }}
|
||||
VITE_API_BASE_URL: http://api.mindforge.haven
|
||||
|
||||
jobs:
|
||||
build_mindforge_web:
|
||||
@@ -41,7 +42,7 @@ jobs:
|
||||
context: Mindforge.Web
|
||||
platforms: linux/amd64,linux/arm64
|
||||
build-args: |
|
||||
VITE_API_BASE_URL=${{ secrets.VITE_API_BASE_URL }}
|
||||
VITE_API_BASE_URL=${{ env.VITE_API_BASE_URL }}
|
||||
tags: |
|
||||
${{ env.IMAGE_WEB }}:latest
|
||||
|
||||
|
||||
3
Mindforge.API/.gitignore
vendored
Normal file
3
Mindforge.API/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
bin
|
||||
obj
|
||||
appsettings.Development.json
|
||||
43
Mindforge.API/Controllers/FileController.cs
Normal file
43
Mindforge.API/Controllers/FileController.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Mindforge.API.Exceptions;
|
||||
using Mindforge.API.Models.Requests;
|
||||
using Mindforge.API.Services.Interfaces;
|
||||
|
||||
namespace Mindforge.API.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/v1/file")]
|
||||
public class FileController : ControllerBase
|
||||
{
|
||||
private readonly IFileService _fileService;
|
||||
|
||||
public FileController(IFileService fileService)
|
||||
{
|
||||
_fileService = fileService;
|
||||
}
|
||||
|
||||
[HttpPost("check")]
|
||||
public async Task<IActionResult> CheckFile([FromBody] FileCheckRequest request)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(request.FileContent) || string.IsNullOrWhiteSpace(request.CheckType))
|
||||
{
|
||||
throw new UserException("FileContent and CheckType are required.");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var base64Bytes = Convert.FromBase64String(request.FileContent);
|
||||
request.FileContent = System.Text.Encoding.UTF8.GetString(base64Bytes);
|
||||
}
|
||||
catch (FormatException)
|
||||
{
|
||||
throw new UserException("FileContent must be a valid base64 string.");
|
||||
}
|
||||
|
||||
var response = await _fileService.CheckFileAsync(request);
|
||||
return Ok(new { result = response });
|
||||
}
|
||||
}
|
||||
}
|
||||
43
Mindforge.API/Controllers/FlashcardController.cs
Normal file
43
Mindforge.API/Controllers/FlashcardController.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Mindforge.API.Exceptions;
|
||||
using Mindforge.API.Models.Requests;
|
||||
using Mindforge.API.Services.Interfaces;
|
||||
|
||||
namespace Mindforge.API.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/v1/flashcard")]
|
||||
public class FlashcardController : ControllerBase
|
||||
{
|
||||
private readonly IFlashcardService _flashcardService;
|
||||
|
||||
public FlashcardController(IFlashcardService flashcardService)
|
||||
{
|
||||
_flashcardService = flashcardService;
|
||||
}
|
||||
|
||||
[HttpPost("generate")]
|
||||
public async Task<IActionResult> Generate([FromBody] FlashcardGenerateRequest request)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(request.FileContent) || request.Amount <= 0)
|
||||
{
|
||||
throw new UserException("FileContent is required and Amount must be greater than 0.");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var base64Bytes = Convert.FromBase64String(request.FileContent);
|
||||
request.FileContent = System.Text.Encoding.UTF8.GetString(base64Bytes);
|
||||
}
|
||||
catch (FormatException)
|
||||
{
|
||||
throw new UserException("FileContent must be a valid base64 string.");
|
||||
}
|
||||
|
||||
var response = await _flashcardService.GenerateFlashcardsAsync(request);
|
||||
return Ok(new { result = response });
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Mindforge.API/Exceptions/UserException.cs
Normal file
11
Mindforge.API/Exceptions/UserException.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using System;
|
||||
|
||||
namespace Mindforge.API.Exceptions
|
||||
{
|
||||
public class UserException : Exception
|
||||
{
|
||||
public UserException(string message) : base(message)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
47
Mindforge.API/Middlewares/ExceptionHandlingMiddleware.cs
Normal file
47
Mindforge.API/Middlewares/ExceptionHandlingMiddleware.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using System.Text.Json;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Mindforge.API.Exceptions;
|
||||
|
||||
namespace Mindforge.API.Middlewares
|
||||
{
|
||||
public class ExceptionHandlingMiddleware
|
||||
{
|
||||
private readonly RequestDelegate _next;
|
||||
private readonly ILogger<ExceptionHandlingMiddleware> _logger;
|
||||
|
||||
public ExceptionHandlingMiddleware(RequestDelegate next, ILogger<ExceptionHandlingMiddleware> logger)
|
||||
{
|
||||
_next = next;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public async Task InvokeAsync(HttpContext context)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _next(context);
|
||||
}
|
||||
catch (UserException ex)
|
||||
{
|
||||
_logger.LogWarning(ex, "User error");
|
||||
await HandleExceptionAsync(context, StatusCodes.Status400BadRequest, ex.Message);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Internal server error");
|
||||
await HandleExceptionAsync(context, StatusCodes.Status500InternalServerError, $"Internal server error: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
private static Task HandleExceptionAsync(HttpContext context, int statusCode, string message)
|
||||
{
|
||||
context.Response.ContentType = "application/json";
|
||||
context.Response.StatusCode = statusCode;
|
||||
|
||||
var result = JsonSerializer.Serialize(new { error = message });
|
||||
return context.Response.WriteAsync(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
13
Mindforge.API/Mindforge.API.csproj
Normal file
13
Mindforge.API/Mindforge.API.csproj
Normal file
@@ -0,0 +1,13 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.12" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
6
Mindforge.API/Mindforge.API.http
Normal file
6
Mindforge.API/Mindforge.API.http
Normal file
@@ -0,0 +1,6 @@
|
||||
@Mindforge.API_HostAddress = http://localhost:5123
|
||||
|
||||
GET {{Mindforge.API_HostAddress}}/weatherforecast/
|
||||
Accept: application/json
|
||||
|
||||
###
|
||||
8
Mindforge.API/Models/Enums/LlmProvider.cs
Normal file
8
Mindforge.API/Models/Enums/LlmProvider.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace Mindforge.API.Models.Enums
|
||||
{
|
||||
public enum LlmProvider
|
||||
{
|
||||
OpenAI,
|
||||
Gemini
|
||||
}
|
||||
}
|
||||
13
Mindforge.API/Models/Requests/FileCheckRequest.cs
Normal file
13
Mindforge.API/Models/Requests/FileCheckRequest.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
namespace Mindforge.API.Models.Requests
|
||||
{
|
||||
public class FileCheckRequest
|
||||
{
|
||||
public string FileContent { get; set; } = string.Empty;
|
||||
public string FileName { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Expected values: "language" or "content"
|
||||
/// </summary>
|
||||
public string CheckType { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
21
Mindforge.API/Models/Requests/FlashcardGenerateRequest.cs
Normal file
21
Mindforge.API/Models/Requests/FlashcardGenerateRequest.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Mindforge.API.Models.Requests
|
||||
{
|
||||
public class FlashcardGenerateRequest
|
||||
{
|
||||
public string FileContent { get; set; } = string.Empty;
|
||||
public string FileName { get; set; } = string.Empty;
|
||||
public int Amount { get; set; }
|
||||
[JsonConverter(typeof(JsonStringEnumConverter))]
|
||||
public FlashcardMode? Mode { get; set; } = FlashcardMode.Simple;
|
||||
}
|
||||
|
||||
public enum FlashcardMode
|
||||
{
|
||||
Basic,
|
||||
Simple,
|
||||
Detailed,
|
||||
Hyper
|
||||
}
|
||||
}
|
||||
71
Mindforge.API/Program.cs
Normal file
71
Mindforge.API/Program.cs
Normal file
@@ -0,0 +1,71 @@
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Mindforge.API.Providers;
|
||||
using Mindforge.API.Services;
|
||||
using Mindforge.API.Services.Interfaces;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// Add services to the container.
|
||||
builder.Services.AddControllers();
|
||||
builder.Logging.AddConsole();
|
||||
builder.Logging.AddDebug();
|
||||
|
||||
// Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi
|
||||
builder.Services.AddOpenApi();
|
||||
|
||||
// Configure CORS
|
||||
builder.Services.AddCors(options =>
|
||||
{
|
||||
options.AddPolicy("AllowAll", policy =>
|
||||
{
|
||||
policy.AllowAnyOrigin()
|
||||
.AllowAnyMethod()
|
||||
.AllowAnyHeader();
|
||||
});
|
||||
});
|
||||
|
||||
// Register HttpClient for providers
|
||||
builder.Services.AddHttpClient();
|
||||
|
||||
// Register Providers
|
||||
builder.Services.AddScoped<ILlmApiProvider, OpenAIApiProvider>();
|
||||
builder.Services.AddScoped<ILlmApiProvider, GeminiApiProvider>();
|
||||
|
||||
// Register Services
|
||||
builder.Services.AddScoped<IAgentService, AgentService>();
|
||||
builder.Services.AddScoped<IFileService, FileService>();
|
||||
builder.Services.AddScoped<IFlashcardService, FlashcardService>();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
app.UseCors("AllowAll");
|
||||
|
||||
app.UseMiddleware<Mindforge.API.Middlewares.ExceptionHandlingMiddleware>();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
if (app.Environment.IsDevelopment())
|
||||
{
|
||||
app.MapOpenApi();
|
||||
}
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
app.UseAuthorization();
|
||||
app.MapControllers();
|
||||
|
||||
// Check for env vars
|
||||
var openAiKey = builder.Configuration["OPENAI_API_KEY"];
|
||||
var geminiKey = builder.Configuration["GEMINI_API_KEY"];
|
||||
|
||||
if (string.IsNullOrEmpty(openAiKey))
|
||||
{
|
||||
app.Logger.LogWarning("OPENAI_API_KEY not found in configuration.");
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(geminiKey))
|
||||
{
|
||||
app.Logger.LogWarning("GEMINI_API_KEY not found in configuration.");
|
||||
}
|
||||
|
||||
app.Run();
|
||||
23
Mindforge.API/Properties/launchSettings.json
Normal file
23
Mindforge.API/Properties/launchSettings.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/launchsettings.json",
|
||||
"profiles": {
|
||||
"http": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": false,
|
||||
"applicationUrl": "http://localhost:5123",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"https": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": false,
|
||||
"applicationUrl": "https://localhost:7116;http://localhost:5123",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
202
Mindforge.API/Providers/GeminiApiProvider.cs
Normal file
202
Mindforge.API/Providers/GeminiApiProvider.cs
Normal file
@@ -0,0 +1,202 @@
|
||||
using System;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
||||
namespace Mindforge.API.Providers
|
||||
{
|
||||
public class GeminiApiProvider : ILlmApiProvider
|
||||
{
|
||||
private readonly HttpClient _httpClient;
|
||||
private readonly IConfiguration _configuration;
|
||||
private readonly ILogger<GeminiApiProvider> _logger;
|
||||
|
||||
public GeminiApiProvider(HttpClient httpClient, IConfiguration configuration, ILogger<GeminiApiProvider> logger)
|
||||
{
|
||||
_httpClient = httpClient;
|
||||
_httpClient.Timeout = TimeSpan.FromMinutes(5);
|
||||
_configuration = configuration;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public async Task<string> SendRequestAsync(string systemPrompt, string userPrompt, string model)
|
||||
{
|
||||
var apiKey = _configuration["GEMINI_API_KEY"];
|
||||
if (string.IsNullOrEmpty(apiKey))
|
||||
{
|
||||
throw new Exception("GEMINI_API_KEY not found in configuration.");
|
||||
}
|
||||
|
||||
var apiBase = "https://generativelanguage.googleapis.com/v1beta";
|
||||
var url = $"{apiBase.TrimEnd('/')}/models/{model}:generateContent?key={apiKey}";
|
||||
|
||||
var reqBody = new
|
||||
{
|
||||
system_instruction = string.IsNullOrEmpty(systemPrompt) ? null : new
|
||||
{
|
||||
parts = new[] { new { text = systemPrompt } }
|
||||
},
|
||||
contents = new[]
|
||||
{
|
||||
new
|
||||
{
|
||||
role = "user",
|
||||
parts = new[] { new { text = userPrompt } }
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var jsonBody = JsonSerializer.Serialize(reqBody, new JsonSerializerOptions { DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull });
|
||||
|
||||
using var request = new HttpRequestMessage(HttpMethod.Post, url);
|
||||
request.Content = new StringContent(jsonBody, Encoding.UTF8, "application/json");
|
||||
|
||||
var response = await _httpClient.SendAsync(request);
|
||||
var responseBody = await response.Content.ReadAsStringAsync();
|
||||
|
||||
if (!response.IsSuccessStatusCode)
|
||||
{
|
||||
throw new Exception($"Gemini API error status {(int)response.StatusCode}: {responseBody}");
|
||||
}
|
||||
|
||||
var result = JsonSerializer.Deserialize<JsonElement>(responseBody);
|
||||
if (result.TryGetProperty("candidates", out var candidates) && candidates.GetArrayLength() > 0)
|
||||
{
|
||||
var content = candidates[0].GetProperty("content");
|
||||
if (content.TryGetProperty("parts", out var parts) && parts.GetArrayLength() > 0)
|
||||
{
|
||||
return parts[0].GetProperty("text").GetString() ?? string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
throw new Exception("empty response from Gemini API");
|
||||
}
|
||||
|
||||
public async Task<string> SendRequestBatchAsync(string systemPrompt, string userPrompt, string model)
|
||||
{
|
||||
var apiKey = _configuration["GEMINI_API_KEY"];
|
||||
if (string.IsNullOrEmpty(apiKey))
|
||||
throw new Exception("GEMINI_API_KEY not found in configuration.");
|
||||
|
||||
var apiBase = "https://generativelanguage.googleapis.com/v1beta";
|
||||
var jsonOptions = new JsonSerializerOptions { DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull };
|
||||
|
||||
// Build single inline request
|
||||
var batchBody = new
|
||||
{
|
||||
batch = new
|
||||
{
|
||||
display_name = "mindforge-batch",
|
||||
input_config = new
|
||||
{
|
||||
requests = new
|
||||
{
|
||||
requests = new[]
|
||||
{
|
||||
new
|
||||
{
|
||||
request = new
|
||||
{
|
||||
system_instruction = string.IsNullOrEmpty(systemPrompt) ? null : new
|
||||
{
|
||||
parts = new[] { new { text = systemPrompt } }
|
||||
},
|
||||
contents = new[]
|
||||
{
|
||||
new
|
||||
{
|
||||
role = "user",
|
||||
parts = new[] { new { text = userPrompt } }
|
||||
}
|
||||
}
|
||||
},
|
||||
metadata = new { key = "request-1" }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Submit batch job
|
||||
var createUrl = $"{apiBase}/models/{model}:batchGenerateContent?key={apiKey}";
|
||||
using var createReq = new HttpRequestMessage(HttpMethod.Post, createUrl);
|
||||
createReq.Content = new StringContent(JsonSerializer.Serialize(batchBody, jsonOptions), Encoding.UTF8, "application/json");
|
||||
|
||||
var createResp = await _httpClient.SendAsync(createReq);
|
||||
var createBody = await createResp.Content.ReadAsStringAsync();
|
||||
if (!createResp.IsSuccessStatusCode)
|
||||
throw new Exception($"Gemini Batch API error creating job {(int)createResp.StatusCode}: {createBody}");
|
||||
|
||||
_logger.LogInformation("Gemini Batch API job created");
|
||||
|
||||
var createResult = JsonSerializer.Deserialize<JsonElement>(createBody);
|
||||
if (!createResult.TryGetProperty("name", out var nameEl))
|
||||
throw new Exception("Gemini Batch API did not return a job name.");
|
||||
|
||||
var batchName = nameEl.GetString()!;
|
||||
var pollUrl = $"{apiBase}/{batchName}?key={apiKey}";
|
||||
|
||||
_logger.LogInformation("Gemini Batch API job name: {BatchName}", batchName);
|
||||
|
||||
// Poll until terminal state
|
||||
while (true)
|
||||
{
|
||||
await Task.Delay(TimeSpan.FromSeconds(10));
|
||||
|
||||
using var pollReq = new HttpRequestMessage(HttpMethod.Get, pollUrl);
|
||||
var pollResp = await _httpClient.SendAsync(pollReq);
|
||||
var pollBody = await pollResp.Content.ReadAsStringAsync();
|
||||
|
||||
if (!pollResp.IsSuccessStatusCode)
|
||||
throw new Exception($"Gemini Batch API error polling status {(int)pollResp.StatusCode}: {pollBody}");
|
||||
|
||||
var pollResult = JsonSerializer.Deserialize<JsonElement>(pollBody);
|
||||
var metadata = pollResult.GetProperty("metadata");
|
||||
var state = metadata.GetProperty("state");
|
||||
|
||||
_logger.LogInformation("Gemini Batch API job state: {State}", state.GetString());
|
||||
|
||||
switch (state.GetString())
|
||||
{
|
||||
case "BATCH_STATE_SUCCEEDED":
|
||||
if (pollResult.TryGetProperty("response", out var batchResponse) &&
|
||||
batchResponse.TryGetProperty("inlinedResponses", out var inlinedResponses) &&
|
||||
inlinedResponses.TryGetProperty("inlinedResponses", out var inlinedResponsesInternal) &&
|
||||
inlinedResponsesInternal.GetArrayLength() > 0)
|
||||
{
|
||||
_logger.LogInformation("Gemini Batch API job succeeded");
|
||||
|
||||
var first = inlinedResponsesInternal[0];
|
||||
if (first.TryGetProperty("error", out var reqError))
|
||||
throw new Exception($"Gemini Batch request error: {reqError}");
|
||||
|
||||
if (first.TryGetProperty("response", out var innerResponse) &&
|
||||
innerResponse.TryGetProperty("candidates", out var candidates) &&
|
||||
candidates.GetArrayLength() > 0)
|
||||
{
|
||||
var content = candidates[0].GetProperty("content");
|
||||
if (content.TryGetProperty("parts", out var parts) && parts.GetArrayLength() > 0)
|
||||
return parts[0].GetProperty("text").GetString() ?? string.Empty;
|
||||
}
|
||||
}
|
||||
throw new Exception("Gemini Batch job succeeded but returned no content.");
|
||||
|
||||
case "BATCH_STATE_FAILED":
|
||||
throw new Exception($"Gemini Batch job failed: {pollBody}");
|
||||
|
||||
case "BATCH_STATE_CANCELLED":
|
||||
throw new Exception("Gemini Batch job was cancelled.");
|
||||
|
||||
case "BATCH_STATE_EXPIRED":
|
||||
throw new Exception("Gemini Batch job expired before completing.");
|
||||
|
||||
// BATCH_STATE_PENDING / BATCH_STATE_RUNNING — keep polling
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
10
Mindforge.API/Providers/ILlmApiProvider.cs
Normal file
10
Mindforge.API/Providers/ILlmApiProvider.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Mindforge.API.Providers
|
||||
{
|
||||
public interface ILlmApiProvider
|
||||
{
|
||||
Task<string> SendRequestAsync(string systemPrompt, string userPrompt, string model);
|
||||
Task<string> SendRequestBatchAsync(string systemPrompt, string userPrompt, string model);
|
||||
}
|
||||
}
|
||||
110
Mindforge.API/Providers/OpenAIApiProvider.cs
Normal file
110
Mindforge.API/Providers/OpenAIApiProvider.cs
Normal file
@@ -0,0 +1,110 @@
|
||||
using System;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
||||
namespace Mindforge.API.Providers
|
||||
{
|
||||
public class OpenAIApiProvider : ILlmApiProvider
|
||||
{
|
||||
private readonly HttpClient _httpClient;
|
||||
private readonly IConfiguration _configuration;
|
||||
private readonly ILogger<OpenAIApiProvider> _logger;
|
||||
|
||||
public OpenAIApiProvider(HttpClient httpClient, IConfiguration configuration, ILogger<OpenAIApiProvider> logger)
|
||||
{
|
||||
_httpClient = httpClient;
|
||||
_httpClient.Timeout = TimeSpan.FromMinutes(5);
|
||||
_configuration = configuration;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public async Task<string> SendRequestAsync(string systemPrompt, string userPrompt, string model)
|
||||
{
|
||||
var apiKey = _configuration["OPENAI_API_KEY"];
|
||||
if (string.IsNullOrEmpty(apiKey))
|
||||
{
|
||||
throw new Exception("OPENAI_API_KEY not found in configuration.");
|
||||
}
|
||||
|
||||
var apiBase = "https://api.openai.com/v1";
|
||||
var url = $"{apiBase.TrimEnd('/')}/responses";
|
||||
|
||||
var reqBody = new
|
||||
{
|
||||
model = model,
|
||||
input = new[]
|
||||
{
|
||||
new { role = "developer", content = systemPrompt },
|
||||
new { role = "user", content = userPrompt }
|
||||
},
|
||||
reasoning = new
|
||||
{
|
||||
effort = "low"
|
||||
}
|
||||
};
|
||||
|
||||
var jsonBody = JsonSerializer.Serialize(reqBody);
|
||||
|
||||
Exception? lastErr = null;
|
||||
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
using var request = new HttpRequestMessage(HttpMethod.Post, url);
|
||||
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", apiKey);
|
||||
request.Content = new StringContent(jsonBody, Encoding.UTF8, "application/json");
|
||||
|
||||
try
|
||||
{
|
||||
var response = await _httpClient.SendAsync(request);
|
||||
var responseBody = await response.Content.ReadAsStringAsync();
|
||||
|
||||
if (!response.IsSuccessStatusCode)
|
||||
{
|
||||
lastErr = new Exception($"OpenAI API error status {(int)response.StatusCode}: {responseBody}");
|
||||
await Task.Delay(TimeSpan.FromSeconds(1 << i));
|
||||
continue;
|
||||
}
|
||||
|
||||
var result = JsonSerializer.Deserialize<JsonElement>(responseBody);
|
||||
if (result.TryGetProperty("output", out var outputArray))
|
||||
{
|
||||
foreach (var outputItem in outputArray.EnumerateArray())
|
||||
{
|
||||
if (outputItem.TryGetProperty("content", out var contentArray))
|
||||
{
|
||||
foreach (var contentItem in contentArray.EnumerateArray())
|
||||
{
|
||||
if (contentItem.TryGetProperty("text", out var textContent))
|
||||
{
|
||||
return textContent.GetString() ?? string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_logger.LogWarning("OpenAI API raw response: {responseBody}", responseBody);
|
||||
|
||||
throw new Exception("empty response from OpenAI API");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in OpenAI API request");
|
||||
lastErr = ex;
|
||||
await Task.Delay(TimeSpan.FromSeconds(1 << i));
|
||||
}
|
||||
}
|
||||
|
||||
throw new Exception($"failed to get OpenAI response after 5 attempts. Last error: {lastErr?.Message}", lastErr);
|
||||
}
|
||||
|
||||
public async Task<string> SendRequestBatchAsync(string systemPrompt, string userPrompt, string model)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
48
Mindforge.API/Services/AgentService.cs
Normal file
48
Mindforge.API/Services/AgentService.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Mindforge.API.Models.Enums;
|
||||
using Mindforge.API.Providers;
|
||||
using Mindforge.API.Services.Interfaces;
|
||||
|
||||
namespace Mindforge.API.Services
|
||||
{
|
||||
public class AgentService : IAgentService
|
||||
{
|
||||
private readonly IEnumerable<ILlmApiProvider> _providers;
|
||||
|
||||
public AgentService(IEnumerable<ILlmApiProvider> providers)
|
||||
{
|
||||
_providers = providers;
|
||||
}
|
||||
|
||||
public Task<string> ProcessRequestAsync(LlmProvider providerEnum, string systemPrompt, string userPrompt, string model)
|
||||
{
|
||||
ILlmApiProvider provider = providerEnum switch
|
||||
{
|
||||
LlmProvider.OpenAI => _providers.OfType<OpenAIApiProvider>().FirstOrDefault()
|
||||
?? throw new Exception("OpenAI provider not registered"),
|
||||
LlmProvider.Gemini => _providers.OfType<GeminiApiProvider>().FirstOrDefault()
|
||||
?? throw new Exception("Gemini provider not registered"),
|
||||
_ => throw new Exception("Unknown provider")
|
||||
};
|
||||
|
||||
return provider.SendRequestAsync(systemPrompt, userPrompt, model);
|
||||
}
|
||||
|
||||
public Task<string> ProcessRequestBatchAsync(LlmProvider providerEnum, string systemPrompt, string userPrompt, string model)
|
||||
{
|
||||
ILlmApiProvider provider = providerEnum switch
|
||||
{
|
||||
LlmProvider.OpenAI => _providers.OfType<OpenAIApiProvider>().FirstOrDefault()
|
||||
?? throw new Exception("OpenAI provider not registered"),
|
||||
LlmProvider.Gemini => _providers.OfType<GeminiApiProvider>().FirstOrDefault()
|
||||
?? throw new Exception("Gemini provider not registered"),
|
||||
_ => throw new Exception("Unknown provider")
|
||||
};
|
||||
|
||||
return provider.SendRequestBatchAsync(systemPrompt, userPrompt, model);
|
||||
}
|
||||
}
|
||||
}
|
||||
61
Mindforge.API/Services/FileService.cs
Normal file
61
Mindforge.API/Services/FileService.cs
Normal file
@@ -0,0 +1,61 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Mindforge.API.Models.Enums;
|
||||
using Mindforge.API.Models.Requests;
|
||||
using Mindforge.API.Services.Interfaces;
|
||||
using Mindforge.API.Exceptions;
|
||||
|
||||
namespace Mindforge.API.Services
|
||||
{
|
||||
public class FileService : IFileService
|
||||
{
|
||||
private readonly IAgentService _agentService;
|
||||
|
||||
private const LlmProvider DefaultProvider = LlmProvider.OpenAI;
|
||||
private const string DefaultModel = "gpt-5-mini";
|
||||
|
||||
public FileService(IAgentService agentService)
|
||||
{
|
||||
_agentService = agentService;
|
||||
}
|
||||
|
||||
public async Task<string> CheckFileAsync(FileCheckRequest request)
|
||||
{
|
||||
string systemPrompt;
|
||||
|
||||
if (request.CheckType.ToLower() == "language")
|
||||
{
|
||||
systemPrompt = $@"Você é um revisor de textos sênior e especialista em língua portuguesa do Brasil.
|
||||
Sua tarefa é analisar o texto fornecido e corrigir rigorosamente todos os erros gramaticais, de concordância, pontuação, garantindo clareza, coesão e fluidez.
|
||||
Por favor, siga esta estrutura:
|
||||
1. Retorne o texto completamente revisado e polido.
|
||||
2. Não adicione nenhum texto adicional, apenas o texto revisado.
|
||||
3. Não altere o sentido do texto, mantenha a mesma ideia. Apenas corrija os erros gramaticais, de concordância e pontuação.
|
||||
Responda única e exclusivamente em português do Brasil.
|
||||
Foque em textos de concursos públicos, principalmente para a banca Cebraspe.";
|
||||
}
|
||||
else if (request.CheckType.ToLower() == "content")
|
||||
{
|
||||
systemPrompt = $@"Você é um analista de conteúdo experiente, especializado em revisão crítica e verificação de fatos.
|
||||
Sua tarefa é realizar uma análise rigorosa do texto fornecido, identificando erros lógicos, imprecisões de conteúdo, contradições internas e inconsistências argumentativas.
|
||||
Por favor, siga esta estrutura:
|
||||
1. Destaque cada problema encontrado no texto original.
|
||||
2. Explique detalhadamente por que é um erro ou inconsistência.
|
||||
3. Apresente sugestões claras e embasadas para reescrever ou corrigir os trechos problemáticos, melhorando a coerência e a lógica e a clareza do conteúdo.
|
||||
Responda única e exclusivamente em português do Brasil e mantenha um tom analítico e construtivo.
|
||||
|
||||
Responda em tópicos para ser apresentados ao usuário, sendo sucinto e não extremamente detalhado.
|
||||
Os resumos serão utilizados para concursos públicos, principalmente para a banca Cebraspe.
|
||||
";
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new UserException("Tipo de verificação inválido. Use 'language' ou 'content'.");
|
||||
}
|
||||
|
||||
string userPrompt = $"Arquivo: {request.FileName}\nConteúdo:\n{request.FileContent}";
|
||||
|
||||
return await _agentService.ProcessRequestAsync(DefaultProvider, systemPrompt, userPrompt, DefaultModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
83
Mindforge.API/Services/FlashcardService.cs
Normal file
83
Mindforge.API/Services/FlashcardService.cs
Normal file
@@ -0,0 +1,83 @@
|
||||
using System.Threading.Tasks;
|
||||
using Mindforge.API.Models.Enums;
|
||||
using Mindforge.API.Models.Requests;
|
||||
using Mindforge.API.Services.Interfaces;
|
||||
|
||||
namespace Mindforge.API.Services
|
||||
{
|
||||
public class FlashcardService : IFlashcardService
|
||||
{
|
||||
private readonly IAgentService _agentService;
|
||||
private readonly ILogger<FlashcardService> _logger;
|
||||
|
||||
private const LlmProvider DefaultProvider = LlmProvider.Gemini;
|
||||
private string DefaultModel = "gemini-3.1-flash-image-preview";
|
||||
|
||||
public FlashcardService(IAgentService agentService, ILogger<FlashcardService> logger)
|
||||
{
|
||||
_agentService = agentService;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public async Task<string> GenerateFlashcardsAsync(FlashcardGenerateRequest request)
|
||||
{
|
||||
var extraPrompt = "";
|
||||
|
||||
switch (request.Mode)
|
||||
{
|
||||
case FlashcardMode.Basic:
|
||||
DefaultModel = "gemini-3.1-flash-lite-preview";
|
||||
break;
|
||||
case FlashcardMode.Simple:
|
||||
DefaultModel = "gemini-3.1-flash-image-preview";
|
||||
break;
|
||||
case FlashcardMode.Detailed:
|
||||
DefaultModel = "gemini-3.1-flash-image-preview";
|
||||
extraPrompt = "Crie flashcards mais detalhados.";
|
||||
break;
|
||||
case FlashcardMode.Hyper:
|
||||
DefaultModel = "gemini-3.1-pro-preview";
|
||||
extraPrompt = "Adicione também pequenas questões para fixação, para que o usuário possa testar seus conhecimentos. As questões devem ser curtas e objetivas, como se fosse cobradas em prova mesmo.";
|
||||
break;
|
||||
}
|
||||
|
||||
string systemPrompt = $@"Você é um assistente educacional especializado em criar flashcards para o Anki.
|
||||
Baseado no texto fornecido, crie exatamente {request.Amount} flashcards que focam nos conceitos mais importantes e difíceis.
|
||||
A resposta FINAL deve ser APENAS no formato CSV, pronto para importação no Anki, sem nenhum texto adicional antes ou depois.
|
||||
O formato CSV deve ter duas colunas: a frente da carta (pergunta/conceito) e o verso (resposta/explicação). Use ponto e vírgula (;) como separador. Não adicione o cabeçalho.
|
||||
As perguntas e respostas devem estar estritamente em Português do Brasil.
|
||||
|
||||
Exemplo de saída:
|
||||
""Qual é a capital do Brasil?"";""Brasília""
|
||||
""Qual é a maior cidade do Brasil?"";""São Paulo""
|
||||
|
||||
Com base no arquivo fornecido, crie exatamente {request.Amount} flashcards que focam nos conceitos mais importantes e difíceis.
|
||||
{extraPrompt}
|
||||
";
|
||||
|
||||
string userPrompt = $"Arquivo: {request.FileName}\nConteúdo:\n{request.FileContent}";
|
||||
|
||||
//var result = await _agentService.ProcessRequestAsync(DefaultProvider, systemPrompt, userPrompt, DefaultModel);
|
||||
var result = await _agentService.ProcessRequestBatchAsync(DefaultProvider, systemPrompt, userPrompt, DefaultModel);
|
||||
|
||||
var lines = result.Split('\n');
|
||||
|
||||
if (lines.Length == 0)
|
||||
{
|
||||
throw new Exception("Nenhum flashcard gerado.");
|
||||
}
|
||||
|
||||
if (lines.Length > request.Amount)
|
||||
{
|
||||
_logger.LogWarning("Quantidade de flashcards excede o limite.");
|
||||
}
|
||||
|
||||
if (lines.Length < request.Amount)
|
||||
{
|
||||
_logger.LogWarning("Quantidade de flashcards abaixo do limite.");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Mindforge.API/Services/Interfaces/IAgentService.cs
Normal file
11
Mindforge.API/Services/Interfaces/IAgentService.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using System.Threading.Tasks;
|
||||
using Mindforge.API.Models.Enums;
|
||||
|
||||
namespace Mindforge.API.Services.Interfaces
|
||||
{
|
||||
public interface IAgentService
|
||||
{
|
||||
Task<string> ProcessRequestAsync(LlmProvider provider, string systemPrompt, string userPrompt, string model);
|
||||
Task<string> ProcessRequestBatchAsync(LlmProvider provider, string systemPrompt, string userPrompt, string model);
|
||||
}
|
||||
}
|
||||
10
Mindforge.API/Services/Interfaces/IFileService.cs
Normal file
10
Mindforge.API/Services/Interfaces/IFileService.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using System.Threading.Tasks;
|
||||
using Mindforge.API.Models.Requests;
|
||||
|
||||
namespace Mindforge.API.Services.Interfaces
|
||||
{
|
||||
public interface IFileService
|
||||
{
|
||||
Task<string> CheckFileAsync(FileCheckRequest request);
|
||||
}
|
||||
}
|
||||
10
Mindforge.API/Services/Interfaces/IFlashcardService.cs
Normal file
10
Mindforge.API/Services/Interfaces/IFlashcardService.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using System.Threading.Tasks;
|
||||
using Mindforge.API.Models.Requests;
|
||||
|
||||
namespace Mindforge.API.Services.Interfaces
|
||||
{
|
||||
public interface IFlashcardService
|
||||
{
|
||||
Task<string> GenerateFlashcardsAsync(FlashcardGenerateRequest request);
|
||||
}
|
||||
}
|
||||
9
Mindforge.API/appsettings.json
Normal file
9
Mindforge.API/appsettings.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
||||
@@ -49,3 +49,24 @@ spec:
|
||||
ports:
|
||||
- port: 80
|
||||
targetPort: 8080
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: mindforge-api
|
||||
namespace: mindforge
|
||||
labels:
|
||||
app.kubernetes.io/name: mindforge-api
|
||||
spec:
|
||||
ingressClassName: nginx
|
||||
rules:
|
||||
- host: "api.mindforge.haven"
|
||||
http:
|
||||
paths:
|
||||
- path: "/"
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: mindforge-api
|
||||
port:
|
||||
number: 80
|
||||
|
||||
1
Mindforge.Web/.env
Normal file
1
Mindforge.Web/.env
Normal file
@@ -0,0 +1 @@
|
||||
VITE_API_BASE_URL=http://localhost:5123
|
||||
1
Mindforge.Web/.env.dev
Normal file
1
Mindforge.Web/.env.dev
Normal file
@@ -0,0 +1 @@
|
||||
VITE_API_BASE_URL=http://localhost:5123
|
||||
24
Mindforge.Web/.gitignore
vendored
Normal file
24
Mindforge.Web/.gitignore
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
lerna-debug.log*
|
||||
|
||||
node_modules
|
||||
dist
|
||||
dist-ssr
|
||||
*.local
|
||||
|
||||
# Editor directories and files
|
||||
.vscode/*
|
||||
!.vscode/extensions.json
|
||||
.idea
|
||||
.DS_Store
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
@@ -38,3 +38,24 @@ spec:
|
||||
ports:
|
||||
- port: 80
|
||||
targetPort: 80
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: mindforge-web
|
||||
namespace: mindforge
|
||||
labels:
|
||||
app.kubernetes.io/name: mindforge-web
|
||||
spec:
|
||||
ingressClassName: nginx
|
||||
rules:
|
||||
- host: "mindforge.haven"
|
||||
http:
|
||||
paths:
|
||||
- path: "/"
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: mindforge-web
|
||||
port:
|
||||
number: 80
|
||||
|
||||
16
Mindforge.Web/index.html
Normal file
16
Mindforge.Web/index.html
Normal file
@@ -0,0 +1,16 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.ico" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Mindforge</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="/src/main.tsx"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
1897
Mindforge.Web/package-lock.json
generated
Normal file
1897
Mindforge.Web/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
24
Mindforge.Web/package.json
Normal file
24
Mindforge.Web/package.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"name": "mindforge-web",
|
||||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "tsc -b && vite build",
|
||||
"preview": "vite preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/marked": "^5.0.2",
|
||||
"diff": "^8.0.3",
|
||||
"marked": "^17.0.4",
|
||||
"preact": "^10.29.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@preact/preset-vite": "^2.10.4",
|
||||
"@types/diff": "^7.0.2",
|
||||
"@types/node": "^24.12.0",
|
||||
"typescript": "~5.9.3",
|
||||
"vite": "^8.0.1"
|
||||
}
|
||||
}
|
||||
BIN
Mindforge.Web/public/assets/mindforge-banner.png
Normal file
BIN
Mindforge.Web/public/assets/mindforge-banner.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 MiB |
BIN
Mindforge.Web/public/assets/mindforge.png
Normal file
BIN
Mindforge.Web/public/assets/mindforge.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 534 KiB |
BIN
Mindforge.Web/public/favicon.ico
Normal file
BIN
Mindforge.Web/public/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 100 KiB |
62
Mindforge.Web/src/app.css
Normal file
62
Mindforge.Web/src/app.css
Normal file
@@ -0,0 +1,62 @@
|
||||
.home-hero {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
animation: fadeIn 0.8s ease-out;
|
||||
}
|
||||
|
||||
.hero-title {
|
||||
font-size: 4rem;
|
||||
font-weight: 700;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 2px;
|
||||
margin-bottom: 1rem;
|
||||
text-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
|
||||
background: linear-gradient(90deg, #f4f5f5, #00b4d8);
|
||||
-webkit-background-clip: text;
|
||||
background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
}
|
||||
|
||||
.hero-subtitle {
|
||||
font-size: 1.5rem;
|
||||
color: rgba(244, 245, 245, 0.8);
|
||||
font-weight: 300;
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
|
||||
.module-content {
|
||||
width: 100%;
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
animation: slideUp 0.5s ease-out;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
font-size: 1.2rem;
|
||||
color: rgba(244, 245, 245, 0.8);
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
.placeholder-box {
|
||||
background: rgba(255, 255, 255, 0.05);
|
||||
border: 1px dashed rgba(255, 255, 255, 0.2);
|
||||
border-radius: 12px;
|
||||
padding: 4rem 2rem;
|
||||
font-size: 1.5rem;
|
||||
color: rgba(244, 245, 245, 0.5);
|
||||
text-align: center;
|
||||
backdrop-filter: blur(4px);
|
||||
-webkit-backdrop-filter: blur(4px);
|
||||
}
|
||||
|
||||
@keyframes fadeIn {
|
||||
from { opacity: 0; }
|
||||
to { opacity: 1; }
|
||||
}
|
||||
|
||||
@keyframes slideUp {
|
||||
from { opacity: 0; transform: translateY(20px); }
|
||||
to { opacity: 1; transform: translateY(0); }
|
||||
}
|
||||
34
Mindforge.Web/src/app.tsx
Normal file
34
Mindforge.Web/src/app.tsx
Normal file
@@ -0,0 +1,34 @@
|
||||
import { useState } from 'preact/hooks';
|
||||
import './app.css';
|
||||
import { Header } from './components/Header';
|
||||
import { Sidebar } from './components/Sidebar';
|
||||
import { VerificadorComponent } from './components/VerificadorComponent';
|
||||
import { FlashcardComponent } from './components/FlashcardComponent';
|
||||
|
||||
export function App() {
|
||||
const [activeModule, setActiveModule] = useState<'home' | 'verificador' | 'flashcards'>('home');
|
||||
|
||||
return (
|
||||
<>
|
||||
<Header onGoHome={() => setActiveModule('home')} />
|
||||
<div class="main-layout">
|
||||
<Sidebar activeModule={activeModule} onModuleChange={setActiveModule} />
|
||||
<main class="content-area">
|
||||
<div style={{ display: activeModule === 'home' || !activeModule ? 'block' : 'none' }}>
|
||||
<div class="home-hero">
|
||||
<img src="/assets/mindforge-banner.png" alt="Mindforge Banner" style={{ maxWidth: '100%', height: 'auto', marginBottom: '2rem', borderRadius: '12px', boxShadow: '0 4px 15px rgba(0,0,0,0.5)', zIndex: -10 }} />
|
||||
<h1 class="hero-title">Mindforge! - STAY HARD!</h1>
|
||||
<p class="hero-subtitle">Sua ferramenta de forja mental e estudos.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div style={{ display: activeModule === 'verificador' ? 'block' : 'none', height: '100%', width: '100%' }}>
|
||||
<VerificadorComponent />
|
||||
</div>
|
||||
<div style={{ display: activeModule === 'flashcards' ? 'block' : 'none', height: '100%', width: '100%' }}>
|
||||
<FlashcardComponent />
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
41
Mindforge.Web/src/components/Button.css
Normal file
41
Mindforge.Web/src/components/Button.css
Normal file
@@ -0,0 +1,41 @@
|
||||
.btn {
|
||||
font-family: var(--font-main);
|
||||
font-weight: 700;
|
||||
font-size: 1rem;
|
||||
padding: 0.8rem 1.5rem;
|
||||
border-radius: 8px;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
outline: none;
|
||||
transition: all 0.3s ease;
|
||||
backdrop-filter: blur(8px);
|
||||
-webkit-backdrop-filter: blur(8px);
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
color: var(--color-text-creamy);
|
||||
border: 1px solid rgba(255, 255, 255, 0.2);
|
||||
}
|
||||
|
||||
.btn-primary:hover {
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
|
||||
.btn-primary:active {
|
||||
transform: translateY(0);
|
||||
}
|
||||
|
||||
.btn-secondary {
|
||||
background: transparent;
|
||||
color: var(--color-text-creamy);
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
.btn-secondary:hover {
|
||||
background: rgba(255, 255, 255, 0.05);
|
||||
}
|
||||
22
Mindforge.Web/src/components/Button.tsx
Normal file
22
Mindforge.Web/src/components/Button.tsx
Normal file
@@ -0,0 +1,22 @@
|
||||
import type { ComponentChildren } from 'preact';
|
||||
import './Button.css';
|
||||
|
||||
interface ButtonProps extends preact.JSX.HTMLAttributes<HTMLButtonElement> {
|
||||
children: ComponentChildren;
|
||||
variant?: 'primary' | 'secondary';
|
||||
className?: string;
|
||||
onClick?: (e?: any) => any;
|
||||
disabled?: boolean;
|
||||
style?: any;
|
||||
}
|
||||
|
||||
export function Button({ children, variant = 'primary', className = '', ...props }: ButtonProps) {
|
||||
return (
|
||||
<button
|
||||
className={`btn btn-${variant} ${className}`}
|
||||
{...props}
|
||||
>
|
||||
{children}
|
||||
</button>
|
||||
);
|
||||
}
|
||||
207
Mindforge.Web/src/components/FlashcardComponent.css
Normal file
207
Mindforge.Web/src/components/FlashcardComponent.css
Normal file
@@ -0,0 +1,207 @@
|
||||
.flashcard-container {
|
||||
width: 100%;
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
animation: slideUp 0.5s ease-out;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1.5rem;
|
||||
}
|
||||
|
||||
.flashcard-form {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1.2rem;
|
||||
background: rgba(255, 255, 255, 0.05);
|
||||
padding: 2rem;
|
||||
border-radius: 12px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
.input-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.8rem;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.input-group label {
|
||||
font-weight: 700;
|
||||
color: var(--color-text-creamy);
|
||||
}
|
||||
|
||||
.text-area {
|
||||
width: 100%;
|
||||
min-height: 200px;
|
||||
background: rgba(0, 0, 0, 0.2);
|
||||
border: 1px solid rgba(255, 255, 255, 0.2);
|
||||
border-radius: 8px;
|
||||
padding: 1rem;
|
||||
color: var(--color-text-creamy);
|
||||
font-family: inherit;
|
||||
font-size: 1rem;
|
||||
resize: vertical;
|
||||
}
|
||||
|
||||
.text-area:focus {
|
||||
outline: none;
|
||||
border-color: var(--color-accent);
|
||||
}
|
||||
|
||||
.file-input-wrapper {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.file-input {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.file-input-label {
|
||||
background: var(--color-sidebar);
|
||||
color: var(--color-text-creamy);
|
||||
padding: 0.6rem 1.2rem;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
border: 1px solid rgba(255, 255, 255, 0.2);
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
.file-input-label:hover {
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
border-color: var(--color-accent);
|
||||
}
|
||||
|
||||
.slider-wrapper {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.slider-input {
|
||||
flex: 1;
|
||||
-webkit-appearance: none;
|
||||
appearance: none;
|
||||
width: 100%;
|
||||
height: 8px;
|
||||
background: rgba(0, 0, 0, 0.3);
|
||||
border-radius: 4px;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.slider-input::-webkit-slider-thumb {
|
||||
-webkit-appearance: none;
|
||||
appearance: none;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border-radius: 50%;
|
||||
background: var(--color-accent);
|
||||
cursor: pointer;
|
||||
transition: transform 0.1s;
|
||||
}
|
||||
|
||||
.slider-input::-webkit-slider-thumb:hover {
|
||||
transform: scale(1.2);
|
||||
}
|
||||
|
||||
.amount-display {
|
||||
font-weight: 700;
|
||||
color: var(--color-accent);
|
||||
min-width: 40px;
|
||||
text-align: right;
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
|
||||
/* Spinner */
|
||||
.spinner-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 3rem 0;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.spinner {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
border: 4px solid rgba(255, 255, 255, 0.1);
|
||||
border-left-color: var(--color-accent);
|
||||
border-radius: 50%;
|
||||
animation: spin 1s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% { transform: rotate(0deg); }
|
||||
100% { transform: rotate(360deg); }
|
||||
}
|
||||
|
||||
.success-message {
|
||||
color: #7ee787;
|
||||
text-align: center;
|
||||
font-weight: 700;
|
||||
margin-top: 1rem;
|
||||
animation: fadeIn 0.5s ease-out;
|
||||
}
|
||||
|
||||
.radio-group {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
background: rgba(0, 0, 0, 0.3);
|
||||
padding: 4px;
|
||||
border-radius: 12px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
width: fit-content;
|
||||
overflow: hidden;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.radio-item {
|
||||
position: relative;
|
||||
flex: 1;
|
||||
min-width: 100px;
|
||||
}
|
||||
|
||||
.radio-item input[type="radio"] {
|
||||
position: absolute;
|
||||
opacity: 0;
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
.radio-label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 0.8rem 1.2rem;
|
||||
cursor: pointer;
|
||||
border-radius: 8px;
|
||||
font-size: 0.95rem;
|
||||
font-weight: 600;
|
||||
color: rgba(255, 255, 255, 0.6);
|
||||
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.radio-item input[type="radio"]:checked + .radio-label {
|
||||
background: var(--color-accent);
|
||||
color: #000;
|
||||
box-shadow: 0 4px 12px rgba(var(--color-accent-rgb), 0.3);
|
||||
}
|
||||
|
||||
.radio-item:hover .radio-label:not(.radio-item input[type="radio"]:checked + .radio-label) {
|
||||
background: rgba(255, 255, 255, 0.05);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
/* Animations for selection */
|
||||
.radio-item input[type="radio"]:checked + .radio-label {
|
||||
animation: selectBounce 0.3s ease-out;
|
||||
}
|
||||
|
||||
@keyframes selectBounce {
|
||||
0% { transform: scale(0.95); }
|
||||
50% { transform: scale(1.02); }
|
||||
100% { transform: scale(1); }
|
||||
}
|
||||
209
Mindforge.Web/src/components/FlashcardComponent.tsx
Normal file
209
Mindforge.Web/src/components/FlashcardComponent.tsx
Normal file
@@ -0,0 +1,209 @@
|
||||
import { useState, useRef } from 'preact/hooks';
|
||||
import { MindforgeApiService, type FlashcardMode } from '../services/MindforgeApiService';
|
||||
|
||||
// Mapping of flashcard mode to its maximum allowed amount
|
||||
const modeMax: Record<FlashcardMode, number> = {
|
||||
Basic: 25,
|
||||
Simple: 30,
|
||||
Detailed: 70,
|
||||
Hyper: 130,
|
||||
};
|
||||
|
||||
import { Button } from './Button';
|
||||
import './FlashcardComponent.css';
|
||||
|
||||
function utf8ToBase64(str: string): string {
|
||||
const bytes = new TextEncoder().encode(str);
|
||||
const binary = Array.from(bytes, byte => String.fromCharCode(byte)).join('');
|
||||
return window.btoa(binary);
|
||||
}
|
||||
|
||||
export function FlashcardComponent() {
|
||||
const [text, setText] = useState('');
|
||||
const [fileName, setFileName] = useState('manual_input.md');
|
||||
const [amount, setAmount] = useState<number>(20);
|
||||
const [mode, setMode] = useState<FlashcardMode>('Simple');
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [success, setSuccess] = useState<boolean>(false);
|
||||
|
||||
const handleModeChange = (newMode: FlashcardMode) => {
|
||||
setMode(newMode); // set the mode
|
||||
setAmount(20); // set the default amount
|
||||
};
|
||||
|
||||
const fileInputRef = useRef<HTMLInputElement>(null);
|
||||
|
||||
const handleFileUpload = (e: Event) => {
|
||||
const target = e.target as HTMLInputElement;
|
||||
if (target.files && target.files.length > 0) {
|
||||
const file = target.files[0];
|
||||
setFileName(file.name);
|
||||
const reader = new FileReader();
|
||||
reader.onload = (event) => {
|
||||
if (event.target?.result) {
|
||||
setText(event.target.result as string);
|
||||
}
|
||||
};
|
||||
reader.readAsText(file);
|
||||
}
|
||||
};
|
||||
|
||||
const handleGenerate = async () => {
|
||||
if (!text.trim()) {
|
||||
setError('Por favor, insira algum texto ou faça upload de um arquivo para gerar os flashcards.');
|
||||
return;
|
||||
}
|
||||
|
||||
setLoading(true);
|
||||
setError(null);
|
||||
setSuccess(false);
|
||||
|
||||
try {
|
||||
const base64Content = utf8ToBase64(text);
|
||||
const res = await MindforgeApiService.generateFlashcards({
|
||||
fileContent: base64Content,
|
||||
fileName,
|
||||
amount,
|
||||
mode
|
||||
});
|
||||
|
||||
const csvContent = res.result;
|
||||
downloadCSV(csvContent);
|
||||
setSuccess(true);
|
||||
} catch (err: any) {
|
||||
setError(err.message || 'Ocorreu um erro ao gerar os flashcards.');
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
const downloadCSV = (content: string) => {
|
||||
// Adicionar BOM do UTF-8 para o Excel reconhecer os caracteres corretamente
|
||||
const bom = new Uint8Array([0xEF, 0xBB, 0xBF]);
|
||||
const blob = new Blob([bom, content], { type: 'text/csv;charset=utf-8;' });
|
||||
const url = URL.createObjectURL(blob);
|
||||
const link = document.createElement('a');
|
||||
link.href = url;
|
||||
link.setAttribute('download', `flashcards_${Date.now()}.csv`);
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
URL.revokeObjectURL(url);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="flashcard-container">
|
||||
<h2 className="title" style={{ fontSize: '2.5rem' }}>Gerador de Flashcards</h2>
|
||||
<p className="subtitle">Crie flashcards baseados nos seus materiais de estudo rapidamente.</p>
|
||||
|
||||
<div className="flashcard-form">
|
||||
<div className="input-group">
|
||||
<label>Texto (Markdown)</label>
|
||||
<textarea
|
||||
className="text-area"
|
||||
value={text}
|
||||
onInput={(e) => setText((e.target as HTMLTextAreaElement).value)}
|
||||
placeholder="Cole seu texto de estudo aqui ou faça upload do material..."
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="file-input-wrapper">
|
||||
<input
|
||||
type="file"
|
||||
accept=".md,.txt,.html"
|
||||
ref={fileInputRef}
|
||||
onChange={handleFileUpload}
|
||||
className="file-input"
|
||||
id="flashcard-file"
|
||||
/>
|
||||
<label htmlFor="flashcard-file" className="file-input-label">
|
||||
📁 Escolher Arquivo
|
||||
</label>
|
||||
<span style={{ fontSize: '0.9rem', color: 'rgba(255,255,255,0.6)' }}>
|
||||
{fileName !== 'manual_input.md' ? fileName : 'Nenhum arquivo selecionado'}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div className="input-group">
|
||||
<label>Quantidade Estimada de Flashcards (10 - 100)</label>
|
||||
<div className="slider-wrapper">
|
||||
<input
|
||||
type="range"
|
||||
className="slider-input"
|
||||
min="10"
|
||||
max={modeMax[mode]}
|
||||
value={amount}
|
||||
onInput={(e) => setAmount(parseInt((e.target as HTMLInputElement).value))}
|
||||
/>
|
||||
<span className="amount-display">{amount}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="input-group">
|
||||
<label>Modo de Geração</label>
|
||||
<div className="radio-group">
|
||||
<div className="radio-item">
|
||||
<input
|
||||
type="radio"
|
||||
id="mode-basic"
|
||||
name="mode"
|
||||
value="Basic"
|
||||
checked={mode === 'Basic'}
|
||||
onChange={(e) => handleModeChange((e.target as HTMLInputElement).value as FlashcardMode)}
|
||||
/>
|
||||
<label htmlFor="mode-basic" className="radio-label" title="Modo básico, rápido e simples. Geralmente conteúdos simples e repetíveis">Básico</label>
|
||||
</div>
|
||||
<div className="radio-item">
|
||||
<input
|
||||
type="radio"
|
||||
id="mode-simple"
|
||||
name="mode"
|
||||
value="Simple"
|
||||
checked={mode === 'Simple'}
|
||||
onChange={(e) => handleModeChange((e.target as HTMLInputElement).value as FlashcardMode)}
|
||||
/>
|
||||
<label htmlFor="mode-simple" className="radio-label" title="Modo rápido e simples, possui uma melhor compreensão">Simples</label>
|
||||
</div>
|
||||
<div className="radio-item">
|
||||
<input
|
||||
type="radio"
|
||||
id="mode-detailed"
|
||||
name="mode"
|
||||
value="Detailed"
|
||||
checked={mode === 'Detailed'}
|
||||
onChange={(e) => handleModeChange((e.target as HTMLInputElement).value as FlashcardMode)}
|
||||
/>
|
||||
<label htmlFor="mode-detailed" className="radio-label" title="Modelo avançado, maior gama de detalhes">Detalhado</label>
|
||||
</div>
|
||||
<div className="radio-item">
|
||||
<input
|
||||
type="radio"
|
||||
id="mode-hyper"
|
||||
name="mode"
|
||||
value="Hyper"
|
||||
checked={mode === 'Hyper'}
|
||||
onChange={(e) => handleModeChange((e.target as HTMLInputElement).value as FlashcardMode)}
|
||||
/>
|
||||
<label htmlFor="mode-hyper" className="radio-label" title="Modelo Pro, complexo e com perguntas adicionais">Hiper</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Button variant="primary" onClick={handleGenerate} disabled={loading} style={{ marginTop: '1rem' }}>
|
||||
{loading ? 'Gerando...' : 'Gerar Flashcards e Baixar (CSV)'}
|
||||
</Button>
|
||||
|
||||
{error && <div style={{ color: '#ff7b72', marginTop: '1rem' }}>{error}</div>}
|
||||
{success && <div className="success-message">Flashcards gerados com sucesso! O download deve ter começado.</div>}
|
||||
</div>
|
||||
|
||||
{loading && (
|
||||
<div className="spinner-container">
|
||||
<div className="spinner"></div>
|
||||
<p>Extraindo os melhores conceitos para os seus flashcards. Aguarde...</p>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
36
Mindforge.Web/src/components/Header.css
Normal file
36
Mindforge.Web/src/components/Header.css
Normal file
@@ -0,0 +1,36 @@
|
||||
.header {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 70px;
|
||||
background-color: var(--color-header);
|
||||
/* Imposing black with glassy effect */
|
||||
background: rgba(15, 15, 15, 0.85);
|
||||
backdrop-filter: blur(12px);
|
||||
-webkit-backdrop-filter: blur(12px);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 1000;
|
||||
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
|
||||
border-bottom: 1px solid rgba(255, 255, 255, 0.05);
|
||||
}
|
||||
|
||||
.header-content {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.header-title {
|
||||
color: var(--color-text-creamy);
|
||||
font-family: var(--font-main);
|
||||
font-size: 1.8rem;
|
||||
font-weight: 700;
|
||||
letter-spacing: 2px;
|
||||
text-transform: uppercase;
|
||||
margin: 0;
|
||||
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
19
Mindforge.Web/src/components/Header.tsx
Normal file
19
Mindforge.Web/src/components/Header.tsx
Normal file
@@ -0,0 +1,19 @@
|
||||
import './Header.css';
|
||||
|
||||
interface HeaderProps {
|
||||
onGoHome?: () => void;
|
||||
}
|
||||
|
||||
export function Header({ onGoHome }: HeaderProps) {
|
||||
return (
|
||||
<header class="header">
|
||||
<div class="header-content">
|
||||
<div style={{ display: 'flex', alignItems: 'center', cursor: 'pointer' }} onClick={onGoHome}>
|
||||
<img src="/assets/mindforge.png" alt="Mindforge" width="55" height="55" style={{ marginRight: '10px' }} />
|
||||
|
||||
<h1 class="header-title">Mindforge</h1>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
);
|
||||
}
|
||||
41
Mindforge.Web/src/components/Sidebar.css
Normal file
41
Mindforge.Web/src/components/Sidebar.css
Normal file
@@ -0,0 +1,41 @@
|
||||
.sidebar {
|
||||
width: 280px;
|
||||
background-color: var(--color-sidebar);
|
||||
border-right: 1px solid rgba(255, 255, 255, 0.05);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 2rem 1.5rem;
|
||||
box-shadow: 4px 0 15px rgba(0, 0, 0, 0.2);
|
||||
/* Ensure it fits cleanly below the header or is independent */
|
||||
height: calc(100vh - 70px);
|
||||
position: sticky;
|
||||
top: 70px;
|
||||
}
|
||||
|
||||
.sidebar-header {
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
.sidebar-title {
|
||||
color: rgba(244, 245, 245, 0.6);
|
||||
font-size: 0.9rem;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1.5px;
|
||||
font-weight: 700;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.sidebar-nav {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.sidebar-btn {
|
||||
width: 100%;
|
||||
text-align: left;
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
padding: 1rem 1.2rem;
|
||||
font-size: 1.05rem;
|
||||
}
|
||||
33
Mindforge.Web/src/components/Sidebar.tsx
Normal file
33
Mindforge.Web/src/components/Sidebar.tsx
Normal file
@@ -0,0 +1,33 @@
|
||||
import { Button } from './Button';
|
||||
import './Sidebar.css';
|
||||
|
||||
interface SidebarProps {
|
||||
onModuleChange: (module: 'home' | 'verificador' | 'flashcards') => void;
|
||||
activeModule: 'home' | 'verificador' | 'flashcards';
|
||||
}
|
||||
|
||||
export function Sidebar({ onModuleChange, activeModule }: SidebarProps) {
|
||||
return (
|
||||
<aside class="sidebar">
|
||||
<div class="sidebar-header">
|
||||
<h2 class="sidebar-title">Módulos</h2>
|
||||
</div>
|
||||
<div class="sidebar-nav">
|
||||
<Button
|
||||
variant={activeModule === 'verificador' ? 'primary' : 'secondary'}
|
||||
onClick={() => onModuleChange('verificador')}
|
||||
className="sidebar-btn"
|
||||
>
|
||||
Verificador
|
||||
</Button>
|
||||
<Button
|
||||
variant={activeModule === 'flashcards' ? 'primary' : 'secondary'}
|
||||
onClick={() => onModuleChange('flashcards')}
|
||||
className="sidebar-btn"
|
||||
>
|
||||
Flashcards
|
||||
</Button>
|
||||
</div>
|
||||
</aside>
|
||||
);
|
||||
}
|
||||
181
Mindforge.Web/src/components/VerificadorComponent.css
Normal file
181
Mindforge.Web/src/components/VerificadorComponent.css
Normal file
@@ -0,0 +1,181 @@
|
||||
.verificador-container {
|
||||
width: 100%;
|
||||
max-width: 1000px;
|
||||
margin: 0 auto;
|
||||
animation: slideUp 0.5s ease-out;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1.5rem;
|
||||
}
|
||||
|
||||
.verificador-form {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1.2rem;
|
||||
background: rgba(255, 255, 255, 0.05);
|
||||
padding: 2rem;
|
||||
border-radius: 12px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
.input-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.5rem;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.input-group label {
|
||||
font-weight: 700;
|
||||
color: var(--color-text-creamy);
|
||||
}
|
||||
|
||||
.text-area {
|
||||
width: 100%;
|
||||
min-height: 200px;
|
||||
background: rgba(0, 0, 0, 0.2);
|
||||
border: 1px solid rgba(255, 255, 255, 0.2);
|
||||
border-radius: 8px;
|
||||
padding: 1rem;
|
||||
color: var(--color-text-creamy);
|
||||
font-family: inherit;
|
||||
font-size: 1rem;
|
||||
resize: vertical;
|
||||
}
|
||||
|
||||
.text-area:focus {
|
||||
outline: none;
|
||||
border-color: var(--color-accent);
|
||||
}
|
||||
|
||||
.file-input-wrapper {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.file-input {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.file-input-label {
|
||||
background: var(--color-sidebar);
|
||||
color: var(--color-text-creamy);
|
||||
padding: 0.6rem 1.2rem;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
border: 1px solid rgba(255, 255, 255, 0.2);
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
.file-input-label:hover {
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
border-color: var(--color-accent);
|
||||
}
|
||||
|
||||
.select-input {
|
||||
background: rgba(0, 0, 0, 0.2);
|
||||
border: 1px solid rgba(255, 255, 255, 0.2);
|
||||
color: var(--color-text-creamy);
|
||||
padding: 0.8rem;
|
||||
border-radius: 8px;
|
||||
font-size: 1rem;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.select-input:focus {
|
||||
outline: none;
|
||||
border-color: var(--color-accent);
|
||||
}
|
||||
|
||||
.select-input option {
|
||||
background: var(--color-bg);
|
||||
color: var(--color-text-creamy);
|
||||
}
|
||||
|
||||
/* Response Section */
|
||||
.response-section {
|
||||
background: rgba(255, 255, 255, 0.05);
|
||||
padding: 2rem;
|
||||
border-radius: 12px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1.5rem;
|
||||
}
|
||||
|
||||
.response-content {
|
||||
text-align: left;
|
||||
white-space: pre-wrap;
|
||||
background: rgba(0, 0, 0, 0.2);
|
||||
padding: 1.5rem;
|
||||
border-radius: 8px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
font-family: monospace;
|
||||
font-size: 0.95rem;
|
||||
line-height: 1.5;
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
.diff-view {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.diff-added {
|
||||
background-color: rgba(46, 160, 67, 0.3);
|
||||
color: #7ee787;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.diff-removed {
|
||||
background-color: rgba(248, 81, 73, 0.3);
|
||||
color: #ff7b72;
|
||||
text-decoration: line-through;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.side-by-side {
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.side-pane {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.5rem;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.pane-title {
|
||||
font-size: 1.1rem;
|
||||
font-weight: 700;
|
||||
text-align: center;
|
||||
color: var(--color-accent);
|
||||
}
|
||||
|
||||
/* Spinner */
|
||||
.spinner-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 3rem 0;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.spinner {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
border: 4px solid rgba(255, 255, 255, 0.1);
|
||||
border-left-color: var(--color-accent);
|
||||
border-radius: 50%;
|
||||
animation: spin 1s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% { transform: rotate(0deg); }
|
||||
100% { transform: rotate(360deg); }
|
||||
}
|
||||
197
Mindforge.Web/src/components/VerificadorComponent.tsx
Normal file
197
Mindforge.Web/src/components/VerificadorComponent.tsx
Normal file
@@ -0,0 +1,197 @@
|
||||
import { useState, useRef } from 'preact/hooks';
|
||||
import { MindforgeApiService } from '../services/MindforgeApiService';
|
||||
import { Button } from './Button';
|
||||
import * as diff from 'diff';
|
||||
import { marked } from 'marked';
|
||||
import './VerificadorComponent.css';
|
||||
|
||||
function utf8ToBase64(str: string): string {
|
||||
const bytes = new TextEncoder().encode(str);
|
||||
const binary = Array.from(bytes, byte => String.fromCharCode(byte)).join('');
|
||||
return window.btoa(binary);
|
||||
}
|
||||
|
||||
type CheckTypeEnum = 'language' | 'content' | 'both';
|
||||
|
||||
export function VerificadorComponent() {
|
||||
const [text, setText] = useState('');
|
||||
const [fileName, setFileName] = useState('manual_input.md');
|
||||
const [checkType, setCheckType] = useState<CheckTypeEnum>('language');
|
||||
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
|
||||
const [languageResult, setLanguageResult] = useState<string | null>(null);
|
||||
const [contentResult, setContentResult] = useState<string | null>(null);
|
||||
|
||||
const fileInputRef = useRef<HTMLInputElement>(null);
|
||||
|
||||
const handleFileUpload = (e: Event) => {
|
||||
const target = e.target as HTMLInputElement;
|
||||
if (target.files && target.files.length > 0) {
|
||||
const file = target.files[0];
|
||||
setFileName(file.name);
|
||||
const reader = new FileReader();
|
||||
reader.onload = (event) => {
|
||||
if (event.target?.result) {
|
||||
setText(event.target.result as string);
|
||||
}
|
||||
};
|
||||
reader.readAsText(file);
|
||||
}
|
||||
};
|
||||
|
||||
const handleSubmit = async () => {
|
||||
if (!text.trim()) {
|
||||
setError('Por favor, insira algum texto ou faça upload de um arquivo.');
|
||||
return;
|
||||
}
|
||||
|
||||
setLoading(true);
|
||||
setError(null);
|
||||
setLanguageResult(null);
|
||||
setContentResult(null);
|
||||
|
||||
const base64Content = utf8ToBase64(text);
|
||||
|
||||
try {
|
||||
if (checkType === 'both') {
|
||||
const [langRes, contRes] = await Promise.all([
|
||||
MindforgeApiService.checkFile({ fileContent: base64Content, fileName, checkType: 'language' }),
|
||||
MindforgeApiService.checkFile({ fileContent: base64Content, fileName, checkType: 'content' })
|
||||
]);
|
||||
setLanguageResult(langRes.result);
|
||||
setContentResult(contRes.result);
|
||||
} else {
|
||||
const res = await MindforgeApiService.checkFile({ fileContent: base64Content, fileName, checkType });
|
||||
if (checkType === 'language') setLanguageResult(res.result);
|
||||
else setContentResult(res.result);
|
||||
}
|
||||
} catch (err: any) {
|
||||
setError(err.message || 'Ocorreu um erro ao processar sua requisição.');
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
const renderDiff = (original: string, updated: string) => {
|
||||
const diffResult = diff.diffWordsWithSpace(original, updated);
|
||||
return (
|
||||
<div className="diff-view">
|
||||
{diffResult.map((part, index) => {
|
||||
const className = part.added ? 'diff-added' : part.removed ? 'diff-removed' : '';
|
||||
return (
|
||||
<span key={index} className={className}>
|
||||
{part.value}
|
||||
</span>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="verificador-container">
|
||||
<h2 className="title" style={{ fontSize: '2.5rem' }}>Verificador de Arquivos</h2>
|
||||
<p className="subtitle">Faça o upload do seu arquivo Markdown para validação de linguagem ou conteúdo.</p>
|
||||
|
||||
<div className="verificador-form">
|
||||
<div className="input-group">
|
||||
<label>Texto (Markdown)</label>
|
||||
<textarea
|
||||
className="text-area"
|
||||
value={text}
|
||||
onInput={(e) => setText((e.target as HTMLTextAreaElement).value)}
|
||||
placeholder="Cole seu texto aqui ou faça upload de um arquivo..."
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="file-input-wrapper">
|
||||
<input
|
||||
type="file"
|
||||
accept=".md,.txt"
|
||||
ref={fileInputRef}
|
||||
onChange={handleFileUpload}
|
||||
className="file-input"
|
||||
id="verificador-file"
|
||||
/>
|
||||
<label htmlFor="verificador-file" className="file-input-label">
|
||||
📁 Escolher Arquivo
|
||||
</label>
|
||||
<span style={{ fontSize: '0.9rem', color: 'rgba(255,255,255,0.6)' }}>
|
||||
{fileName !== 'manual_input.md' ? fileName : 'Nenhum arquivo selecionado'}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div className="input-group">
|
||||
<label>Tipo de Verificação</label>
|
||||
<select
|
||||
className="select-input"
|
||||
value={checkType}
|
||||
onChange={(e) => setCheckType((e.target as HTMLSelectElement).value as CheckTypeEnum)}
|
||||
>
|
||||
<option value="language">Linguagem</option>
|
||||
<option value="content">Conteúdo</option>
|
||||
<option value="both">Linguagem e Conteúdo</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<Button variant="primary" onClick={handleSubmit} disabled={loading} style={{ marginTop: '1rem' }}>
|
||||
{loading ? 'Processando...' : 'Verificar'}
|
||||
</Button>
|
||||
|
||||
{error && <div style={{ color: '#ff7b72', marginTop: '1rem' }}>{error}</div>}
|
||||
</div>
|
||||
|
||||
{loading && (
|
||||
<div className="spinner-container">
|
||||
<div className="spinner"></div>
|
||||
<p>Analisando sua forja mental...</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Render Results */}
|
||||
{!loading && (languageResult || contentResult) && (
|
||||
<div className="response-section">
|
||||
{checkType === 'language' && languageResult && (
|
||||
<div className="side-pane">
|
||||
<div className="pane-title">Resultado - Linguagem (Diff)</div>
|
||||
<div className="response-content">
|
||||
{renderDiff(text, languageResult)}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{checkType === 'content' && contentResult && (
|
||||
<div className="side-pane">
|
||||
<div className="pane-title">Resultado - Conteúdo</div>
|
||||
<div
|
||||
className="response-content markdown-body"
|
||||
dangerouslySetInnerHTML={{ __html: marked.parse(contentResult) as string }}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{checkType === 'both' && languageResult && contentResult && (
|
||||
<div className="side-by-side">
|
||||
<div className="side-pane">
|
||||
<div className="pane-title">Linguagem (Diff)</div>
|
||||
<div className="response-content" style={{ minHeight: '300px' }}>
|
||||
{renderDiff(text, languageResult)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="side-pane">
|
||||
<div className="pane-title">Conteúdo</div>
|
||||
<div
|
||||
className="response-content markdown-body"
|
||||
style={{ minHeight: '300px' }}
|
||||
dangerouslySetInnerHTML={{ __html: marked.parse(contentResult) as string }}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
57
Mindforge.Web/src/index.css
Normal file
57
Mindforge.Web/src/index.css
Normal file
@@ -0,0 +1,57 @@
|
||||
@import url('https://fonts.googleapis.com/css2?family=Lato:wght@300;400;700&display=swap');
|
||||
|
||||
:root {
|
||||
--color-bg: #005873;
|
||||
--color-header: #0f0f0f;
|
||||
--color-sidebar: #013a4c;
|
||||
--color-text-creamy: #f4f5f5;
|
||||
--color-accent: #00b4d8;
|
||||
--color-accent-rgb: 0, 180, 216;
|
||||
--color-accent-hover: #0096c7;
|
||||
|
||||
--font-main: 'Lato', sans-serif;
|
||||
}
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: var(--font-main);
|
||||
background-color: var(--color-bg);
|
||||
color: var(--color-text-creamy);
|
||||
margin: 0;
|
||||
min-height: 100vh;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
#app {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.main-layout {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
margin-top: 70px; /* offset for fixed header */
|
||||
}
|
||||
|
||||
.content-area {
|
||||
flex: 1;
|
||||
padding: 2rem;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 3rem;
|
||||
font-weight: 700;
|
||||
margin-bottom: 2rem;
|
||||
text-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
5
Mindforge.Web/src/main.tsx
Normal file
5
Mindforge.Web/src/main.tsx
Normal file
@@ -0,0 +1,5 @@
|
||||
import { render } from 'preact'
|
||||
import './index.css'
|
||||
import { App } from './app.tsx'
|
||||
|
||||
render(<App />, document.getElementById('app')!)
|
||||
56
Mindforge.Web/src/services/MindforgeApiService.ts
Normal file
56
Mindforge.Web/src/services/MindforgeApiService.ts
Normal file
@@ -0,0 +1,56 @@
|
||||
const BASE_URL = import.meta.env.VITE_API_BASE_URL || 'http://localhost:5123';
|
||||
|
||||
export interface CheckFileRequest {
|
||||
fileContent: string;
|
||||
fileName: string;
|
||||
checkType: 'language' | 'content';
|
||||
}
|
||||
|
||||
export interface CheckFileResponse {
|
||||
result: string;
|
||||
}
|
||||
|
||||
export interface GenerateFlashcardsRequest {
|
||||
fileContent: string;
|
||||
fileName: string;
|
||||
amount: number;
|
||||
mode: FlashcardMode;
|
||||
}
|
||||
|
||||
export type FlashcardMode = 'Basic' | 'Simple' | 'Detailed' | 'Hyper';
|
||||
|
||||
export interface GenerateFlashcardsResponse {
|
||||
result: string;
|
||||
}
|
||||
|
||||
export const MindforgeApiService = {
|
||||
async checkFile(data: CheckFileRequest): Promise<CheckFileResponse> {
|
||||
const response = await fetch(`${BASE_URL}/api/v1/file/check`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(data),
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`Error checking file: ${response.statusText}`);
|
||||
}
|
||||
return response.json();
|
||||
},
|
||||
|
||||
async generateFlashcards(data: GenerateFlashcardsRequest): Promise<GenerateFlashcardsResponse> {
|
||||
const response = await fetch(`${BASE_URL}/api/v1/flashcard/generate`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(data),
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`Error generating flashcards: ${response.statusText}`);
|
||||
}
|
||||
return response.json();
|
||||
}
|
||||
};
|
||||
33
Mindforge.Web/tsconfig.app.json
Normal file
33
Mindforge.Web/tsconfig.app.json
Normal file
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
||||
"target": "ES2023",
|
||||
"useDefineForClassFields": true,
|
||||
"module": "ESNext",
|
||||
"lib": ["ES2023", "DOM", "DOM.Iterable"],
|
||||
"types": ["vite/client"],
|
||||
"skipLibCheck": true,
|
||||
"paths": {
|
||||
"react": ["./node_modules/preact/compat/"],
|
||||
"react-dom": ["./node_modules/preact/compat/"]
|
||||
},
|
||||
|
||||
/* Bundler mode */
|
||||
"moduleResolution": "bundler",
|
||||
"allowImportingTsExtensions": true,
|
||||
"verbatimModuleSyntax": true,
|
||||
"moduleDetection": "force",
|
||||
"noEmit": true,
|
||||
"jsx": "react-jsx",
|
||||
"jsxImportSource": "preact",
|
||||
|
||||
/* Linting */
|
||||
"strict": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"erasableSyntaxOnly": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noUncheckedSideEffectImports": true
|
||||
},
|
||||
"include": ["src"]
|
||||
}
|
||||
7
Mindforge.Web/tsconfig.json
Normal file
7
Mindforge.Web/tsconfig.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"files": [],
|
||||
"references": [
|
||||
{ "path": "./tsconfig.app.json" },
|
||||
{ "path": "./tsconfig.node.json" }
|
||||
]
|
||||
}
|
||||
26
Mindforge.Web/tsconfig.node.json
Normal file
26
Mindforge.Web/tsconfig.node.json
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
||||
"target": "ES2023",
|
||||
"lib": ["ES2023"],
|
||||
"module": "ESNext",
|
||||
"types": ["node"],
|
||||
"skipLibCheck": true,
|
||||
|
||||
/* Bundler mode */
|
||||
"moduleResolution": "bundler",
|
||||
"allowImportingTsExtensions": true,
|
||||
"verbatimModuleSyntax": true,
|
||||
"moduleDetection": "force",
|
||||
"noEmit": true,
|
||||
|
||||
/* Linting */
|
||||
"strict": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"erasableSyntaxOnly": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noUncheckedSideEffectImports": true
|
||||
},
|
||||
"include": ["vite.config.ts"]
|
||||
}
|
||||
7
Mindforge.Web/vite.config.ts
Normal file
7
Mindforge.Web/vite.config.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import preact from '@preact/preset-vite'
|
||||
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [preact()],
|
||||
})
|
||||
3
README.md
Normal file
3
README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
## Mindforge Architecture
|
||||
|
||||
This is a project that will be used to aid the user in making notes and studying for hard exams and tests.
|
||||
24
mindforge.sln
Normal file
24
mindforge.sln
Normal file
@@ -0,0 +1,24 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.5.2.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mindforge.API", "Mindforge.API\Mindforge.API.csproj", "{038E2A68-9556-09E2-3A91-52464940A286}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{038E2A68-9556-09E2-3A91-52464940A286}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{038E2A68-9556-09E2-3A91-52464940A286}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{038E2A68-9556-09E2-3A91-52464940A286}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{038E2A68-9556-09E2-3A91-52464940A286}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {3765D3A9-6691-44E4-8741-710E14090009}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
Reference in New Issue
Block a user