Skip to content

Commit 0e0a68c

Browse files
authored
Merge pull request #10 from GlisseManTV/dev
v0.5.0
2 parents d032f15 + 8bc451c commit 0e0a68c

File tree

9 files changed

+644
-20
lines changed

9 files changed

+644
-20
lines changed

Best_Practices.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Whether you're building a project, generating reports, or archiving assets, this
1313
| `create_excel(data, filename, persistent=True)` | Generate Excel files from arrays | `.xlsx` |
1414
| `create_csv(data, filename, persistent=True)` | Create CSV files from structured data | `.csv` |
1515
| `create_pdf(text, filename, persistent=True)` | Turn content into polished PDFs | `.pdf` |
16+
| `create_word (content, filename, persistent=True)` | Build Word documents with rich formatting | `.docx` |
1617
| `create_file(content, filename, persistent=True)` | Output any text-based file (`.py`, `.html`, `.json`, `.xml`, `.md`, etc.) | Any |
1718
| `create_presentation(slides_data, filename, persistent=True, title)` | Build dynamic presentations | `.pptx` |
1819
| `generate_and_archive(files_data, archive_format="zip", archive_name=None, persistent=True)` | **Pack multiple files into a single `.zip`, `.tar.gz`, or `.7z` archive** | `.zip`, `.tar.gz`, `.7z` |

LLM_Export/docker/docker-compose.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,20 @@ services:
2121
- FILES_DELAY=1
2222
- LOG_LEVEL=DEBUG
2323
- UNSPLASH_ACCESS_KEY=your-unsplash-access-key
24+
- IMAGE_SOURCE=local_sd
25+
- LOCAL_SD_URL=http://localhost:7860
26+
- LOCAL_SD_USERNAME=local_user
27+
- LOCAL_SD_PASSWORD=local_password
28+
- LOCAL_SD_DEFAULT_MODEL=sd_xl_base_1.0.safetensors
29+
- LOCAL_SD_STEPS=20
30+
- LOCAL_SD_WIDTH=512
31+
- LOCAL_SD_HEIGHT=512
32+
- LOCAL_SD_CFG_SCALE=1.5
33+
- LOCAL_SD_SCHEDULER=Karras
34+
- LOCAL_SD_SAMPLE=Euler a
2435
ports:
2536
- "8000:8000"
37+
restart: unless-stopped
2638
volumes:
2739
- /your/export-data:/output
2840
depends_on:

LLM_Export/docker/mcpo/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ markdown2
99
beautifulsoup4
1010
emoji
1111
python-pptx
12+
python-docx
1213
requests

LLM_Export/docker/mcpo/tools/file_export_mcp.py

Lines changed: 271 additions & 6 deletions
Large diffs are not rendered by default.

LLM_Export/requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ markdown2
99
beautifulsoup4
1010
emoji
1111
python-pptx
12-
requests
12+
python-docx
13+
requests

LLM_Export/tools/file_export_mcp.py

Lines changed: 259 additions & 6 deletions
Large diffs are not rendered by default.

Prompt_Examples.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,17 @@ I got good results with the following prompt:
4343
- `![Search](image_query: technology innovation)`
4444
- Images are retrieved automatically from Unsplash with the specified search parameters.
4545
- The system automatically manages the integration of images into the PDF with appropriate formatting.
46+
- **For `create_word`**:
47+
- Each element of the document can include an optional `image_query` field which specifies a keyword to search for an image via the Unsplash API.
48+
- The LLM must provide **only** the data required to create the Word document:
49+
- `type`: Type of element (`"title"`, `"subtitle"`, `"paragraph"`, `"list"`, `"image"`, `"table"`)
50+
- text`: Text content of the element (for types "title", "subtitle", "paragraph")
51+
- items`: List of elements for lists (for the "list" type)
52+
- query`: Image search keyword (for the "image" type)
53+
- data`: Table data (for the "table" type)
54+
- If the `image` type is provided, an image will automatically be searched for via Unsplash and inserted into the document.
55+
- The system automatically applies the default Word styles (Heading 1, Heading 2, List Bullet, etc.).
56+
- **Important**: The `content` field must always be a dictionary list, even if it contains a single item.
4657
- **For `generate_and_archive`** :
4758
- Accepts a list of `files_data` objects, each object containing :
4859
- `filename` (file name, with extension corresponding to the `format`)

