Skip to content

Commit 03db010

Browse files
author
Abdennacer LACHIHEB
committed
add custom extensions + update docs
1 parent 964216f commit 03db010

File tree

10 files changed

+63
-29
lines changed

10 files changed

+63
-29
lines changed

.env.md

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,21 @@ These variables are used for image processing:
2020

2121
## Examples:
2222

23+
- **GROQ** (Recommended for text processing)
24+
25+
Get your free api key from here: https://console.groq.com/keys
26+
```bash
27+
# API and MODEL used for documents processing
28+
TEXT_API_END_POINT=https://api.groq.com/openai/v1
29+
TEXT_MODEL_NAME=llama3-70b-8192
30+
TEXT_API_KEYS=["gsk_xxx","gsk_yyy"]
31+
32+
# API and MODEL used for images processing
33+
IMAGE_API_END_POINT=https://api.groq.com/openai/v1
34+
IMAGE_MODEL_NAME=llava-v1.5-7b-4096-preview
35+
IMAGE_API_KEYS=["gsk_xxx","gsk_yyy"]
36+
```
37+
2338
- **OPENAI**
2439
```bash
2540
# API and MODEL used for documents processing
@@ -33,19 +48,6 @@ TIMAGE_MODEL_NAME=gpt-4o
3348
TIMAGE_API_KEYS=["sk-xxx","sk-yyy"]
3449
```
3550

36-
- **GROQ**
37-
```bash
38-
# API and MODEL used for documents processing
39-
TEXT_API_END_POINT=https://api.groq.com/openai/v1
40-
TEXT_MODEL_NAME=llama3-70b-8192
41-
TEXT_API_KEYS=["gsk_xxx","gsk_yyy"]
42-
43-
# API and MODEL used for images processing ( No vision models for GROQ yet)
44-
IMAGE_API_END_POINT=http://localhost:11434/v1
45-
IMAGE_MODEL_NAME=moondream:latest
46-
IMAGE_API_KEYS=["ollama"]
47-
```
48-
4951
- **OLLAMA**
5052
```bash
5153
# API and MODEL used for documents processing
@@ -61,6 +63,9 @@ IMAGE_API_KEYS=["ollama"]
6163

6264

6365
- **HUGGING FACE**
66+
67+
Get your free api key from here: https://huggingface.co/settings/tokens
68+
6469
```bash
6570
# API and MODEL used for documents processing
6671
TEXT_API_END_POINT=https://api-inference.huggingface.co/v1

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ backend/venv/
1919
venv/
2020
backend/env/
2121
**/__pycache__/
22-
backend/app/*.db
22+
backend/**/*.db

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# FileWizardAi
1+
# FileWizardAI
22

33
## Description
44

5-
FileWizardAi is a Python/Angular project designed to automatically organize your files into a well-structured directory
5+
FileWizardAI is a Python/Angular project designed to automatically organize your files into a well-structured directory
66
hierarchy and rename them according to their content. This tool is ideal for anyone looking to declutter their digital
77
workspace by sorting files into appropriate folders and providing descriptive names, making it easier to manage and
88
locate files. Additionally, it allows you to input a text prompt and instantly searches for files that are related to
@@ -66,7 +66,7 @@ Make sure you have Python installed on your machine.
6666
First, clone the repository:
6767

6868
```bash
69-
git clone https://github.com/AIxHunter/FileWizardAi.git
69+
git clone https://github.com/AIxHunter/FileWizardAI.git
7070
```
7171

7272
Navigate to the backend folder and update your `.env` file according to the [documentation](.env.md). Then, install the

backend/app/run.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ def load_documents(path: str, recursive: bool, required_exts: list):
7474
input_dir=path,
7575
recursive=recursive,
7676
required_exts=required_exts,
77+
errors='ignore'
7778
)
7879
splitter = TokenTextSplitter(chunk_size=6144)
7980
documents = []

backend/app/static/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
<style>html,body{height:100%}body{margin:0;font-family:Roboto,Helvetica Neue,sans-serif}</style><link rel="stylesheet" href="styles.e06a9809e0fa01f5.css" media="print" onload="this.media='all'"><noscript><link rel="stylesheet" href="styles.e06a9809e0fa01f5.css"></noscript></head>
1111
<body>
1212
<app-root></app-root>
13-
<script src="runtime.89bfad0fe920d2c9.js" type="module"></script><script src="polyfills.794d7387aea30963.js" type="module"></script><script src="main.8a6092f762bfc1a2.js" type="module"></script>
13+
<script src="runtime.89bfad0fe920d2c9.js" type="module"></script><script src="polyfills.794d7387aea30963.js" type="module"></script><script src="main.a1dce65e08b8e85c.js" type="module"></script>
1414

1515
</body></html>

backend/app/static/main.8a6092f762bfc1a2.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

backend/app/static/main.a1dce65e08b8e85c.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

