Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 0 additions & 33 deletions Controllers/WeatherForecastController.cs

This file was deleted.

13 changes: 3 additions & 10 deletions Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ public static void Main(string[] args)
{
var builder = WebApplication.CreateBuilder(args);

// База данных
// DATABASE
builder.Services.AddDbContext<ServerWebDataBaseContext>(options =>
options.UseSqlServer(
builder.Configuration.GetConnectionString("Default")));

// Сервисы
// SEVICES
builder.Services.AddSingleton<OpenAiService>();

// CORS
Expand All @@ -36,14 +36,7 @@ public static void Main(string[] args)
app.UseHttpsRedirection();
app.UseCors();

// Тест БД
app.MapGet("/test-db", async (ServerWebDataBaseContext db) =>
{
var ok = await db.Database.CanConnectAsync();
return Results.Ok(ok ? "БД подключена!" : "Ошибка подключения");
});

// Эндпоинты
// ENDPOINTS
app.MapAnalysisEndpoints();

app.Run();
Expand Down
4 changes: 2 additions & 2 deletions Services/OpenAiService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ 8. Посчитать статистику текста
var requestBody = new
{
model = _model,
temperature = 0.1, // низкая температура = точнее и стабильнее
temperature = 0.1, // TEMPERATURE MODELS (0.1 = focused and deterministic, 0.9 = creative and random)
messages = new[]
{
new { role = "system", content = systemPrompt },
Expand All @@ -103,7 +103,7 @@ 8. Посчитать статистику текста
.GetProperty("content")
.GetString();

// Очищаем на случай если модель всё же добавила markdown
// DELETE MARKDOWN
resultText = resultText?
.Replace("```json", "")
.Replace("```", "")
Expand Down
13 changes: 0 additions & 13 deletions WeatherForecast.cs

This file was deleted.

31 changes: 21 additions & 10 deletions client/src/App.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
import Editor from './components/Editor'
import Results from './components/Results'
import { useState } from 'react'
import Editor from './components/Editor'
import Results from './components/Results'
import ReportModal from './components/ReportModal'
import { useAnalysis } from './hooks/useAnalysis'

export default function App() {
const { result, loading, error, analyze, exportReport, reset } = useAnalysis()
const [showReport, setShowReport] = useState(false)
const [editorText, setEditorText] = useState('')

const handleAnalyze = async (text, language) => {
setEditorText(text)
return await analyze(text, language)
}

const handleExport = (format, text, language) => {
exportReport(format, text, result, language)
}

const handleClear = () => {
reset()
const handleExport = (format) => {
exportReport(format, editorText, result, 'ru')
}

return (
Expand All @@ -28,8 +29,8 @@ export default function App() {
issues={result?.issues}
result={result}
onAnalyze={handleAnalyze}
onExport={handleExport}
onClear={handleClear}
onOpenReport={() => setShowReport(true)}
onClear={reset}
/>

{error && (
Expand All @@ -45,6 +46,16 @@ export default function App() {
)}

<Results result={result} />

{showReport && (
<ReportModal
result={result}
text={editorText}
language="ru"
onClose={() => setShowReport(false)}
onExport={handleExport}
/>
)}
</div>
)
}
4 changes: 2 additions & 2 deletions client/src/components/Editor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { DecorationSet } from 'prosemirror-view'
import IssuePopup from './IssuePopup'
import Toolbar from './Toolbar'

export default function Editor({ onAnalyze, onExport, loading, issues, result }) {
export default function Editor({ onAnalyze, onExport, loading, issues, result, onOpenReport }) {
const [detectedLang, setDetectedLang] = useState('ru')
const [langTimer, setLangTimer] = useState(null)
const [popup, setPopup] = useState(null)
Expand Down Expand Up @@ -108,7 +108,7 @@ export default function Editor({ onAnalyze, onExport, loading, issues, result })
hasResult={!!result}
onAnalyze={handleAnalyze}
onClear={handleClear}
onExport={handleExport}
onOpenReport={onOpenReport}
/>

{/* Легенда */}
Expand Down
Loading
Loading