|
1 | 1 | # 📚 Table of Contents |
2 | 2 |
|
3 | 3 | - [📚 Table of Contents](#-table-of-contents) |
4 | | -- [🤖 UNEP Knowledge Base import script](#-unep-knowledge-base-import-script) |
5 | | - - [🔐 Environment Variables](#-environment-variables) |
6 | | - - [🚀 Running the Script](#-running-the-script) |
7 | | - - [📁 Directory Structure](#-directory-structure) |
8 | 4 | - [🤖 Create or Update User script](#-create-or-update-user-script) |
9 | 5 | - [🚀 Usage](#-usage) |
10 | 6 | - [⚙️ Script flow:](#️-script-flow) |
11 | 7 | - [Example](#example) |
| 8 | +- [🤖 UNEP Knowledge Base import script](#-unep-knowledge-base-import-script) |
| 9 | + - [🔐 Environment Variables](#-environment-variables) |
| 10 | + - [🚀 Running the Script](#-running-the-script) |
| 11 | + - [📁 Directory Structure](#-directory-structure) |
| 12 | +- [🤖 TDT Knowledge Base import script](#-tdt-knowledge-base-import-script) |
| 13 | + - [🔐 Environment Variables](#-environment-variables-1) |
| 14 | + - [🚀 Running the Script](#-running-the-script-1) |
| 15 | + - [📁 Directory Structure](#-directory-structure-1) |
| 16 | + |
| 17 | +--- |
| 18 | + |
| 19 | +# 🤖 Create or Update User script |
| 20 | + |
| 21 | +This script helps create or update user quickly in the system, ensuring user records are set up correctly for authentication and access control. It can also assign superuser status for administrative privileges. |
| 22 | + |
| 23 | +## 🚀 Usage |
| 24 | + |
| 25 | +The `add_user.py` script allows you to create or update a user account in the system’s user database (or service). |
| 26 | + |
| 27 | +```bash |
| 28 | +./dev.sh exec script python -m add_user |
| 29 | +``` |
| 30 | + |
| 31 | +## ⚙️ Script flow: |
| 32 | + 1. Prompt for Email |
| 33 | + The script will ask for the user's email address. |
| 34 | + 2. Prompt for Superuser Status |
| 35 | + You’ll be asked whether the user should be a superuser (y for yes, n for no). |
| 36 | + 3. User Creation/Update |
| 37 | + - The script will either create a new user or update an existing user with the given email. |
| 38 | + - The username and password will both be set to the email address as a default (consider changing the password later for security). |
| 39 | + |
| 40 | +### Example |
| 41 | + |
| 42 | +```bash |
| 43 | +=== Create or Update User === |
| 44 | + |
| 45 | +Is Super User? (y/n): y |
| 46 | +``` |
| 47 | + |
| 48 | +This creates or updates the user `[email protected]` and marks them as a superuser. |
12 | 49 |
|
13 | 50 | --- |
14 | 51 |
|
@@ -56,33 +93,46 @@ You will be prompted to: |
56 | 93 |
|
57 | 94 | --- |
58 | 95 |
|
59 | | -# 🤖 Create or Update User script |
| 96 | +# 🤖 TDT Knowledge Base import script |
60 | 97 |
|
61 | | -This script helps create or update user quickly in the system, ensuring user records are set up correctly for authentication and access control. It can also assign superuser status for administrative privileges. |
| 98 | +This script automates the process of collecting, saving, and uploading PDF documents from [TDT Knowledge Hub](https://tdt.akvotest.org/knowledge-hub) into a RAG (Retrieval-Augmented Generation) system. |
62 | 99 |
|
63 | | -## 🚀 Usage |
| 100 | +This Python script supports three main operation modes: |
64 | 101 |
|
65 | | -The `add_user.py` script allows you to create or update a user account in the system’s user database (or service). |
| 102 | +1. **CSV Only** – Save PDF URLs to a CSV file. |
| 103 | +2. **CSV + Download** – Save URLs and download the corresponding PDFs. |
| 104 | +3. **Full Process** – Save URLs, download PDFs, and upload/process them in RAG. |
| 105 | + |
| 106 | +## 🔐 Environment Variables |
| 107 | + |
| 108 | +Before running the script, set RAG credentials in your shell or environment: |
| 109 | + |
| 110 | +``` bash |
| 111 | +export RAG_USERNAME="rag_admin" |
| 112 | +export RAG_PASSWORD="RAGadmin1" |
| 113 | +``` |
| 114 | + |
| 115 | +## 🚀 Running the Script |
| 116 | + |
| 117 | +To execute the script: |
66 | 118 |
|
67 | 119 | ```bash |
68 | | -./dev.sh exec script python -m add_user |
| 120 | +./dev.sh exec script python -m kb_init_tdt |
69 | 121 | ``` |
70 | 122 |
|
71 | | -## ⚙️ Script flow: |
72 | | - 1. Prompt for Email |
73 | | - The script will ask for the user's email address. |
74 | | - 2. Prompt for Superuser Status |
75 | | - You’ll be asked whether the user should be a superuser (y for yes, n for no). |
76 | | - 3. User Creation/Update |
77 | | - - The script will either create a new user or update an existing user with the given email. |
78 | | - - The username and password will both be set to the email address as a default (consider changing the password later for security). |
| 123 | +You will be prompted to: |
| 124 | +- Choose the operation mode: |
| 125 | + 1: Save PDF URLs to CSV only. |
| 126 | + 2: Save to CSV and download PDFs. |
| 127 | + 3: Full process (CSV + download + upload to RAG). |
79 | 128 |
|
80 | | -### Example |
| 129 | +- Enter the number of documents to import. |
| 130 | +- Provide a description for the RAG knowledge base. |
81 | 131 |
|
| 132 | +## 📁 Directory Structure |
82 | 133 | ```bash |
83 | | -=== Create or Update User === |
84 | | - |
85 | | -Is Super User? (y/n): y |
| 134 | +./downloads/tdt/tdt_files.csv – Stores PDF URLs and offsets. |
| 135 | +./downloads/tdt/ – Folder where downloaded PDF files are saved. |
86 | 136 | ``` |
87 | 137 |
|
88 | | -This creates or updates the user `[email protected]` and marks them as a superuser. |
| 138 | +--- |
0 commit comments