7ed05abdb8
- Introduced modularity by splitting Beam into new projects: Beam.Abstractions, Beam.Models, and Beam.Downloaders. - Refactored existing classes into appropriate namespaces and projects. - Replaced specific implementations with abstractions (e.g., SourceLinkBuilder to LinkBuilder, State to IState, etc.). - Updated interfaces: added ITemplate, IArticleData, IDownloadReport, and others for improved extensibility. - Removed deprecated classes like SourceLinkBuilder and StateChangerFactory. - Enhanced link handling in downloaders by refactoring to use `string` over `SourceLink`. - Consolidated shared logic under Beam.Abstractions.
27 lines
1.3 KiB
C#
27 lines
1.3 KiB
C#
// using System;
|
|
// using System.Collections.Generic;
|
|
// using System.Linq;
|
|
// using System.Text;
|
|
// using System.Threading.Tasks;
|
|
// using Beam.Models;
|
|
// using OpenAI;
|
|
// using OpenAI.Chat;
|
|
//
|
|
// namespace Beam.Temporary.Cli {
|
|
// public class QuickAndDirtyJanitor {
|
|
// static OpenAIClient client;
|
|
//
|
|
// static QuickAndDirtyJanitor() {
|
|
// var key = Environment.GetEnvironmentVariable("OPEN_AI_KEY");
|
|
// client = new OpenAIClient(key);
|
|
// }
|
|
//
|
|
// public static async Task<IDocument> TranslateAsync(IDocument document) {
|
|
// var chatCompletion = await client.GetChatClient("gpt-4.1").CompleteChatAsync(
|
|
// ChatMessage.CreateSystemMessage("Translate the following text into english. If any part of the text has no direct English translation, you may choose to leave it as is. In either case, make sure to leave footnotes for any difficult to translate words. You must translate the whole text and output only your translation and footnotes. No other comments are necessary."),
|
|
// ChatMessage.CreateUserMessage("From UNKNOWN to ENGLISH.\n" + document.ToString()));
|
|
// return new StringDocument(document.Filename, chatCompletion.Value.Content.DefaultIfEmpty().Select((x) => x?.Text).Aggregate((x,y) => $"{x}{y}"));
|
|
// }
|
|
// }
|
|
// }
|