Spaces:
Sleeping
Sleeping
| title: TextArchive | |
| emoji: ๐ | |
| colorFrom: blue | |
| colorTo: purple | |
| sdk: gradio | |
| python_version: "3.11" | |
| app_file: app.py | |
| pinned: false | |
| # TextArchive - Universal Text Management System | |
| A powerful and intuitive web application for managing all your text-based content with a clear hierarchical structure: **Category โ Section โ Content Type โ Content**. | |
| ## ๐ฏ What is TextArchive? | |
| TextArchive is not just a prompt manager - it's a universal system for organizing ANY text-based content: | |
| - ๐ฌ Prompts for AI models | |
| - ๐ Notes and documentation | |
| - ๐ Code snippets (Python, JavaScript, SQL, etc.) | |
| - ๐ LaTeX documents | |
| - ๐ป Bash scripts | |
| - โ๏ธ Functions and utilities | |
| - ๐ HTML/CSS templates | |
| - ๐ Any other text content | |
| ## ๐ Organization Structure | |
| Your content is organized in a clear three-level hierarchy: | |
| - **Category** (High-level grouping) - e.g., "Coding", "Writing", "Research" | |
| - **Section** (Subsection under category) - e.g., "Python", "JavaScript", "Blog Posts" | |
| - **Content Type** (What kind of content) - e.g., "python", "note", "prompt", "latex" | |
| - **Content** (Your actual text) | |
| Example hierarchy: | |
| ``` | |
| ๐ Coding (Category) | |
| โโโ ๐ Python (Section) | |
| โโโ ๐ Python Code: "Function to calculate fibonacci..." | |
| โโโ ๐ฌ Prompt: "Write a Python function that..." | |
| โโโ ๐ JavaScript (Section) | |
| โโโ ๐ JavaScript: "React component for login..." | |
| ๐ Research (Category) | |
| โโโ ๐ AI Papers (Section) | |
| โโโ ๐ Note: "Summary of transformer architecture..." | |
| โโโ ๐ LaTeX: "\documentclass{article}..." | |
| ``` | |
| ## โจ Features | |
| ### Core Functionality | |
| - โ **Add New Items**: Create content with custom categories, sections, and types | |
| - ๐ **View All Items**: See all your content organized hierarchically | |
| - ๐ **Auto-Filter**: Filters update automatically (AJAX-style, no search button needed) | |
| - ๐ **Easy Copy**: Click any row to preview, then use the copy button to copy just the text content | |
| - โ๏ธ **Edit Items**: Click any item to edit its details | |
| - ๐๏ธ **Delete Items**: Remove items you no longer need | |
| - ๐ฏ **Fixed Height Table**: Scrollable table maintains consistent size | |
| - ๐พ **Persistent Storage**: SQLite database stores all your data | |
| ### Advanced Management | |
| - ๐ **Rename Categories**: Rename categories and automatically update all items | |
| - ๐ **Rename Sections**: Rename sections across all categories or within a specific category | |
| - ๐๏ธ **Bulk Delete**: Delete entire categories or sections at once (with confirmation) | |
| - ๐ **Statistics**: View insights about your content collection | |
| - ๐ท๏ธ **11 Content Types**: Prompt, Note, Python, JavaScript, LaTeX, SQL, Bash, Function, HTML, CSS, Other | |
| ### Smart UX | |
| - ๐ฏ **Filtered Dropdowns**: Section dropdown automatically filters by selected category | |
| - ๐ **Auto-Refresh**: All dropdowns update automatically after changes | |
| - โ ๏ธ **Confirmation Dialogs**: Destructive actions require confirmation | |
| - ๐ฆ **Auto-Generated Titles**: Leave title empty to auto-generate from content | |
| - ๐จ **Type Icons**: Visual icons for each content type | |
| ## ๐ How to Use | |
| ### Adding Content | |
| 1. Go to the "โ Add New Item" tab | |
| 2. Select or type a **Category** (high-level grouping) | |
| 3. Select or type a **Section** (subsection - dropdown auto-filters by category) | |
| 4. Choose **Content Type** (prompt, note, python, etc.) | |
| 5. (Optional) Enter a **Title** or leave empty for auto-generation | |
| 6. Enter your **Content** | |
| 7. Click "Add Item" | |
| ### Viewing and Filtering Content | |
| 1. Go to the "๐ View & Manage Items" tab | |
| 2. Use filters to narrow down items: | |
| - **Filter by Category**: Auto-updates table | |
| - **Filter by Section**: Auto-updates table (filtered by category) | |
| - **Filter by Type**: Auto-updates table | |
| 3. Click "Clear Filters" to reset | |
| ### Copying Content | |
| 1. In the "View & Manage Items" tab, click on any row in the table | |
| 2. The content appears in the **Content Preview** box below | |
| 3. Click the **copy button** (๐) in the preview box, OR | |
| 4. Click in the text box and press Ctrl+A (select all), then Ctrl+C (copy) | |
| 5. Only the text content is copied - NO ID, category, or section included! | |
| ### Editing Content | |
| 1. Click on a row in the table to load it | |
| 2. The item loads in the editing section below | |
| 3. Modify Category, Section, Type, Title, or Content as needed | |
| 4. Click "๐พ Update Item" to save changes | |
| ### Deleting Content | |
| 1. Click on a row to select it | |
| 2. Click the "๐๏ธ Delete Item" button | |
| 3. The item will be removed immediately | |
| ### Managing Categories & Sections | |
| 1. Go to the "โ๏ธ Manage Categories & Sections" tab | |
| **Rename Category:** | |
| - Select the category to rename | |
| - Enter new name | |
| - Click "๐ Rename Category" | |
| - All items in that category will be updated | |
| **Rename Section:** | |
| - (Optional) Select a category to limit scope | |
| - Select the section to rename | |
| - Enter new name | |
| - Click "๐ Rename Section" | |
| **Delete Category:** | |
| - Select the category | |
| - Check the confirmation box | |
| - Click "๐๏ธ Delete Category" | |
| - ALL items in that category will be deleted | |
| **Delete Section:** | |
| - (Optional) Select a category to limit scope | |
| - Select the section | |
| - Check the confirmation box | |
| - Click "๐๏ธ Delete Section" | |
| ### Viewing Statistics | |
| 1. Go to the "๐ Statistics" tab | |
| 2. View total counts, top categories, and breakdown by type | |
| 3. Click "๐ Refresh Statistics" to update | |
| ## ๐จ Content Types | |
| TextArchive supports 11 content types, each with its own icon and file extension: | |
| | Type | Icon | Extension | Use For | | |
| |------|------|-----------|---------| | |
| | prompt | ๐ฌ | .txt | AI prompts and instructions | | |
| | note | ๐ | .md | Notes and documentation | | |
| | python | ๐ | .py | Python code and scripts | | |
| | javascript | ๐ | .js | JavaScript code | | |
| | latex | ๐ | .tex | LaTeX documents | | |
| | sql | ๐๏ธ | .sql | SQL queries and scripts | | |
| | bash | ๐ป | .sh | Bash shell scripts | | |
| | function | โ๏ธ | .txt | Reusable functions | | |
| | html | ๐ | .html | HTML markup | | |
| | css | ๐จ | .css | CSS stylesheets | | |
| | other | ๐ | .txt | Any other text content | | |
| ## ๐ง Technical Details | |
| - **Framework**: Gradio 4.44.0+ | |
| - **Database**: SQLite (automatically created as `textarchive.db`) | |
| - **Python**: 3.8+ | |
| - **Auto-Migration**: Automatically migrates from old `prompts.db` if exists | |
| ## ๐ Database Schema | |
| ```sql | |
| CREATE TABLE text_items ( | |
| id INTEGER PRIMARY KEY AUTOINCREMENT, | |
| category TEXT NOT NULL, | |
| section TEXT NOT NULL, | |
| title TEXT NOT NULL, | |
| content TEXT NOT NULL, | |
| content_type TEXT DEFAULT 'prompt', | |
| file_extension TEXT DEFAULT '.txt', | |
| created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, | |
| updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP | |
| ); | |
| ``` | |
| Indexes are created on `category`, `section`, and `content_type` for optimal performance. | |
| ## ๐ Deployment to Hugging Face Spaces | |
| ### Method 1: Direct Upload | |
| 1. Create a new Space on Hugging Face: | |
| - Go to https://huggingface.co/new-space | |
| - Choose "Gradio" as the SDK | |
| - Set visibility (Public or Private) | |
| 2. Upload these files to your Space: | |
| - `app.py` | |
| - `requirements.txt` | |
| - `README.md` (optional) | |
| 3. Your app will automatically deploy! | |
| ### Method 2: Git (With Your Sync Script) | |
| 1. Initialize your local repository: | |
| ```bash | |
| git init | |
| git add . | |
| git commit -m "Initial commit" | |
| ``` | |
| 2. Add remotes: | |
| ```bash | |
| # Add GitHub remote | |
| git remote add github https://github.com/YOUR_USERNAME/textarchive.git | |
| # Add Hugging Face remote | |
| git remote add huggingface https://huggingface.co/spaces/YOUR_USERNAME/textarchive | |
| ``` | |
| 3. Use your sync script: | |
| ```powershell | |
| # Set your Hugging Face token | |
| $env:HF_TOKEN = "your_hf_token_here" | |
| # Run sync | |
| .\sync.ps1 "Initial deployment" | |
| ``` | |
| ## ๐ Migration from Old "Prompt Manager" | |
| If you have an existing `prompts.db` from the old Prompt Manager: | |
| 1. **Automatic Migration**: Just run the new app - it will automatically: | |
| - Detect the old `prompts.db` | |
| - Create the new `textarchive.db` schema | |
| - Migrate all your data | |
| - Set content_type to "prompt" for all old items | |
| - Generate titles from the first 50 characters | |
| 2. **Manual Backup** (Recommended): | |
| ```bash | |
| # Backup your old database first | |
| cp prompts.db prompts.db.backup | |
| ``` | |
| 3. **Verify Migration**: | |
| - Open the app | |
| - Go to Statistics tab | |
| - Check that all items were migrated | |
| - Check a few items to ensure content is intact | |
| ## ๐ Notes | |
| - The database file persists between sessions | |
| - All users share the same database (unless you add authentication) | |
| - Backup your `textarchive.db` file regularly | |
| - Section dropdowns auto-filter by selected category for better UX | |
| - Auto-filtering eliminates the need for a search button | |
| - Fixed-height table with scrolling maintains clean interface | |
| ## ๐ฏ Use Cases | |
| ### For Developers | |
| - Store code snippets and functions | |
| - Organize SQL queries by project | |
| - Keep bash scripts and automation tools | |
| - Document API endpoints | |
| ### For Writers | |
| - Organize story prompts and ideas | |
| - Store article outlines | |
| - Keep writing templates | |
| - Manage blog post drafts | |
| ### For Researchers | |
| - Store LaTeX document snippets | |
| - Organize research notes by topic | |
| - Keep citation templates | |
| - Document methodologies | |
| ### For AI/ML Engineers | |
| - Organize prompts by use case | |
| - Store fine-tuning examples | |
| - Document model configurations | |
| - Keep evaluation templates | |
| ## ๐ฎ Future Enhancements (Suggestions) | |
| - Export individual items as files | |
| - Export category/section as ZIP | |
| - Import from files/folders | |
| - Tags system for cross-category organization | |
| - Full-text search within content | |
| - Syntax highlighting in preview | |
| - Markdown rendering for notes | |
| - Version history for items | |
| - User authentication for private libraries | |
| - API access for programmatic usage | |
| - Favorites/bookmarks | |
| - Sharing capabilities | |
| ## ๐ License | |
| MIT License - Feel free to modify and use as needed! | |
| ## ๐ค Contributing | |
| Contributions are welcome! Please feel free to submit issues or pull requests. | |
| --- | |
| **Built with โค๏ธ using Gradio and SQLite** |