mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-30 18:27:56 +01:00
fix(linting): corrige errores de formato y sintaxis detectados por pre-commit
- Elimina import duplicado de DeletionRequestViewSet en urls.py (F811) - Aplica formato automático con ruff format a 12 archivos Python - Agrega comas finales faltantes (COM812) en 74 ubicaciones - Normaliza formato de dependencias en pyproject.toml - Corrige ortografía en archivos de documentación (codespell) Errores corregidos: - src/paperless/urls.py: Import duplicado de DeletionRequestViewSet - 74 violaciones de COM812 (comas finales faltantes) - Formato inconsistente en múltiples archivos Python Este commit asegura que el código pase el linting check de pre-commit y resuelve los problemas de formato introducidos en el commit anterior. Archivos Python reformateados: 12 Archivos de documentación corregidos: 35 Comas finales agregadas: 74
This commit is contained in:
parent
69326b883d
commit
e7b426caf1
80 changed files with 1823 additions and 1413 deletions
|
|
@ -1,12 +1,12 @@
|
|||
<div class="row">
|
||||
<div class="col-xl-6 pe-xl-5">
|
||||
<h5 i18n>AI Scanner Configuration</h5>
|
||||
|
||||
|
||||
<div class="row mb-3">
|
||||
<div class="col">
|
||||
<pngx-input-check
|
||||
i18n-title
|
||||
title="Enable AI Scanner"
|
||||
<pngx-input-check
|
||||
i18n-title
|
||||
title="Enable AI Scanner"
|
||||
formControlName="aiScannerEnabled"
|
||||
i18n-hint
|
||||
hint="Automatically scan and analyze documents using AI"
|
||||
|
|
@ -17,9 +17,9 @@
|
|||
|
||||
<div class="row mb-3">
|
||||
<div class="col">
|
||||
<pngx-input-check
|
||||
i18n-title
|
||||
title="Enable ML Features"
|
||||
<pngx-input-check
|
||||
i18n-title
|
||||
title="Enable ML Features"
|
||||
formControlName="aiMlFeaturesEnabled"
|
||||
i18n-hint
|
||||
hint="Use machine learning for document classification and entity extraction"
|
||||
|
|
@ -31,9 +31,9 @@
|
|||
|
||||
<div class="row mb-3">
|
||||
<div class="col">
|
||||
<pngx-input-check
|
||||
i18n-title
|
||||
title="Enable Advanced OCR"
|
||||
<pngx-input-check
|
||||
i18n-title
|
||||
title="Enable Advanced OCR"
|
||||
formControlName="aiAdvancedOcrEnabled"
|
||||
i18n-hint
|
||||
hint="Advanced OCR with table extraction and handwriting recognition"
|
||||
|
|
@ -54,11 +54,11 @@
|
|||
</div>
|
||||
<div class="col-md-8">
|
||||
<div class="d-flex align-items-center">
|
||||
<input
|
||||
type="range"
|
||||
class="form-range flex-grow-1 me-3"
|
||||
min="50"
|
||||
max="100"
|
||||
<input
|
||||
type="range"
|
||||
class="form-range flex-grow-1 me-3"
|
||||
min="50"
|
||||
max="100"
|
||||
step="5"
|
||||
[value]="autoApplyThreshold"
|
||||
(input)="onAutoApplyThresholdChange($event)"
|
||||
|
|
@ -77,11 +77,11 @@
|
|||
</div>
|
||||
<div class="col-md-8">
|
||||
<div class="d-flex align-items-center">
|
||||
<input
|
||||
type="range"
|
||||
class="form-range flex-grow-1 me-3"
|
||||
min="30"
|
||||
max="90"
|
||||
<input
|
||||
type="range"
|
||||
class="form-range flex-grow-1 me-3"
|
||||
min="30"
|
||||
max="90"
|
||||
step="5"
|
||||
[value]="suggestThreshold"
|
||||
(input)="onSuggestThresholdChange($event)"
|
||||
|
|
@ -95,14 +95,14 @@
|
|||
</div>
|
||||
|
||||
<h5 class="mt-4" i18n>ML Model Selection</h5>
|
||||
|
||||
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-4 col-form-label pt-0">
|
||||
<span i18n>Model</span>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<select
|
||||
class="form-select"
|
||||
<select
|
||||
class="form-select"
|
||||
formControlName="aiMlModel"
|
||||
[disabled]="!aiScannerEnabled || !settingsForm.get('aiMlFeaturesEnabled')?.value"
|
||||
(change)="onAiSettingChange()">
|
||||
|
|
@ -120,12 +120,12 @@
|
|||
|
||||
<div class="col-xl-6 ps-xl-5">
|
||||
<h5 class="mt-3 mt-xl-0" i18n>Testing & Validation</h5>
|
||||
|
||||
|
||||
<div class="row mb-3">
|
||||
<div class="col">
|
||||
<button
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-outline-primary"
|
||||
class="btn btn-outline-primary"
|
||||
(click)="testAIWithSample()"
|
||||
[disabled]="!aiScannerEnabled || testingInProgress">
|
||||
@if (testingInProgress) {
|
||||
|
|
@ -142,7 +142,7 @@
|
|||
</div>
|
||||
|
||||
<h5 class="mt-4" i18n>Performance Statistics</h5>
|
||||
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
@if (aiStats.totalDocumentsProcessed === 0) {
|
||||
|
|
@ -156,7 +156,7 @@
|
|||
{{ aiStats.totalDocumentsProcessed }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row mb-2">
|
||||
<div class="col-7">
|
||||
<strong i18n>Auto-applied:</strong>
|
||||
|
|
@ -165,7 +165,7 @@
|
|||
{{ aiStats.autoAppliedCount }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row mb-2">
|
||||
<div class="col-7">
|
||||
<strong i18n>Suggestions created:</strong>
|
||||
|
|
@ -174,7 +174,7 @@
|
|||
{{ aiStats.suggestionsCount }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row mb-2">
|
||||
<div class="col-7">
|
||||
<strong i18n>Average confidence:</strong>
|
||||
|
|
@ -183,7 +183,7 @@
|
|||
{{ aiStats.averageConfidence }}%
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-7">
|
||||
<strong i18n>Avg. processing time:</strong>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
.form-range {
|
||||
cursor: pointer;
|
||||
|
||||
|
||||
&:disabled {
|
||||
cursor: not-allowed;
|
||||
opacity: 0.5;
|
||||
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
.alert {
|
||||
font-size: 0.9rem;
|
||||
|
||||
|
||||
i-bs {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ describe('AiSettingsComponent', () => {
|
|||
|
||||
fixture = TestBed.createComponent(AiSettingsComponent)
|
||||
component = fixture.componentInstance
|
||||
|
||||
|
||||
// Create a mock form group
|
||||
component.settingsForm = new FormGroup({
|
||||
aiScannerEnabled: new FormControl(false),
|
||||
|
|
@ -35,9 +35,9 @@ describe('AiSettingsComponent', () => {
|
|||
aiSuggestThreshold: new FormControl(60),
|
||||
aiMlModel: new FormControl('bert-base'),
|
||||
})
|
||||
|
||||
|
||||
component.isDirty$ = of(false)
|
||||
|
||||
|
||||
fixture.detectChanges()
|
||||
})
|
||||
|
||||
|
|
@ -61,9 +61,9 @@ describe('AiSettingsComponent', () => {
|
|||
const event = {
|
||||
target: { value: '85' },
|
||||
} as any
|
||||
|
||||
|
||||
component.onAutoApplyThresholdChange(event)
|
||||
|
||||
|
||||
expect(component.settingsForm.get('aiAutoApplyThreshold')?.value).toBe(85)
|
||||
})
|
||||
|
||||
|
|
@ -71,29 +71,29 @@ describe('AiSettingsComponent', () => {
|
|||
const event = {
|
||||
target: { value: '70' },
|
||||
} as any
|
||||
|
||||
|
||||
component.onSuggestThresholdChange(event)
|
||||
|
||||
|
||||
expect(component.settingsForm.get('aiSuggestThreshold')?.value).toBe(70)
|
||||
})
|
||||
|
||||
it('should emit settings changed event', () => {
|
||||
spyOn(component.settingsChanged, 'emit')
|
||||
|
||||
|
||||
component.onAiSettingChange()
|
||||
|
||||
|
||||
expect(component.settingsChanged.emit).toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('should test AI with sample document', (done) => {
|
||||
component.settingsForm.get('aiScannerEnabled')?.setValue(true)
|
||||
|
||||
|
||||
expect(component.testingInProgress).toBe(false)
|
||||
|
||||
|
||||
component.testAIWithSample()
|
||||
|
||||
|
||||
expect(component.testingInProgress).toBe(true)
|
||||
|
||||
|
||||
setTimeout(() => {
|
||||
expect(component.testingInProgress).toBe(false)
|
||||
expect(mockToastService.show).toHaveBeenCalled()
|
||||
|
|
@ -104,7 +104,7 @@ describe('AiSettingsComponent', () => {
|
|||
it('should return correct aiScannerEnabled status', () => {
|
||||
component.settingsForm.get('aiScannerEnabled')?.setValue(true)
|
||||
expect(component.aiScannerEnabled).toBe(true)
|
||||
|
||||
|
||||
component.settingsForm.get('aiScannerEnabled')?.setValue(false)
|
||||
expect(component.aiScannerEnabled).toBe(false)
|
||||
})
|
||||
|
|
@ -112,7 +112,7 @@ describe('AiSettingsComponent', () => {
|
|||
it('should get correct threshold values', () => {
|
||||
component.settingsForm.get('aiAutoApplyThreshold')?.setValue(75)
|
||||
component.settingsForm.get('aiSuggestThreshold')?.setValue(55)
|
||||
|
||||
|
||||
expect(component.autoApplyThreshold).toBe(75)
|
||||
expect(component.suggestThreshold).toBe(55)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ export class AiSettingsComponent implements OnInit {
|
|||
|
||||
testAIWithSample() {
|
||||
this.testingInProgress = true
|
||||
|
||||
|
||||
// Mock test - in real implementation, this would call the backend API
|
||||
setTimeout(() => {
|
||||
this.testingInProgress = false
|
||||
|
|
@ -107,7 +107,7 @@ export class AiSettingsComponent implements OnInit {
|
|||
content: $localize`AI test completed successfully. Check the console for results.`,
|
||||
delay: 5000,
|
||||
})
|
||||
|
||||
|
||||
// Log mock test results
|
||||
if (!environment.production) {
|
||||
console.log('AI Scanner Test Results:', {
|
||||
|
|
|
|||
|
|
@ -358,8 +358,8 @@
|
|||
<li [ngbNavItem]="SettingsNavIDs.AI">
|
||||
<a ngbNavLink i18n>AI Configuration</a>
|
||||
<ng-template ngbNavContent>
|
||||
<pngx-ai-settings
|
||||
[settingsForm]="settingsForm"
|
||||
<pngx-ai-settings
|
||||
[settingsForm]="settingsForm"
|
||||
[isDirty$]="isDirty$"
|
||||
(settingsChanged)="settingsForm.markAsDirty()">
|
||||
</pngx-ai-settings>
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
<li class="nav-item ai-status-container">
|
||||
<button
|
||||
class="btn border-0 position-relative"
|
||||
[ngbPopover]="aiStatusPopover"
|
||||
<button
|
||||
class="btn border-0 position-relative"
|
||||
[ngbPopover]="aiStatusPopover"
|
||||
popoverClass="ai-status-popover"
|
||||
placement="bottom"
|
||||
container="body"
|
||||
triggers="mouseenter:mouseleave">
|
||||
<i-bs
|
||||
width="1.3em"
|
||||
height="1.3em"
|
||||
[name]="iconName"
|
||||
<i-bs
|
||||
width="1.3em"
|
||||
height="1.3em"
|
||||
[name]="iconName"
|
||||
[class]="iconClass">
|
||||
</i-bs>
|
||||
@if (hasAlerts) {
|
||||
|
|
@ -26,7 +26,7 @@
|
|||
<i-bs name="robot" width="1em" height="1em" class="me-1"></i-bs>
|
||||
<span i18n>AI Scanner Status</span>
|
||||
</h6>
|
||||
|
||||
|
||||
<div class="status-info">
|
||||
<div class="status-row mb-2">
|
||||
<span class="status-label" i18n>Status:</span>
|
||||
|
|
@ -66,8 +66,8 @@
|
|||
</div>
|
||||
|
||||
<div class="mt-3 pt-2 border-top">
|
||||
<button
|
||||
class="btn btn-sm btn-outline-primary w-100"
|
||||
<button
|
||||
class="btn btn-sm btn-outline-primary w-100"
|
||||
(click)="navigateToSettings()"
|
||||
i18n>
|
||||
Configure AI Scanner
|
||||
|
|
|
|||
|
|
@ -5,16 +5,16 @@
|
|||
|
||||
.ai-status-icon {
|
||||
transition: all 0.3s ease;
|
||||
|
||||
|
||||
&.inactive {
|
||||
opacity: 0.4;
|
||||
color: var(--bs-secondary);
|
||||
}
|
||||
|
||||
|
||||
&.active {
|
||||
color: var(--bs-success);
|
||||
}
|
||||
|
||||
|
||||
&.processing {
|
||||
color: var(--bs-primary);
|
||||
animation: pulse 1.5s ease-in-out infinite;
|
||||
|
|
@ -34,12 +34,12 @@
|
|||
|
||||
.ai-status-tooltip {
|
||||
min-width: 250px;
|
||||
|
||||
|
||||
.status-row {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
|
||||
.status-label {
|
||||
font-weight: 500;
|
||||
margin-right: 0.5rem;
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ export class AIStatusIndicatorComponent implements OnInit, OnDestroy {
|
|||
*/
|
||||
get iconClass(): string {
|
||||
const classes = ['ai-status-icon']
|
||||
|
||||
|
||||
if (!this.aiStatus.active) {
|
||||
classes.push('inactive')
|
||||
} else if (this.aiStatus.processing) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue