Real channel fetch (Telegram/Bale/Divar) + AI-audited automation engine + CI/CD
- Fetch: Telegram via t.me/s, Bale via Bot API, Divar via web-search (HttpClient, config-gated, graceful) - AI layer: DB-backed AppSetting (mode auto/manual, thresholds, AI endpoint/model/key/prompt/framework, auto-approve); OpenAI-compatible IAiAuditor (self-host/Iranian endpoints; fails safe to manual) - Pipeline: fetch → dedupe(hash) → parse → validate → AI audit → Discard/Flag/Queue/auto-publish (resolve-or-create facility) - Admin: /Admin/Settings automation+AI panel; queue shows confidence + AI verdict; flagged section - CI/CD: Dockerfile, docker-compose.prod.yml, .gitea/workflows/ci-cd.yml, nginx vhost, DEPLOY.md; forwarded headers + /healthz + prod reference-only seed; ports 22/80/443 only Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
using JobsMedical.Web.Models;
|
||||
using JobsMedical.Web.Services.Scraping;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
|
||||
namespace JobsMedical.Web.Pages.Admin;
|
||||
|
||||
[Authorize(Roles = "Admin")]
|
||||
public class SettingsModel : PageModel
|
||||
{
|
||||
private readonly SettingsService _settings;
|
||||
public SettingsModel(SettingsService settings) => _settings = settings;
|
||||
|
||||
[BindProperty] public IngestionMode Mode { get; set; }
|
||||
[BindProperty] public int AutoPublishMinConfidence { get; set; }
|
||||
[BindProperty] public bool AiEnabled { get; set; }
|
||||
[BindProperty] public string? AiEndpoint { get; set; }
|
||||
[BindProperty] public string? AiApiKey { get; set; }
|
||||
[BindProperty] public string? AiModel { get; set; }
|
||||
[BindProperty] public string AiSystemPrompt { get; set; } = "";
|
||||
[BindProperty] public bool AiAutoApprove { get; set; }
|
||||
[TempData] public string? Saved { get; set; }
|
||||
|
||||
public async Task OnGetAsync()
|
||||
{
|
||||
var s = await _settings.GetAsync();
|
||||
Mode = s.Mode;
|
||||
AutoPublishMinConfidence = s.AutoPublishMinConfidence;
|
||||
AiEnabled = s.AiEnabled;
|
||||
AiEndpoint = s.AiEndpoint;
|
||||
AiApiKey = s.AiApiKey;
|
||||
AiModel = s.AiModel;
|
||||
AiSystemPrompt = s.AiSystemPrompt;
|
||||
AiAutoApprove = s.AiAutoApprove;
|
||||
}
|
||||
|
||||
public async Task<IActionResult> OnPostAsync()
|
||||
{
|
||||
await _settings.SaveAsync(new AppSetting
|
||||
{
|
||||
Mode = Mode,
|
||||
AutoPublishMinConfidence = AutoPublishMinConfidence,
|
||||
AiEnabled = AiEnabled,
|
||||
AiEndpoint = AiEndpoint,
|
||||
AiApiKey = AiApiKey,
|
||||
AiModel = AiModel,
|
||||
AiSystemPrompt = AiSystemPrompt,
|
||||
AiAutoApprove = AiAutoApprove,
|
||||
});
|
||||
Saved = "تنظیمات ذخیره شد.";
|
||||
return RedirectToPage();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user