backend/requirements.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
fastapi
22
uvicorn[standard]==0.22.0
3-
llama-index
43
openai
5-
pydantic-settings
4+
pydantic-settings
5+
llama-index
6+
# needed by llama index
7+
git+https://github.com/openai/whisper.git
8+
pydub
9+
docx2txt
10+
nbconvert

frontend/src/app/app.component.ts

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,30 @@ import { Component, HostBinding, Input, QueryList, ViewChildren } from '@angular
22
import { DataService } from './data.service';
33
import { HttpParams } from "@angular/common/http";
44
import { FolderTreeComponent } from './components/folder-tree.component';
5+
import { NgModel } from '@angular/forms';
56

67
@Component({
78
selector: 'app-root',
89
template: `
910
<mat-card class="example-card" appearance="raised">
10-
<mat-card-content>
11-
<mat-card-header>
12-
<mat-card-title>Update structure</mat-card-title>
13-
</mat-card-header>
11+
12+
<mat-card-header>
13+
<mat-card-title>Update structure</mat-card-title>
14+
</mat-card-header>
15+
16+
<mat-card-content>
1417
<mat-form-field style="margin-right: 1%; width: 33%;" appearance="fill">
1518
<mat-label>Root path</mat-label>
1619
<input matInput placeholder="Path" [(ngModel)]="rootPath" (ngModelChange)="onPathChange($event)">
1720
</mat-form-field>
1821
22+
<mat-form-field appearance="fill">
23+
<mat-label>Add new extension</mat-label>
24+
<input matInput placeholder="Add Extension" [(ngModel)]="newExtension" #extensionControl="ngModel">
25+
<mat-error >Extension should start with a dot ".", ex: '.txt'</mat-error>
26+
</mat-form-field>
27+
<button style="margin-right: 1%" mat-raised-button (click)="addExtension(extensionControl)">Add</button>
28+
1929
<mat-form-field appearance="fill">
2030
<mat-label>Extensions</mat-label>
2131
<mat-select [(value)]="filesExts" multiple>
@@ -82,9 +92,10 @@ export class AppComponent {
8292
successMessage: string = '';
8393
errorMessage: string = '';
8494
isLoading: boolean = false;
95+
newExtension: string = '';
8596

86-
filesExts: string[] = ['.pdf', '.txt', '.png', '.jpg', '.jpeg'];
87-
filesExtsList: string[] = ['.pdf', '.txt', '.png', '.jpg', '.jpeg'];
97+
filesExts: string[] = [".csv", ".docx", ".ipynb", ".jpeg", ".jpg", ".md", ".mp3", ".mp4", ".pdf", ".png", ".ppt"];
98+
filesExtsList: string[] = [".csv", ".docx", ".ipynb", ".jpeg", ".jpg", ".md", ".mp3", ".mp4", ".pdf", ".png", ".ppt"];
8899
@HostBinding('class.active')
89100
@Input()
90101
selectedOptions: string[] = [];
@@ -106,7 +117,7 @@ export class AppComponent {
106117
params = params.set("required_exts", this.filesExts.join(';'))
107118
this.dataService.getFormattedFiles(params).subscribe((data) => {
108119
this.original_files = data
109-
this.original_files.items = this.original_files.items.map((item: any) => ({src_path: item.src_path.replaceAll("\\\\", "/").replaceAll("\\", "/"), dst_path: item.dst_path}))
120+
this.original_files.items = this.original_files.items.map((item: any) => ({ src_path: item.src_path.replaceAll("\\\\", "/").replaceAll("\\", "/"), dst_path: item.dst_path }))
110121
let res = this.original_files.items.map((item: any) => ({ src_path: `${data.root_path}/${item.src_path}`, dst_path: `${data.root_path}/${item.dst_path}` }))
111122
this.srcPaths = res.map((r: any) => r.src_path);
112123
this.dstPaths = res.map((r: any) => r.dst_path);
@@ -136,4 +147,16 @@ export class AppComponent {
136147
this.childComponents.toArray()[index].highlightFile(matchingFilePath);
137148
}
138149

150+
addExtension(extensionControl: NgModel) {
151+
if (this.newExtension && !this.filesExtsList.includes(this.newExtension)) {
152+
if (this.newExtension.startsWith(".")) {
153+
this.filesExtsList.push(this.newExtension); // Add new option
154+
this.filesExts.push(this.newExtension); // Add new option
155+
this.newExtension = ''; // Clear the input field
156+
} else {
157+
extensionControl.control.setErrors({ customError: true });
158+
}
159+
}
160+
}
161+
139162
}

frontend/src/app/components/search-files.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { DataService } from "../data.service";
1313
<div class="spinner-container">
1414
<mat-spinner *ngIf="isLoading"></mat-spinner>
1515
</div>
16-
<app-folder-tree title="Searched files" *ngIf="files" [paths]="files" [index]=2></app-folder-tree>
16+
<app-folder-tree title="Searched files" *ngIf="files" [paths]="files" [rootPath]="rootPath" [index]=2></app-folder-tree>
1717
`,
1818
styles: [`
1919
.example-full-width {

0 commit comments

Comments
 (0)