README.md

Lines changed: 73 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,18 @@ https://github.com/user-attachments/assets/1e70a977-62f1-498c-895c-7db135ded95b
4444
- `PERSISTENT_FILES`: Set to `true` to keep files after download, `false` to delete after delay (default is false)
4545
- `FILES_DELAY`: Delay in minut to wait before checking for new files (default is 60)
4646
- `UNSPLASH_ACCESS_KEY`: Your Unsplash API key (no default value, not mandatory but advised) see [here](https://unsplash.com/documentation#creating-a-developer-account)
47-
47+
- `IMAGE_SOURCE`: "unsplash" to use Unsplash for image generation or "local_sd" to use your local Stable Diffusion instance (default is "unsplash")
48+
- `LOCAL_SD_URL`: URL of your local Stable Diffusion instance (if using local_sd) (no default value, mandatory if local_sd is used above)
49+
- `LOCAL_SD_USERNAME`: Username of your local Stable Diffusion instance (if any) (no default value, not mandatory)
50+
- `LOCAL_SD_PASSWORD`: Password of your local Stable Diffusion instance (if any) (no default value, not mandatory)
51+
- `LOCAL_SD_DEFAULT_MODEL`: Default model to use (if any) (default `sd_xl_base_1.0.safetensors`, not mandatory)
52+
- `LOCAL_SD_STEPS`: Number of steps to use (default 20, not mandatory)
53+
- `LOCAL_SD_WIDTH`: Width of the image to generate (default 512, not mandatory)
54+
- `LOCAL_SD_HEIGHT`: Height of the image to generate (default 512, not mandatory)
55+
- `LOCAL_SD_CFG_SCALE`: CFG scale to use (default 1.5, not mandatory)
56+
- `LOCAL_SD_SCHEDULER`: Scheduler to use (default `Karras`, not mandatory)
57+
- `LOCAL_SD_SAMPLE`: Sampler to use (default `Euler a`, not mandatory)
58+
4859
3. Install dependencies:
4960
```bash
5061
pip install openpyxl reportlab py7zr fastapi uvicorn python-multipart mcp
@@ -78,8 +89,19 @@ This is an example of a minimal `config.json` for MCPO to enable file export but
7889
"FILE_EXPORT_BASE_URL": "http://localhost:9003/files", <==== HERE set the URL of your file export server
7990
"FILE_EXPORT_DIR": "C:\\temp\\LLM_Export\\output", <==== HERE set the directory where files will be saved (must match the server's export directory)
8091
"PERSISTENT_FILES": "false", <==== HERE set to true to keep files after download, false to delete after delay
81-
"FILES_DELAY": "60" <==== HERE set the delay in minut to wait before checking for new files
82-
"UNSPLASH_ACCESS_KEY": <== Your Unsplash API key (no default value, not mandatory but advised) see [here](https://unsplash.com/documentation#creating-a-developer-account)
92+
"FILES_DELAY": "60", <==== HERE set the delay in minut to wait before checking for new files
93+
"UNSPLASH_ACCESS_KEY":"", <== Your Unsplash API key (no default value, not mandatory but advised) see [here](https://unsplash.com/documentation#creating-a-developer-account)
94+
"IMAGE_SOURCE": "local_sd", <==== HERE set to "unsplash" to use Unsplash for image generation or "local_sd" to use your local Stable Diffusion instance>
95+
"LOCAL_SD_URL": "http://localhost:7860", <==== HERE set to the URL of your local Stable Diffusion instance>
96+
"LOCAL_SD_USERNAME": "local_user", <==== HERE set to the username of your local Stable Diffusion instance (if any)>
97+
"LOCAL_SD_PASSWORD": "local_password", <==== HERE set to the password of your local Stable Diffusion instance (if any)>
98+
"LOCAL_SD_DEFAULT_MODEL": "sd_xl_base_1.0.safetensors", <==== HERE set to the default model to use (if any)>
99+
"LOCAL_SD_STEPS": "20", <==== HERE set to the number of steps to use (if any)>
100+
"LOCAL_SD_WIDTH": "512", <==== HERE set to the width of the image to generate (if any)>
101+
"LOCAL_SD_HEIGHT": "512", <==== HERE set to the height of the image to generate (if any)>
102+
"LOCAL_SD_CFG_SCALE": "1.5", <==== HERE set to the CFG scale to use (if any)>
103+
"LOCAL_SD_SCHEDULER": "Karras", <==== HERE set to the scheduler to use (if any)>
104+
"LOCAL_SD_SAMPLE": "Euler a" <==== HERE set to the sampler to use (if any)>
83105
},
84106
"disabled": false,
85107
"autoApprove": []
@@ -108,6 +130,17 @@ For OWUI-MCPO
108130
- `PERSISTENT_FILES`: Set to `true` to keep files after download, `false` to delete after delay (default is `false`)
109131
- `FILES_DELAY`: Delay in minut to wait before checking for new files (default is 60)
110132
- `UNSPLASH_ACCESS_KEY`: Your Unsplash API key (no default value, not mandatory but advised) see [here](https://unsplash.com/documentation#creating-a-developer-account)
133+
- `IMAGE_SOURCE`: "unsplash" to use Unsplash or "local_sd" to use your local Stable Diffusion instance (default is "unsplash")
134+
- `LOCAL_SD_URL`: URL of your local Stable Diffusion instance (if using local_sd) (no default value, mandatory if local_sd is used above)
135+
- `LOCAL_SD_USERNAME`: Username of your local Stable Diffusion instance (if any) (no default value, not mandatory)
136+
- `LOCAL_SD_PASSWORD`: Password of your local Stable Diffusion instance (if any) (no default value, not mandatory)
137+
- `LOCAL_SD_DEFAULT_MODEL`: Default model to use (if any) (default `sd_xl_base_1.0.safetensors`, not mandatory)
138+
- `LOCAL_SD_STEPS`: Number of steps to use (default 20, not mandatory)
139+
- `LOCAL_SD_WIDTH`: Width of the image to generate (default 512, not mandatory)
140+
- `LOCAL_SD_HEIGHT`: Height of the image to generate (default 512, not mandatory)
141+
- `LOCAL_SD_CFG_SCALE`: CFG scale to use (default 1.5, not mandatory)
142+
- `LOCAL_SD_SCHEDULER`: Scheduler to use (default `Karras`, not mandatory)
143+
- `LOCAL_SD_SAMPLE`: Sampler to use (default `Euler a`, not mandatory)
111144

112145
For OWUI-FILE-EXPORT-SERVER
113146
- `FILE_EXPORT_DIR`: Directory where files will be saved (must match the MCPO's export directory) (default is `/output`) path must be mounted as a volume
@@ -150,8 +183,20 @@ services:
150183
- FILES_DELAY=1
151184
- LOG_LEVEL=INFO
152185
- UNSPLASH_ACCESS_KEY=top-secret
186+
- IMAGE_SOURCE=local_sd
187+
- LOCAL_SD_URL=http://localhost:7860
188+
- LOCAL_SD_USERNAME=local_user
189+
- LOCAL_SD_PASSWORD=local_password
190+
- LOCAL_SD_DEFAULT_MODEL=sd_xl_base_1.0.safetensors
191+
- LOCAL_SD_STEPS=20
192+
- LOCAL_SD_WIDTH=512
193+
- LOCAL_SD_HEIGHT=512
194+
- LOCAL_SD_CFG_SCALE=1.5
195+
- LOCAL_SD_SCHEDULER=Karras
196+
- LOCAL_SD_SAMPLE=Euler a
153197
ports:
154198
- "8000:8000"
199+
restart: unless-stopped
155200
volumes:
156201
- /your/export-data:/output
157202
depends_on:
@@ -165,6 +210,7 @@ services:
165210
- ✅ `.pdf` (PDF)
166211
- ✅ `.csv` (CSV)
167212
- ✅ `.pptx` (PowerPoint)
213+
- ✅ `.docx` (Word)
168214
- ✅ `.zip`n `tar.gz` and `.7z` (Archives)
169215
- ✅ Any other file type
170216

@@ -275,7 +321,18 @@ For OWUI-MCPO
275321
- `PERSISTENT_FILES`: Set to `true` to keep files after download, `false` to delete after delay (default is `false`)
276322
- `FILES_DELAY`: Delay in minut to wait before checking for new files (default is 60)
277323
- `UNSPLASH_ACCESS_KEY`: Your Unsplash API key (no default value, not mandatory but advised) see [here](https://unsplash.com/documentation#creating-a-developer-account)
278-
324+
- `IMAGE_SOURCE`: "unsplash" to use Unsplash or "local_sd" to use your local Stable Diffusion instance (default is "unsplash")
325+
- `LOCAL_SD_URL`: URL of your local Stable Diffusion instance (if using local_sd) (no default value, mandatory if local_sd is used above)
326+
- `LOCAL_SD_USERNAME`: Username of your local Stable Diffusion instance (if any) (no default value, not mandatory)
327+
- `LOCAL_SD_PASSWORD`: Password of your local Stable Diffusion instance (if any) (no default value, not mandatory)
328+
- `LOCAL_SD_DEFAULT_MODEL`: Default model to use (if any) (default `sd_xl_base_1.0.safetensors`, not mandatory)
329+
- `LOCAL_SD_STEPS`: Number of steps to use (default 20, not mandatory)
330+
- `LOCAL_SD_WIDTH`: Width of the image to generate (default 512, not mandatory)
331+
- `LOCAL_SD_HEIGHT`: Height of the image to generate (default 512, not mandatory)
332+
- `LOCAL_SD_CFG_SCALE`: CFG scale to use (default 1.5, not mandatory)
333+
- `LOCAL_SD_SCHEDULER`: Scheduler to use (default `Karras`, not mandatory)
334+
- `LOCAL_SD_SAMPLE`: Sampler to use (default `Euler a`, not mandatory)
335+
279336
For OWUI-FILE-EXPORT-SERVER
280337
- `FILE_EXPORT_DIR`: Directory where files will be saved (must match the MCPO's export directory) (default is `/output`) path must be mounted as a volume
281338

@@ -317,8 +374,20 @@ services:
317374
- FILES_DELAY=1
318375
- LOG_LEVEL=DEBUG
319376
- UNSPLASH_ACCESS_KEY=top-secret
377+
- IMAGE_SOURCE=local_sd
378+
- LOCAL_SD_URL=http://localhost:7860
379+
- LOCAL_SD_USERNAME=local_user
380+
- LOCAL_SD_PASSWORD=local_password
381+
- LOCAL_SD_DEFAULT_MODEL=sd_xl_base_1.0.safetensors
382+
- LOCAL_SD_STEPS=20
383+
- LOCAL_SD_WIDTH=512
384+
- LOCAL_SD_HEIGHT=512
385+
- LOCAL_SD_CFG_SCALE=1.5
386+
- LOCAL_SD_SCHEDULER=Karras
387+
- LOCAL_SD_SAMPLE=Euler a
320388
ports:
321389
- "8000:8000"
390+
restart: unless-stopped
322391
volumes:
323392
- /your/export-data:/output
324393
depends_on:

config.json

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,22 @@
1010
"PYTHONPATH": "C:\\temp\\LLM_Export",
1111
"FILE_EXPORT_BASE_URL": "http://localhost:9003/files",
1212
"FILE_EXPORT_DIR": "C:\\temp\\LLM_Export\\output",
13-
"MCPO_API_KEY": "top-secret",
13+
"MCPO_API_KEY": "top-secret",
1414
"PERSISTENT_FILES": "true",
1515
"FILES_DELAY": "1",
16-
"LOG_LEVEL": "DEBUG",
17-
"UNSPLASH_ACCESS_KEY": "top-secret"
16+
"LOG_LEVEL": "DEBUG",
17+
"UNSPLASH_ACCESS_KEY": "top-secret",
18+
"IMAGE_SOURCE": "local_sd",
19+
"LOCAL_SD_URL": "http://localhost:7860",
20+
"LOCAL_SD_USERNAME": "user",
21+
"LOCAL_SD_PASSWORD": "password",
22+
"LOCAL_SD_MODEL": "sd_xl_base_1.0.safetensors",
23+
"LOCAL_SD_STEPS": "20",
24+
"LOCAL_SD_WIDTH": "512",
25+
"LOCAL_SD_HEIGHT": "512",
26+
"LOCAL_SD_CFG_SCALE": "1.5",
27+
"LOCAL_SD_SCHEDULER": "Karras",
28+
"LOCAL_SD_SAMPLER": "Euler a"
1829
},
1930
"disabled": false,
2031
"autoApprove": []

0 commit comments

Comments
 (0)