thieuluan commited on
Commit ·
b2cc3c8
0
Parent(s):
Start repository
Browse files- .gitignore +2 -0
- PRESENTATION_GUIDE.md +173 -0
- README.md +174 -0
- data/upload_example.txt +189 -0
- data/user_guide_sample.txt +186 -0
- main.py +502 -0
- requirements.txt +5 -0
- test_app.py +296 -0
.gitignore
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
node_modules/
|
| 2 |
+
.env
|
PRESENTATION_GUIDE.md
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# PowerPoint Presentation: Meeting Notes Automation App 📝
|
| 2 |
+
|
| 3 |
+
## Presentation Overview
|
| 4 |
+
A comprehensive 14-slide PowerPoint presentation showcasing the Meeting Notes Automation App with AI-powered features and multi-language support.
|
| 5 |
+
|
| 6 |
+
## Slide Content Summary
|
| 7 |
+
|
| 8 |
+
### 1. Title Slide 🎯
|
| 9 |
+
- **Title**: Meeting Notes Automation
|
| 10 |
+
- **Subtitle**: AI-Powered Meeting Transcript Analysis with Multi-Language Support
|
| 11 |
+
- **Built with**: Azure OpenAI & Streamlit
|
| 12 |
+
- **Date**: Current month/year
|
| 13 |
+
|
| 14 |
+
### 2. Problem Statement 🎯
|
| 15 |
+
**The Challenge**
|
| 16 |
+
- Manual meeting note-taking is time-consuming and error-prone
|
| 17 |
+
- Key action items and decisions often get lost
|
| 18 |
+
- Language barriers in international teams
|
| 19 |
+
- Difficulty retrieving specific information from long transcripts
|
| 20 |
+
- Inconsistent documentation across meetings
|
| 21 |
+
- Need for quick Q&A about meeting content
|
| 22 |
+
|
| 23 |
+
### 3. Solution Overview 💡
|
| 24 |
+
**Our Solution: AI-Powered Meeting Notes Automation Platform**
|
| 25 |
+
- ✅ Automated Summary Generation
|
| 26 |
+
- ✅ Multi-Language Support (10 Languages)
|
| 27 |
+
- ✅ Intelligent Q&A Chatbot
|
| 28 |
+
- ✅ Auto-Language Detection
|
| 29 |
+
- ✅ Multiple Input Methods
|
| 30 |
+
- ✅ Export & Sharing Capabilities
|
| 31 |
+
- ✅ Real-time Statistics
|
| 32 |
+
|
| 33 |
+
### 4. Key Features 🚀
|
| 34 |
+
**Four Main Feature Categories:**
|
| 35 |
+
1. **🌐 Multi-Language Support**
|
| 36 |
+
- English, Spanish, French, German, Italian
|
| 37 |
+
- Portuguese, Japanese, Chinese, Korean, Arabic
|
| 38 |
+
|
| 39 |
+
2. **🤖 Smart Q&A Chatbot**
|
| 40 |
+
- Automatic language detection
|
| 41 |
+
- Context-aware responses
|
| 42 |
+
- Persistent chat history
|
| 43 |
+
|
| 44 |
+
3. **📝 Customizable Summaries**
|
| 45 |
+
- Concise, Detailed, Action-focused styles
|
| 46 |
+
- Adjustable length and creativity
|
| 47 |
+
|
| 48 |
+
4. **📊 Analytics & Export**
|
| 49 |
+
- Compression ratios and statistics
|
| 50 |
+
- Download summaries and chat sessions
|
| 51 |
+
|
| 52 |
+
### 5. Technical Architecture 🏗️
|
| 53 |
+
**System Architecture Diagram**
|
| 54 |
+
```
|
| 55 |
+
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
|
| 56 |
+
│ Input Module │ -> │ Azure OpenAI │ -> │ Output Module │
|
| 57 |
+
│ │ │ API Wrapper │ │ │
|
| 58 |
+
│ • File Upload │ │ • Prompt Eng. │ │ • Display │
|
| 59 |
+
│ • Text Input │ │ • Error Handle │ │ • Download │
|
| 60 |
+
│ • Sample Data │ │ • Response Proc │ │ • Statistics │
|
| 61 |
+
│ • Auto-detect │ │ • Multi-Lang │ │ • Chat Export │
|
| 62 |
+
└─────────────────┘ └─────────────────┘ └─────────────────┘
|
| 63 |
+
↕
|
| 64 |
+
┌─────────────────┐
|
| 65 |
+
│ Streamlit UI │
|
| 66 |
+
│ │
|
| 67 |
+
│ • Tabs Layout │
|
| 68 |
+
│ • Config Panel │
|
| 69 |
+
│ • Chat Interface│
|
| 70 |
+
└─────────────────┘
|
| 71 |
+
```
|
| 72 |
+
|
| 73 |
+
### 6. User Journey 👤
|
| 74 |
+
**4-Step Process:**
|
| 75 |
+
1. **Upload Meeting Transcript** - File upload, text paste, or sample data
|
| 76 |
+
2. **Configure Settings** - Choose language and summary style
|
| 77 |
+
3. **Generate Summary** - AI-powered analysis with progress indicator
|
| 78 |
+
4. **Interactive Q&A** - Multi-language questions with auto-detection
|
| 79 |
+
|
| 80 |
+
### 7. Global Language Support 🌍
|
| 81 |
+
**Multi-Language Capabilities:**
|
| 82 |
+
- 🔍 **Automatic Language Detection** - AI identifies question language
|
| 83 |
+
- 🌐 **10 Supported Languages** with examples:
|
| 84 |
+
- English: "What were the action items?"
|
| 85 |
+
- Spanish: "¿Cuáles fueron los elementos de acción?"
|
| 86 |
+
- French: "Quels étaient les sujets d'action?"
|
| 87 |
+
- German: "Welche Themen wurden besprochen?"
|
| 88 |
+
- Japanese: "次の手順は何ですか?"
|
| 89 |
+
- 💡 **Smart Features** - Fallback mechanisms and mixed-language support
|
| 90 |
+
|
| 91 |
+
### 8. Technical Stack 💻
|
| 92 |
+
**Technology Components:**
|
| 93 |
+
- **🤖 AI & ML**: Azure OpenAI GPT-4o-mini, Advanced prompt engineering
|
| 94 |
+
- **🖥️ Frontend & Backend**: Streamlit, Python, Session state management
|
| 95 |
+
- **🔧 Development & Testing**: 10 comprehensive test cases, Error handling
|
| 96 |
+
- **📦 Deployment**: Requirements.txt, CLI and web interfaces
|
| 97 |
+
|
| 98 |
+
### 9. Quality & Testing 🧪
|
| 99 |
+
**Comprehensive Testing:**
|
| 100 |
+
- **TC_01-02**: Transcript summarization (short & long)
|
| 101 |
+
- **TC_03-04**: Error handling (empty input, auth errors)
|
| 102 |
+
- **TC_05-06**: Chatbot functionality & validation
|
| 103 |
+
- **TC_07-08**: Multi-language capabilities
|
| 104 |
+
- **TC_09-10**: Auto-detection accuracy & responses
|
| 105 |
+
|
| 106 |
+
### 10. Real-World Applications 🌟
|
| 107 |
+
**Use Cases:**
|
| 108 |
+
- **🏢 Corporate Meetings**: Board meetings, project reviews, team collaborations
|
| 109 |
+
- **🌍 International Teams**: Multi-language documentation, global coordination
|
| 110 |
+
- **📚 Education & Training**: Lecture summaries, training documentation
|
| 111 |
+
- **🔍 Research & Analysis**: Interview analysis, focus groups, academic research
|
| 112 |
+
|
| 113 |
+
### 11. Business Value 💰
|
| 114 |
+
**ROI and Benefits:**
|
| 115 |
+
- **⏱️ Time Savings**: 80% reduction in manual note-taking time
|
| 116 |
+
- **🎯 Improved Accuracy**: Consistent quality, reduced human error
|
| 117 |
+
- **🌐 Global Accessibility**: Break language barriers, inclusive documentation
|
| 118 |
+
- **💡 Enhanced Productivity**: Focus on discussion, searchable knowledge base
|
| 119 |
+
|
| 120 |
+
### 12. Roadmap & Future Features 🚀
|
| 121 |
+
**Planned Enhancements:**
|
| 122 |
+
- **🎵 Audio Integration**: Direct audio upload, real-time transcription
|
| 123 |
+
- **📊 Advanced Analytics**: Sentiment analysis, participation metrics
|
| 124 |
+
- **🔗 Integrations**: Calendar, Slack/Teams, CRM connections
|
| 125 |
+
- **🤖 Enhanced AI**: Industry-specific models, automated assignments
|
| 126 |
+
|
| 127 |
+
### 13. Getting Started 🎯
|
| 128 |
+
**Setup and Usage:**
|
| 129 |
+
- **⚙️ Requirements**: Python 3.8+, Azure OpenAI credentials, Streamlit
|
| 130 |
+
- **🚀 Quick Start**: pip install → streamlit run app.py
|
| 131 |
+
- **📁 Project Structure**: app.py, test suite, documentation
|
| 132 |
+
- **💡 Try It Now**: Upload transcript, experience multi-language features
|
| 133 |
+
|
| 134 |
+
### 14. Thank You 🙏
|
| 135 |
+
**Closing Slide:**
|
| 136 |
+
- Thank you message
|
| 137 |
+
- App ready for testing
|
| 138 |
+
- Comprehensive documentation available
|
| 139 |
+
- Q&A invitation
|
| 140 |
+
|
| 141 |
+
---
|
| 142 |
+
|
| 143 |
+
## How to Generate the Presentation
|
| 144 |
+
|
| 145 |
+
### Option 1: Run the Python Script
|
| 146 |
+
```bash
|
| 147 |
+
python generate_presentation.py
|
| 148 |
+
```
|
| 149 |
+
|
| 150 |
+
### Option 2: Manual Creation
|
| 151 |
+
Use the content above to manually create slides in PowerPoint with:
|
| 152 |
+
- Professional color scheme (Blue primary, Orange secondary)
|
| 153 |
+
- Consistent fonts and formatting
|
| 154 |
+
- Visual elements and bullet points
|
| 155 |
+
- Architecture diagrams where indicated
|
| 156 |
+
|
| 157 |
+
### Option 3: Use the Script Template
|
| 158 |
+
The `generate_presentation.py` file contains all the code needed to automatically generate a professional PowerPoint presentation with proper formatting, colors, and layout.
|
| 159 |
+
|
| 160 |
+
## File Output
|
| 161 |
+
- **Filename**: `Meeting_Notes_Automation_Presentation.pptx`
|
| 162 |
+
- **Slides**: 14 comprehensive slides
|
| 163 |
+
- **Format**: Microsoft PowerPoint format
|
| 164 |
+
- **Size**: Approximately 100-200 KB
|
| 165 |
+
|
| 166 |
+
## Presentation Tips
|
| 167 |
+
1. **Demo Flow**: Consider having the live app open for demonstration
|
| 168 |
+
2. **Interactive Elements**: Show the language detection and Q&A features
|
| 169 |
+
3. **Real Examples**: Use actual meeting transcripts during the demo
|
| 170 |
+
4. **Technical Deep-Dive**: Be prepared to discuss the architecture and AI implementation
|
| 171 |
+
5. **Business Focus**: Emphasize ROI and practical business applications
|
| 172 |
+
|
| 173 |
+
This presentation provides a complete overview of your Meeting Notes Automation App, suitable for stakeholder presentations, technical reviews, or client demonstrations.
|
README.md
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# User Guide Summarization App �
|
| 2 |
+
|
| 3 |
+
Transform your user guide documentation into organized, digestible summaries using Azure OpenAI and Streamlit.
|
| 4 |
+
|
| 5 |
+
## Features ✨
|
| 6 |
+
|
| 7 |
+
- **Multiple Input Methods**: Upload files, paste text, or load sample user guides
|
| 8 |
+
- **🌐 Multi-Language Support**: Generate summaries and get answers in 10 different languages
|
| 9 |
+
- **Customizable Summaries**: Choose from concise, detailed, or action-focused styles
|
| 10 |
+
- **Advanced Settings**: Adjust output length and creativity levels
|
| 11 |
+
- **Download & Share**: Export summaries as text files
|
| 12 |
+
- **Real-time Statistics**: Track compression ratios and word counts
|
| 13 |
+
- **🤖 Smart Q&A Chatbot**: Interactive chatbot with automatic language detection
|
| 14 |
+
- **🔍 Auto-Language Detection**: Chatbot automatically detects and responds in question language
|
| 15 |
+
- **Chat History**: Persistent conversation history with export functionality
|
| 16 |
+
- **Suggested Questions**: Multi-language question suggestions for better interaction
|
| 17 |
+
- **Error Handling**: Graceful handling of API errors and invalid inputs
|
| 18 |
+
|
| 19 |
+
## Setup Instructions 🚀
|
| 20 |
+
|
| 21 |
+
### 1. Environment Setup
|
| 22 |
+
|
| 23 |
+
1. Create a `.env` file in the project root:
|
| 24 |
+
|
| 25 |
+
```bash
|
| 26 |
+
AZURE_OPENAI_API_KEY=your_api_key_here
|
| 27 |
+
AZURE_OPENAI_ENDPOINT=your_azure_endpoint_here
|
| 28 |
+
```
|
| 29 |
+
|
| 30 |
+
2. Install dependencies:
|
| 31 |
+
|
| 32 |
+
```bash
|
| 33 |
+
# Recommended: Use a virtual environment
|
| 34 |
+
python -m venv venv
|
| 35 |
+
source venv/bin/activate # (Linux/macOS)
|
| 36 |
+
venv\Scripts\activate # (Windows)
|
| 37 |
+
# Install required packages
|
| 38 |
+
pip install -r requirements.txt
|
| 39 |
+
```
|
| 40 |
+
|
| 41 |
+
### 2. Running the App
|
| 42 |
+
|
| 43 |
+
**Streamlit Web App:**
|
| 44 |
+
|
| 45 |
+
```bash
|
| 46 |
+
streamlit run app.py
|
| 47 |
+
```
|
| 48 |
+
|
| 49 |
+
**Command Line Version:**
|
| 50 |
+
|
| 51 |
+
```bash
|
| 52 |
+
python backend_developer.py
|
| 53 |
+
```
|
| 54 |
+
|
| 55 |
+
**Run Tests:**
|
| 56 |
+
|
| 57 |
+
```bash
|
| 58 |
+
python test_app.py
|
| 59 |
+
```
|
| 60 |
+
|
| 61 |
+
## Usage Guide 📖
|
| 62 |
+
|
| 63 |
+
### Web Interface (app.py)
|
| 64 |
+
|
| 65 |
+
#### User Guide Summary Tab
|
| 66 |
+
|
| 67 |
+
1. **Configure Settings**: Use the sidebar to choose summary style and adjust parameters
|
| 68 |
+
2. **Input Method**: Choose from:
|
| 69 |
+
- Upload a `.txt` file
|
| 70 |
+
- Paste text directly
|
| 71 |
+
- Load the sample user guide
|
| 72 |
+
3. **Generate Summary**: Click "Generate Summary" to process your user guide document
|
| 73 |
+
4. **Download Results**: Export your summary as a text file
|
| 74 |
+
|
| 75 |
+
#### Q&A Chatbot Tab
|
| 76 |
+
|
| 77 |
+
1. **Smart Interactive Chat**: Ask questions in any language - the bot automatically detects and responds in the same language
|
| 78 |
+
2. **Multi-Language Suggestions**: Click on suggested questions in different languages
|
| 79 |
+
3. **Automatic Language Detection**: No need to manually select language for questions
|
| 80 |
+
4. **Chat History**: View previous questions and answers in their original languages
|
| 81 |
+
5. **Export Chat**: Download the entire multilingual chat session as a text file
|
| 82 |
+
6. **Clear Chat**: Reset the conversation history when needed
|
| 83 |
+
|
| 84 |
+
### Configuration Options
|
| 85 |
+
|
| 86 |
+
- **Language Selection** 🌐:
|
| 87 |
+
|
| 88 |
+
- English, Spanish, French, German, Italian
|
| 89 |
+
- Portuguese, Japanese, Chinese (Simplified), Korean, Arabic
|
| 90 |
+
|
| 91 |
+
- **Summary Styles**:
|
| 92 |
+
|
| 93 |
+
- `concise`: Brief bullet points with key features and information
|
| 94 |
+
- `detailed`: Comprehensive summary with all sections and procedures
|
| 95 |
+
- `action-focused`: Emphasis on step-by-step instructions and guidelines
|
| 96 |
+
|
| 97 |
+
- **Advanced Settings**:
|
| 98 |
+
- `Max Output Length`: Control summary length (150-1000 tokens)
|
| 99 |
+
- `Creativity`: Adjust response variability (0.0-1.0)
|
| 100 |
+
|
| 101 |
+
## Test Cases 🧪
|
| 102 |
+
|
| 103 |
+
The app includes comprehensive testing covering:
|
| 104 |
+
|
| 105 |
+
- **TC_01**: Short user guide document summarization
|
| 106 |
+
- **TC_02**: Long multi-section guide handling
|
| 107 |
+
- **TC_03**: Empty input validation
|
| 108 |
+
- **TC_04**: Authentication error handling
|
| 109 |
+
- **TC_05**: Chatbot Q&A functionality
|
| 110 |
+
- **TC_06**: Empty question handling
|
| 111 |
+
- **TC_07**: Multi-language summary generation
|
| 112 |
+
- **TC_08**: Multi-language Q&A responses
|
| 113 |
+
- **TC_09**: Automatic language detection accuracy
|
| 114 |
+
- **TC_10**: Auto-language Q&A responses
|
| 115 |
+
|
| 116 |
+
Run tests with: `python test_app.py`
|
| 117 |
+
|
| 118 |
+
## System Architecture 🏗️
|
| 119 |
+
|
| 120 |
+
```
|
| 121 |
+
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
|
| 122 |
+
│ Input Module │ -> │ Azure OpenAI │ -> │ Output Module │
|
| 123 |
+
│ │ │ API Wrapper │ │ │
|
| 124 |
+
│ - File Upload │ │ - Prompt Eng. │ │ - Display │
|
| 125 |
+
│ - Text Input │ │ - Error Handle │ │ - Download │
|
| 126 |
+
│ - Sample Data │ │ - Response Proc │ │ - Statistics │
|
| 127 |
+
└─────────────────┘ └─────────────────┘ └─────────────────┘
|
| 128 |
+
```
|
| 129 |
+
|
| 130 |
+
## Error Handling 🛡️
|
| 131 |
+
|
| 132 |
+
- **Missing Credentials**: Clear error messages with setup instructions
|
| 133 |
+
- **Empty Input**: Helpful prompts to retry with content
|
| 134 |
+
- **API Errors**: Graceful degradation with user-friendly messages
|
| 135 |
+
- **File Upload Issues**: Validation and format checking
|
| 136 |
+
|
| 137 |
+
## File Structure 📁
|
| 138 |
+
|
| 139 |
+
```
|
| 140 |
+
├── app.py # Main Streamlit application
|
| 141 |
+
├── backend_developer.py # CLI version
|
| 142 |
+
├── test_app.py # Test suite
|
| 143 |
+
├── requirements.txt # Python dependencies
|
| 144 |
+
├── .env # Environment variables (create this)
|
| 145 |
+
├── data/
|
| 146 |
+
│ └── user_guide_sample.txt # Sample data
|
| 147 |
+
└── README.md # This file
|
| 148 |
+
```
|
| 149 |
+
|
| 150 |
+
## Dependencies 📦
|
| 151 |
+
|
| 152 |
+
- `streamlit>=1.28.0` - Web interface
|
| 153 |
+
- `openai>=1.0.0` - Azure OpenAI integration
|
| 154 |
+
- `python-dotenv>=1.0.0` - Environment variable management
|
| 155 |
+
|
| 156 |
+
## Troubleshooting 🔧
|
| 157 |
+
|
| 158 |
+
**Common Issues:**
|
| 159 |
+
|
| 160 |
+
1. **"Missing credentials" error**: Ensure `.env` file exists with correct variables
|
| 161 |
+
2. **Import errors**: Run `pip install -r requirements.txt`
|
| 162 |
+
3. **File not found**: Check that `data/user_guide_sample.txt` exists
|
| 163 |
+
4. **Streamlit not starting**: Verify Streamlit installation with `streamlit --version`
|
| 164 |
+
|
| 165 |
+
## Contributing 🤝
|
| 166 |
+
|
| 167 |
+
1. Fork the repository
|
| 168 |
+
2. Create a feature branch
|
| 169 |
+
3. Add tests for new functionality
|
| 170 |
+
4. Submit a pull request
|
| 171 |
+
|
| 172 |
+
## License 📄
|
| 173 |
+
|
| 174 |
+
This project is open source and available under the MIT License.
|
data/upload_example.txt
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
The goal of this template is to give a structure for the user guide. Its presentation is not user-friendly. Add you cover page, logo, look-and-feel etc…
|
| 6 |
+
|
| 7 |
+
Add also the CE Mark on the cover page, if necessary.
|
| 8 |
+
The identification of the document shall also be clear, add the identifier and revision date of the document on the cover page or somewhere where it is easily visible.
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
TABLE OF CONTENTS
|
| 12 |
+
|
| 13 |
+
1 Introduction 2
|
| 14 |
+
1.1 Conventions 2
|
| 15 |
+
1.2 Intended use 2
|
| 16 |
+
2 Precautions 2
|
| 17 |
+
2.1 Compliant Use 2
|
| 18 |
+
2.2 Safety instructions 3
|
| 19 |
+
2.2.1 Electromagnetic interferences 3
|
| 20 |
+
2.2.2 Electrical connection 3
|
| 21 |
+
2.2.3 Environment 3
|
| 22 |
+
2.2.4 Storage conditions 3
|
| 23 |
+
2.3 Malfunction 4
|
| 24 |
+
3 Installation 4
|
| 25 |
+
4 Getting started 4
|
| 26 |
+
5 Advanced functions 4
|
| 27 |
+
6 Maintenance 4
|
| 28 |
+
7 Cleaning and Disinfection 4
|
| 29 |
+
8 Error Messages, troubleshooting 4
|
| 30 |
+
9 Bibliography 5
|
| 31 |
+
10 Warranty 5
|
| 32 |
+
11 Legal Notices 5
|
| 33 |
+
11.1 Disclaimer 5
|
| 34 |
+
11.2 Copyrights and trademarks 5
|
| 35 |
+
12 Manufacturer Contact Information 5
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
1 Introduction
|
| 41 |
+
This document is the user guide for XXX, a device designed by <your company>.
|
| 42 |
+
It is recommended that you read this instruction manual carefully before use.
|
| 43 |
+
If your software uses accessories, give the list below
|
| 44 |
+
This product can only be used with accessories delivered by <your company>:
|
| 45 |
+
• List of accessories with references
|
| 46 |
+
• An accessory
|
| 47 |
+
• Another accessory
|
| 48 |
+
The use of any other accessories is forbidden.
|
| 49 |
+
Please, read carefully the precautions with symbols, to ensure that the device is used in best conditions and in complete safety.
|
| 50 |
+
1.1 Conventions
|
| 51 |
+
Typographical convention.
|
| 52 |
+
Any other convention.
|
| 53 |
+
|
| 54 |
+
To avoid all physical and material damage, this document splits safety instructions into 3 danger levels.
|
| 55 |
+
ATTENTION
|
| 56 |
+
Hazardous situation which can cause material damage or lead to moderate serious injury.
|
| 57 |
+
|
| 58 |
+
WARNING
|
| 59 |
+
Hazardous situation which can cause serious/ fatal injury.
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
Hazardous situation which could immediately cause serious/ fatal injury.
|
| 66 |
+
|
| 67 |
+
1.2 Intended use
|
| 68 |
+
Add here the intended use of your device
|
| 69 |
+
|
| 70 |
+
2 Precautions
|
| 71 |
+
2.1 Compliant Use
|
| 72 |
+
The use of this device is reserved to XXX (give the specialty of physicians or if they need a training or an education level), or under their control.
|
| 73 |
+
Any inappropriate use is forbidden.
|
| 74 |
+
|
| 75 |
+
The user shall:
|
| 76 |
+
• Only use non-defective products.
|
| 77 |
+
• Protect patients, third parties, other operators, assistants and themselves from all danger.
|
| 78 |
+
• Avoid all contamination by the product (remove this if you don’t sell hardware).
|
| 79 |
+
The user must check the safety of operation and the condition of the device before each use.
|
| 80 |
+
|
| 81 |
+
Verify that the product is operational at all times and keep it in good working conditions.
|
| 82 |
+
|
| 83 |
+
Only <your company> technicians are authorized to repair <your company> products.
|
| 84 |
+
|
| 85 |
+
2.2 Safety instructions
|
| 86 |
+
Add any instructions related to safety, especially mitigations actions from risk analysis
|
| 87 |
+
2.2.1 Electromagnetic interferences
|
| 88 |
+
If you sell hardware + software, then this part is important. If you sell only software you can remove it.
|
| 89 |
+
Example of safety instruction, add any other safety instruction:
|
| 90 |
+
The device is certified compliant with current electromagnetic compatibility standards.
|
| 91 |
+
|
| 92 |
+
ATTENTION
|
| 93 |
+
Users should ensure that no electromagnetic interference raises an additional risk.
|
| 94 |
+
So as not to disturb the proper operation of electromagnetic devices, it is recommended complying with the recommended separation distances for the device. ( give separation distances)
|
| 95 |
+
|
| 96 |
+
2.2.2 Electrical connection
|
| 97 |
+
If you sell hardware + software, then this part is important. If you sell only software you can remove it
|
| 98 |
+
Example of safety instruction, add any other safety instruction:
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
|
| 103 |
+
|
| 104 |
+
DANGER
|
| 105 |
+
Bad electrical connection - ELECTRIC SHOCK - ELECTROCUTION
|
| 106 |
+
|
| 107 |
+
Check that the supply voltage is the same as that shown on the device. Check the supply cable before each use.
|
| 108 |
+
Never plug or unplug the device to/from a wall socket with damp hands.
|
| 109 |
+
Any other use or connection of devices or peripherals to a port (USB, serial, parallel …) may create new risks and may require additional risk analysis
|
| 110 |
+
2.2.3 Environment
|
| 111 |
+
If you sell hardware + software, then this part is important. If you sell only software you can remove it.
|
| 112 |
+
Add safety instructions about environment, like presence of explosive gases (anesthetics), fluids, temperature, mechanical constraints …
|
| 113 |
+
2.2.4 Storage conditions
|
| 114 |
+
If you sell hardware + software, then this part is important. If you sell only software you can remove it.
|
| 115 |
+
Add safety instructions about recommended storage conditions …
|
| 116 |
+
2.3 Malfunction
|
| 117 |
+
In case of malfunction:
|
| 118 |
+
• Immediately stop using the device.
|
| 119 |
+
• Try to identify or eliminate the cause using the description in this document (section Error messages, troubleshooting).
|
| 120 |
+
• If it is not possible to identify or eliminate the cause using this document, switch the device off and call <your company> After-Sales Department (see Manufacturer section at the end of this document).
|
| 121 |
+
|
| 122 |
+
3 Installation - unistallation
|
| 123 |
+
Optional, you may remove this section and describe installation in a separate installation manual
|
| 124 |
+
Describe the installation and uninstallation of the hardware and software. Hardware and/or software installation may be only realized by technicians of your company. In this case, remove this section and describe installation in another (internal?) document.
|
| 125 |
+
4 Getting started
|
| 126 |
+
First use of software by the user, explain main and/or simple use cases, and main workflow.
|
| 127 |
+
|
| 128 |
+
|
| 129 |
+
|
| 130 |
+
5 Advanced functions
|
| 131 |
+
Advanced use, describe more complex use cases and/or secondary functions
|
| 132 |
+
|
| 133 |
+
|
| 134 |
+
|
| 135 |
+
6 Maintenance
|
| 136 |
+
Optional, you may remove this section and describe installation in a separate maintenance/administrator’s manual
|
| 137 |
+
Describe the maintenance of the hardware and software. Hardware and/or software maintenance may be only realized by technicians of your company. In this case, remove this section and describe installation in another (internal?) document.
|
| 138 |
+
|
| 139 |
+
7 Cleaning and Disinfection
|
| 140 |
+
If you sell hardware which shall be cleans and disinfected. Otherwise you can remove it.
|
| 141 |
+
You may rename this section “Cleaning, Disinfection and Sterilization” is you have instructions about sterilization.
|
| 142 |
+
|
| 143 |
+
Describe how the device shall be cleaned and disinfected. Is your hardware protected by screens, sheaths, if it is a medical PC, how to clean the screen, the mouse & keyboard …
|
| 144 |
+
8 Troubleshooting, Error Messages
|
| 145 |
+
|
| 146 |
+
This section is intended to help users, should a problem occur.
|
| 147 |
+
|
| 148 |
+
In the event of abnormal operation, immediately stop using the device and call <your company> After-Sales Dept.
|
| 149 |
+
If it is not possible to locate or eliminate the problem using this section, or if the dysfunction is still present, switch off the device and call <your company> After-Sales Dept.
|
| 150 |
+
|
| 151 |
+
|
| 152 |
+
|
| 153 |
+
DANGER
|
| 154 |
+
Never try to repair this device alone
|
| 155 |
+
|
| 156 |
+
|
| 157 |
+
|
| 158 |
+
|
| 159 |
+
Error message Description
|
| 160 |
+
Your error message Description of the error and how to fix it, if possible
|
| 161 |
+
Not enough disk space (err 123) Empty disk using xxxx
|
| 162 |
+
|
| 163 |
+
|
| 164 |
+
Malfunction Causes Solutions
|
| 165 |
+
The malfunction • The cause • The solution, if any, or call after-sales
|
| 166 |
+
The PC doesn’t start • It is unplugged • Plug it to main (I Love this one !!!)
|
| 167 |
+
9 Bibliography
|
| 168 |
+
Optional. Add here bibliography, clinical data that are relevant to the use of the device.
|
| 169 |
+
10 Warranty
|
| 170 |
+
Warranty terms and conditions. Not optional! …
|
| 171 |
+
11 Legal Notices
|
| 172 |
+
Optional, ask your legal advisory!
|
| 173 |
+
11.1 Disclaimer
|
| 174 |
+
Optional. The disclaimer is usual in software industry and is also often shown during software installation…
|
| 175 |
+
11.2 Copyrights and trademarks
|
| 176 |
+
Optional. Add your copyrights and trademarks
|
| 177 |
+
|
| 178 |
+
Add sentences like:
|
| 179 |
+
Windows is a registered trademark of Microsoft Corporation in the USA and other countries.
|
| 180 |
+
|
| 181 |
+
12 Manufacturer Contact Information
|
| 182 |
+
|
| 183 |
+
<Your Company>
|
| 184 |
+
Address
|
| 185 |
+
ZIP Code
|
| 186 |
+
Country
|
| 187 |
+
Contact Phone
|
| 188 |
+
Fax
|
| 189 |
+
|
data/user_guide_sample.txt
ADDED
|
@@ -0,0 +1,186 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
The goal of this template is to give a structure for the user guide. Its presentation is not user-friendly. Add you cover page, logo, look-and-feel etc…
|
| 3 |
+
|
| 4 |
+
Add also the CE Mark on the cover page, if necessary.
|
| 5 |
+
The identification of the document shall also be clear, add the identifier and revision date of the document on the cover page or somewhere where it is easily visible.
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
TABLE OF CONTENTS
|
| 9 |
+
|
| 10 |
+
1 Introduction 2
|
| 11 |
+
1.1 Conventions 2
|
| 12 |
+
1.2 Intended use 2
|
| 13 |
+
2 Precautions 2
|
| 14 |
+
2.1 Compliant Use 2
|
| 15 |
+
2.2 Safety instructions 3
|
| 16 |
+
2.2.1 Electromagnetic interferences 3
|
| 17 |
+
2.2.2 Electrical connection 3
|
| 18 |
+
2.2.3 Environment 3
|
| 19 |
+
2.2.4 Storage conditions 3
|
| 20 |
+
2.3 Malfunction 4
|
| 21 |
+
3 Installation 4
|
| 22 |
+
4 Getting started 4
|
| 23 |
+
5 Advanced functions 4
|
| 24 |
+
6 Maintenance 4
|
| 25 |
+
7 Cleaning and Disinfection 4
|
| 26 |
+
8 Error Messages, troubleshooting 4
|
| 27 |
+
9 Bibliography 5
|
| 28 |
+
10 Warranty 5
|
| 29 |
+
11 Legal Notices 5
|
| 30 |
+
11.1 Disclaimer 5
|
| 31 |
+
11.2 Copyrights and trademarks 5
|
| 32 |
+
12 Manufacturer Contact Information 5
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
1 Introduction
|
| 38 |
+
This document is the user guide for XXX, a device designed by <your company>.
|
| 39 |
+
It is recommended that you read this instruction manual carefully before use.
|
| 40 |
+
If your software uses accessories, give the list below
|
| 41 |
+
This product can only be used with accessories delivered by <your company>:
|
| 42 |
+
• List of accessories with references
|
| 43 |
+
• An accessory
|
| 44 |
+
• Another accessory
|
| 45 |
+
The use of any other accessories is forbidden.
|
| 46 |
+
Please, read carefully the precautions with symbols, to ensure that the device is used in best conditions and in complete safety.
|
| 47 |
+
1.1 Conventions
|
| 48 |
+
Typographical convention.
|
| 49 |
+
Any other convention.
|
| 50 |
+
|
| 51 |
+
To avoid all physical and material damage, this document splits safety instructions into 3 danger levels.
|
| 52 |
+
ATTENTION
|
| 53 |
+
Hazardous situation which can cause material damage or lead to moderate serious injury.
|
| 54 |
+
|
| 55 |
+
WARNING
|
| 56 |
+
Hazardous situation which can cause serious/ fatal injury.
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
Hazardous situation which could immediately cause serious/ fatal injury.
|
| 63 |
+
|
| 64 |
+
1.2 Intended use
|
| 65 |
+
Add here the intended use of your device
|
| 66 |
+
|
| 67 |
+
2 Precautions
|
| 68 |
+
2.1 Compliant Use
|
| 69 |
+
The use of this device is reserved to XXX (give the specialty of physicians or if they need a training or an education level), or under their control.
|
| 70 |
+
Any inappropriate use is forbidden.
|
| 71 |
+
|
| 72 |
+
The user shall:
|
| 73 |
+
• Only use non-defective products.
|
| 74 |
+
• Protect patients, third parties, other operators, assistants and themselves from all danger.
|
| 75 |
+
• Avoid all contamination by the product (remove this if you don’t sell hardware).
|
| 76 |
+
The user must check the safety of operation and the condition of the device before each use.
|
| 77 |
+
|
| 78 |
+
Verify that the product is operational at all times and keep it in good working conditions.
|
| 79 |
+
|
| 80 |
+
Only <your company> technicians are authorized to repair <your company> products.
|
| 81 |
+
|
| 82 |
+
2.2 Safety instructions
|
| 83 |
+
Add any instructions related to safety, especially mitigations actions from risk analysis
|
| 84 |
+
2.2.1 Electromagnetic interferences
|
| 85 |
+
If you sell hardware + software, then this part is important. If you sell only software you can remove it.
|
| 86 |
+
Example of safety instruction, add any other safety instruction:
|
| 87 |
+
The device is certified compliant with current electromagnetic compatibility standards.
|
| 88 |
+
|
| 89 |
+
ATTENTION
|
| 90 |
+
Users should ensure that no electromagnetic interference raises an additional risk.
|
| 91 |
+
So as not to disturb the proper operation of electromagnetic devices, it is recommended complying with the recommended separation distances for the device. ( give separation distances)
|
| 92 |
+
|
| 93 |
+
2.2.2 Electrical connection
|
| 94 |
+
If you sell hardware + software, then this part is important. If you sell only software you can remove it
|
| 95 |
+
Example of safety instruction, add any other safety instruction:
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
DANGER
|
| 102 |
+
Bad electrical connection - ELECTRIC SHOCK - ELECTROCUTION
|
| 103 |
+
|
| 104 |
+
Check that the supply voltage is the same as that shown on the device. Check the supply cable before each use.
|
| 105 |
+
Never plug or unplug the device to/from a wall socket with damp hands.
|
| 106 |
+
Any other use or connection of devices or peripherals to a port (USB, serial, parallel …) may create new risks and may require additional risk analysis
|
| 107 |
+
2.2.3 Environment
|
| 108 |
+
If you sell hardware + software, then this part is important. If you sell only software you can remove it.
|
| 109 |
+
Add safety instructions about environment, like presence of explosive gases (anesthetics), fluids, temperature, mechanical constraints …
|
| 110 |
+
2.2.4 Storage conditions
|
| 111 |
+
If you sell hardware + software, then this part is important. If you sell only software you can remove it.
|
| 112 |
+
Add safety instructions about recommended storage conditions …
|
| 113 |
+
2.3 Malfunction
|
| 114 |
+
In case of malfunction:
|
| 115 |
+
• Immediately stop using the device.
|
| 116 |
+
• Try to identify or eliminate the cause using the description in this document (section Error messages, troubleshooting).
|
| 117 |
+
• If it is not possible to identify or eliminate the cause using this document, switch the device off and call <your company> After-Sales Department (see Manufacturer section at the end of this document).
|
| 118 |
+
|
| 119 |
+
3 Installation - unistallation
|
| 120 |
+
Optional, you may remove this section and describe installation in a separate installation manual
|
| 121 |
+
Describe the installation and uninstallation of the hardware and software. Hardware and/or software installation may be only realized by technicians of your company. In this case, remove this section and describe installation in another (internal?) document.
|
| 122 |
+
4 Getting started
|
| 123 |
+
First use of software by the user, explain main and/or simple use cases, and main workflow.
|
| 124 |
+
|
| 125 |
+
|
| 126 |
+
|
| 127 |
+
5 Advanced functions
|
| 128 |
+
Advanced use, describe more complex use cases and/or secondary functions
|
| 129 |
+
|
| 130 |
+
|
| 131 |
+
|
| 132 |
+
6 Maintenance
|
| 133 |
+
Optional, you may remove this section and describe installation in a separate maintenance/administrator’s manual
|
| 134 |
+
Describe the maintenance of the hardware and software. Hardware and/or software maintenance may be only realized by technicians of your company. In this case, remove this section and describe installation in another (internal?) document.
|
| 135 |
+
|
| 136 |
+
7 Cleaning and Disinfection
|
| 137 |
+
If you sell hardware which shall be cleans and disinfected. Otherwise you can remove it.
|
| 138 |
+
You may rename this section “Cleaning, Disinfection and Sterilization” is you have instructions about sterilization.
|
| 139 |
+
|
| 140 |
+
Describe how the device shall be cleaned and disinfected. Is your hardware protected by screens, sheaths, if it is a medical PC, how to clean the screen, the mouse & keyboard …
|
| 141 |
+
8 Troubleshooting, Error Messages
|
| 142 |
+
|
| 143 |
+
This section is intended to help users, should a problem occur.
|
| 144 |
+
|
| 145 |
+
In the event of abnormal operation, immediately stop using the device and call <your company> After-Sales Dept.
|
| 146 |
+
If it is not possible to locate or eliminate the problem using this section, or if the dysfunction is still present, switch off the device and call <your company> After-Sales Dept.
|
| 147 |
+
|
| 148 |
+
|
| 149 |
+
|
| 150 |
+
DANGER
|
| 151 |
+
Never try to repair this device alone
|
| 152 |
+
|
| 153 |
+
|
| 154 |
+
|
| 155 |
+
|
| 156 |
+
Error message Description
|
| 157 |
+
Your error message Description of the error and how to fix it, if possible
|
| 158 |
+
Not enough disk space (err 123) Empty disk using xxxx
|
| 159 |
+
|
| 160 |
+
|
| 161 |
+
Malfunction Causes Solutions
|
| 162 |
+
The malfunction • The cause • The solution, if any, or call after-sales
|
| 163 |
+
The PC doesn’t start • It is unplugged • Plug it to main (I Love this one !!!)
|
| 164 |
+
9 Bibliography
|
| 165 |
+
Optional. Add here bibliography, clinical data that are relevant to the use of the device.
|
| 166 |
+
10 Warranty
|
| 167 |
+
Warranty terms and conditions. Not optional! …
|
| 168 |
+
11 Legal Notices
|
| 169 |
+
Optional, ask your legal advisory!
|
| 170 |
+
11.1 Disclaimer
|
| 171 |
+
Optional. The disclaimer is usual in software industry and is also often shown during software installation…
|
| 172 |
+
11.2 Copyrights and trademarks
|
| 173 |
+
Optional. Add your copyrights and trademarks
|
| 174 |
+
|
| 175 |
+
Add sentences like:
|
| 176 |
+
Windows is a registered trademark of Microsoft Corporation in the USA and other countries.
|
| 177 |
+
|
| 178 |
+
12 Manufacturer Contact Information
|
| 179 |
+
|
| 180 |
+
<Your Company>
|
| 181 |
+
Address
|
| 182 |
+
ZIP Code
|
| 183 |
+
Country
|
| 184 |
+
Contact Phone
|
| 185 |
+
Fax
|
| 186 |
+
|
main.py
ADDED
|
@@ -0,0 +1,502 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import os
|
| 3 |
+
from openai import AzureOpenAI
|
| 4 |
+
from dotenv import load_dotenv
|
| 5 |
+
import io
|
| 6 |
+
|
| 7 |
+
# Load environment variables from .env file
|
| 8 |
+
load_dotenv()
|
| 9 |
+
|
| 10 |
+
# Page configuration
|
| 11 |
+
st.set_page_config(
|
| 12 |
+
page_title="User Guide Summarization",
|
| 13 |
+
page_icon="🔍",
|
| 14 |
+
layout="wide",
|
| 15 |
+
initial_sidebar_state="expanded"
|
| 16 |
+
)
|
| 17 |
+
|
| 18 |
+
# Initialize session state
|
| 19 |
+
if 'summary' not in st.session_state:
|
| 20 |
+
st.session_state.summary = ""
|
| 21 |
+
if 'last_input' not in st.session_state:
|
| 22 |
+
st.session_state.last_input = ""
|
| 23 |
+
if 'chat_history' not in st.session_state:
|
| 24 |
+
st.session_state.chat_history = []
|
| 25 |
+
if 'guide_context' not in st.session_state:
|
| 26 |
+
st.session_state.guide_context = ""
|
| 27 |
+
|
| 28 |
+
def initialize_client():
|
| 29 |
+
"""Initialize Azure OpenAI client with error handling"""
|
| 30 |
+
try:
|
| 31 |
+
api_key = os.getenv("AZURE_OPENAI_API_KEY")
|
| 32 |
+
endpoint = os.getenv("AZURE_OPENAI_ENDPOINT")
|
| 33 |
+
|
| 34 |
+
if not api_key or not endpoint:
|
| 35 |
+
st.error("⚠️ Azure OpenAI credentials not found. Please check your .env file.")
|
| 36 |
+
st.info("Required environment variables: AZURE_OPENAI_API_KEY, AZURE_OPENAI_ENDPOINT")
|
| 37 |
+
return None
|
| 38 |
+
|
| 39 |
+
client = AzureOpenAI(
|
| 40 |
+
api_version="2024-07-01-preview",
|
| 41 |
+
azure_endpoint=endpoint,
|
| 42 |
+
api_key=api_key,
|
| 43 |
+
)
|
| 44 |
+
return client
|
| 45 |
+
except Exception as e:
|
| 46 |
+
st.error(f"❌ Failed to initialize Azure OpenAI client: {str(e)}")
|
| 47 |
+
return None
|
| 48 |
+
|
| 49 |
+
def summarize_user_guide(client, text, summary_style="concise", max_tokens=300, temperature=0.3, language="English", model="gpt-4o-mini"):
|
| 50 |
+
"""Generate user guide summary using Azure OpenAI"""
|
| 51 |
+
try:
|
| 52 |
+
if not text.strip():
|
| 53 |
+
return "⚠️ No content to summarize. Please provide a user guide document."
|
| 54 |
+
|
| 55 |
+
# Language-specific instructions
|
| 56 |
+
language_instructions = {
|
| 57 |
+
"English": "",
|
| 58 |
+
"Spanish": "Respond in Spanish.",
|
| 59 |
+
"French": "Respond in French.",
|
| 60 |
+
"German": "Respond in German.",
|
| 61 |
+
"Italian": "Respond in Italian.",
|
| 62 |
+
"Portuguese": "Respond in Portuguese.",
|
| 63 |
+
"Japanese": "Respond in Japanese.",
|
| 64 |
+
"Chinese (Simplified)": "Respond in Simplified Chinese.",
|
| 65 |
+
"Korean": "Respond in Korean.",
|
| 66 |
+
"Arabic": "Respond in Arabic."
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
# Customize prompt based on style
|
| 70 |
+
style_prompts = {
|
| 71 |
+
"concise": "Summarize the following user guide documentation into concise bullet points covering key features, instructions, and important information:",
|
| 72 |
+
"detailed": "Provide a detailed summary of the following user guide documentation, including all major sections, procedures, and important details:",
|
| 73 |
+
"action-focused": "Extract and organize the key procedures, step-by-step instructions, and important guidelines from the following user guide documentation:"
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
base_prompt = style_prompts.get(summary_style, style_prompts['concise'])
|
| 77 |
+
language_instruction = language_instructions.get(language, "")
|
| 78 |
+
|
| 79 |
+
if language_instruction:
|
| 80 |
+
prompt = f"{base_prompt} {language_instruction}\n\n{text}"
|
| 81 |
+
else:
|
| 82 |
+
prompt = f"{base_prompt}\n\n{text}"
|
| 83 |
+
|
| 84 |
+
response = client.chat.completions.create(
|
| 85 |
+
model=model,
|
| 86 |
+
messages=[{"role": "user", "content": prompt}],
|
| 87 |
+
max_tokens=max_tokens,
|
| 88 |
+
temperature=temperature
|
| 89 |
+
)
|
| 90 |
+
|
| 91 |
+
return response.choices[0].message.content
|
| 92 |
+
|
| 93 |
+
except Exception as e:
|
| 94 |
+
return f"❌ Error generating summary: {str(e)}"
|
| 95 |
+
|
| 96 |
+
def answer_question(client, question, guide_summary, guide_document="", language="English", model="gpt-4o-mini"):
|
| 97 |
+
"""Answer questions about the user guide using the summary and document"""
|
| 98 |
+
try:
|
| 99 |
+
if not question.strip():
|
| 100 |
+
return "⚠️ Please ask a question about the user guide."
|
| 101 |
+
|
| 102 |
+
if not guide_summary.strip():
|
| 103 |
+
return "⚠️ No guide summary available. Please generate a summary first."
|
| 104 |
+
|
| 105 |
+
# Language-specific instructions
|
| 106 |
+
language_instructions = {
|
| 107 |
+
"English": "",
|
| 108 |
+
"Spanish": " Please respond in Spanish.",
|
| 109 |
+
"French": " Please respond in French.",
|
| 110 |
+
"German": " Please respond in German.",
|
| 111 |
+
"Italian": " Please respond in Italian.",
|
| 112 |
+
"Portuguese": " Please respond in Portuguese.",
|
| 113 |
+
"Japanese": " Please respond in Japanese.",
|
| 114 |
+
"Chinese (Simplified)": " Please respond in Simplified Chinese.",
|
| 115 |
+
"Korean": " Please respond in Korean.",
|
| 116 |
+
"Arabic": " Please respond in Arabic."
|
| 117 |
+
}
|
| 118 |
+
|
| 119 |
+
# Create context-aware prompt
|
| 120 |
+
context = f"User Guide Summary:\n{guide_summary}"
|
| 121 |
+
if guide_document:
|
| 122 |
+
context += f"\n\nOriginal Document:\n{guide_document[:2000]}..." if len(guide_document) > 2000 else f"\n\nOriginal Document:\n{guide_document}"
|
| 123 |
+
|
| 124 |
+
language_instruction = language_instructions.get(language, "")
|
| 125 |
+
prompt = f"""Based on the following user guide information, please answer the user's question accurately and concisely.{language_instruction}
|
| 126 |
+
|
| 127 |
+
{context}
|
| 128 |
+
|
| 129 |
+
User Question: {question}
|
| 130 |
+
|
| 131 |
+
Answer:"""
|
| 132 |
+
|
| 133 |
+
response = client.chat.completions.create(
|
| 134 |
+
model=model,
|
| 135 |
+
messages=[{"role": "user", "content": prompt}],
|
| 136 |
+
max_tokens=300,
|
| 137 |
+
temperature=0.1 # Lower temperature for more factual responses
|
| 138 |
+
)
|
| 139 |
+
|
| 140 |
+
return response.choices[0].message.content
|
| 141 |
+
|
| 142 |
+
except Exception as e:
|
| 143 |
+
return f"❌ Error answering question: {str(e)}"
|
| 144 |
+
|
| 145 |
+
def detect_question_language(client, question, model="gpt-4o-mini"):
|
| 146 |
+
"""Detect the language of the user's question using AI"""
|
| 147 |
+
try:
|
| 148 |
+
if not question.strip():
|
| 149 |
+
return "English" # Default fallback
|
| 150 |
+
|
| 151 |
+
# Simple language detection prompt
|
| 152 |
+
detection_prompt = f"""Identify the language of the following text and respond with ONLY the language name in English (e.g., "Spanish", "French", "German", etc.). If you're not sure or it's mixed languages, respond with "English".
|
| 153 |
+
|
| 154 |
+
Text: "{question}"
|
| 155 |
+
|
| 156 |
+
Language:"""
|
| 157 |
+
|
| 158 |
+
response = client.chat.completions.create(
|
| 159 |
+
model=model,
|
| 160 |
+
messages=[{"role": "user", "content": detection_prompt}],
|
| 161 |
+
max_tokens=10,
|
| 162 |
+
temperature=0.1
|
| 163 |
+
)
|
| 164 |
+
|
| 165 |
+
detected_language = response.choices[0].message.content.strip()
|
| 166 |
+
|
| 167 |
+
# Validate detected language against supported languages
|
| 168 |
+
supported_languages = [
|
| 169 |
+
"English", "Spanish", "French", "German", "Italian",
|
| 170 |
+
"Portuguese", "Japanese", "Chinese", "Korean", "Arabic"
|
| 171 |
+
]
|
| 172 |
+
|
| 173 |
+
# Handle variations and ensure we return a supported language
|
| 174 |
+
language_mapping = {
|
| 175 |
+
"chinese (simplified)": "Chinese (Simplified)",
|
| 176 |
+
"chinese": "Chinese (Simplified)",
|
| 177 |
+
"simplified chinese": "Chinese (Simplified)",
|
| 178 |
+
"mandarin": "Chinese (Simplified)"
|
| 179 |
+
}
|
| 180 |
+
|
| 181 |
+
detected_lower = detected_language.lower()
|
| 182 |
+
if detected_lower in language_mapping:
|
| 183 |
+
return language_mapping[detected_lower]
|
| 184 |
+
|
| 185 |
+
# Check if detected language is in supported list (case insensitive)
|
| 186 |
+
for lang in supported_languages:
|
| 187 |
+
if lang.lower() == detected_lower:
|
| 188 |
+
return lang
|
| 189 |
+
|
| 190 |
+
# If not found, default to English
|
| 191 |
+
return "English"
|
| 192 |
+
|
| 193 |
+
except Exception as e:
|
| 194 |
+
print(f"Language detection error: {e}")
|
| 195 |
+
return "English" # Fallback to English on error
|
| 196 |
+
|
| 197 |
+
def answer_question_auto_lang(client, question, guide_summary, guide_document="", fallback_language="English", model="gpt-4o-mini"):
|
| 198 |
+
"""Answer questions with automatic language detection from the question"""
|
| 199 |
+
try:
|
| 200 |
+
if not question.strip():
|
| 201 |
+
return "⚠️ Please ask a question about the user guide."
|
| 202 |
+
|
| 203 |
+
if not guide_summary.strip():
|
| 204 |
+
return "⚠️ No guide summary available. Please generate a summary first."
|
| 205 |
+
|
| 206 |
+
# Detect the language of the question
|
| 207 |
+
detected_language = detect_question_language(client, question, model)
|
| 208 |
+
|
| 209 |
+
# Use the original answer_question function with detected language
|
| 210 |
+
return answer_question(client, question, guide_summary, guide_document, detected_language, model)
|
| 211 |
+
|
| 212 |
+
except Exception as e:
|
| 213 |
+
return f"❌ Error answering question: {str(e)}"
|
| 214 |
+
|
| 215 |
+
def main():
|
| 216 |
+
# Header
|
| 217 |
+
st.title("🔍 User Guide Summarization")
|
| 218 |
+
st.markdown("Transform your user guide documentation into organized, digestible summaries using AI")
|
| 219 |
+
|
| 220 |
+
# Sidebar configuration
|
| 221 |
+
st.sidebar.header("⚙️ Configuration")
|
| 222 |
+
|
| 223 |
+
# Model selection
|
| 224 |
+
model = st.sidebar.selectbox(
|
| 225 |
+
"🤖 AI Model",
|
| 226 |
+
["gpt-4o-mini", "gpt-4o", "gpt-4", "gpt-35-turbo", "gpt-35-turbo-16k"],
|
| 227 |
+
index=0,
|
| 228 |
+
help="Choose the Azure OpenAI model for processing"
|
| 229 |
+
)
|
| 230 |
+
|
| 231 |
+
# Language selection
|
| 232 |
+
language = st.sidebar.selectbox(
|
| 233 |
+
"🌐 Output Language",
|
| 234 |
+
["English", "Spanish", "French", "German", "Italian", "Portuguese", "Japanese", "Chinese (Simplified)", "Korean", "Arabic"],
|
| 235 |
+
help="Choose the language for the summary and Q&A responses"
|
| 236 |
+
)
|
| 237 |
+
|
| 238 |
+
# Summary style options
|
| 239 |
+
summary_style = st.sidebar.selectbox(
|
| 240 |
+
"📝 Summary Style",
|
| 241 |
+
["concise", "detailed", "action-focused"],
|
| 242 |
+
help="Choose the style of summary you want"
|
| 243 |
+
)
|
| 244 |
+
|
| 245 |
+
# Advanced settings
|
| 246 |
+
with st.sidebar.expander("Advanced Settings"):
|
| 247 |
+
max_tokens = st.slider("Max Output Length", 150, 1000, 300, 50)
|
| 248 |
+
temperature = st.slider("Creativity (Temperature)", 0.0, 1.0, 0.3, 0.1)
|
| 249 |
+
|
| 250 |
+
# Model information
|
| 251 |
+
st.info(f"**Selected Model:** {model}")
|
| 252 |
+
model_info = {
|
| 253 |
+
"gpt-4o-mini": "Fast and cost-effective, great for most tasks",
|
| 254 |
+
"gpt-4o": "Advanced reasoning and complex tasks",
|
| 255 |
+
"gpt-4": "High-quality responses with deep understanding",
|
| 256 |
+
"gpt-35-turbo": "Balanced performance and speed",
|
| 257 |
+
"gpt-35-turbo-16k": "Extended context length support"
|
| 258 |
+
}
|
| 259 |
+
st.caption(model_info.get(model, "Azure OpenAI model"))
|
| 260 |
+
|
| 261 |
+
# Initialize client
|
| 262 |
+
client = initialize_client()
|
| 263 |
+
|
| 264 |
+
if client is None:
|
| 265 |
+
st.stop()
|
| 266 |
+
|
| 267 |
+
# Main content area with tabs
|
| 268 |
+
tab1, tab2 = st.tabs(["🔍 User Guide Summary", "💬 Q&A Chatbot"])
|
| 269 |
+
|
| 270 |
+
with tab1:
|
| 271 |
+
col1, col2 = st.columns([1, 1])
|
| 272 |
+
|
| 273 |
+
with col1:
|
| 274 |
+
st.header("📥 Input")
|
| 275 |
+
|
| 276 |
+
# Input method selection
|
| 277 |
+
input_method = st.radio(
|
| 278 |
+
"Choose input method:",
|
| 279 |
+
["Upload file", "Paste text", "Load sample"]
|
| 280 |
+
)
|
| 281 |
+
|
| 282 |
+
transcript_text = ""
|
| 283 |
+
|
| 284 |
+
if input_method == "Upload file":
|
| 285 |
+
uploaded_file = st.file_uploader(
|
| 286 |
+
"Upload user guide document",
|
| 287 |
+
type=['txt', 'md'],
|
| 288 |
+
help="Upload a text file containing your user guide documentation",
|
| 289 |
+
)
|
| 290 |
+
|
| 291 |
+
if uploaded_file is not None:
|
| 292 |
+
transcript_text = str(uploaded_file.read(), "utf-8")
|
| 293 |
+
st.success(f"✅ File uploaded successfully! ({len(transcript_text)} characters)")
|
| 294 |
+
|
| 295 |
+
elif input_method == "Paste text":
|
| 296 |
+
transcript_text = st.text_area(
|
| 297 |
+
"Paste your user guide document here:",
|
| 298 |
+
height=300,
|
| 299 |
+
placeholder="Enter or paste your user guide documentation here..."
|
| 300 |
+
)
|
| 301 |
+
|
| 302 |
+
else: # Load sample
|
| 303 |
+
if st.button("📄 Load Sample User Guide"):
|
| 304 |
+
try:
|
| 305 |
+
with open("data/user_guide_sample.txt", "r") as f:
|
| 306 |
+
transcript_text = f.read()
|
| 307 |
+
st.success("✅ Sample user guide loaded!")
|
| 308 |
+
except FileNotFoundError:
|
| 309 |
+
st.error("❌ Sample file not found. Please create data/user_guide_sample.txt")
|
| 310 |
+
transcript_text = ""
|
| 311 |
+
|
| 312 |
+
# Display input preview
|
| 313 |
+
if transcript_text:
|
| 314 |
+
with st.expander("📖 Preview Input"):
|
| 315 |
+
st.text_area("Document preview:", transcript_text[:500] + "..." if len(transcript_text) > 500 else transcript_text, height=150, disabled=True)
|
| 316 |
+
|
| 317 |
+
with col2:
|
| 318 |
+
st.header("📤 Output")
|
| 319 |
+
|
| 320 |
+
# Generate summary button
|
| 321 |
+
if st.button("🎯 Generate Summary", type="primary", disabled=not transcript_text):
|
| 322 |
+
if transcript_text.strip():
|
| 323 |
+
with st.spinner("🤖 Generating summary..."):
|
| 324 |
+
summary = summarize_user_guide(
|
| 325 |
+
client,
|
| 326 |
+
transcript_text,
|
| 327 |
+
summary_style,
|
| 328 |
+
max_tokens,
|
| 329 |
+
temperature,
|
| 330 |
+
language,
|
| 331 |
+
model
|
| 332 |
+
)
|
| 333 |
+
st.session_state.summary = summary
|
| 334 |
+
st.session_state.last_input = transcript_text
|
| 335 |
+
st.session_state.guide_context = transcript_text
|
| 336 |
+
# Clear chat history when new summary is generated
|
| 337 |
+
st.session_state.chat_history = []
|
| 338 |
+
else:
|
| 339 |
+
st.warning("⚠️ Please provide a user guide document first.")
|
| 340 |
+
|
| 341 |
+
# Display summary
|
| 342 |
+
if st.session_state.summary:
|
| 343 |
+
st.subheader("📋 User Guide Summary")
|
| 344 |
+
|
| 345 |
+
# Summary output
|
| 346 |
+
summary_container = st.container()
|
| 347 |
+
with summary_container:
|
| 348 |
+
st.markdown(st.session_state.summary)
|
| 349 |
+
|
| 350 |
+
# Action buttons
|
| 351 |
+
col_download, col_copy = st.columns(2)
|
| 352 |
+
|
| 353 |
+
with col_download:
|
| 354 |
+
# Download as text file
|
| 355 |
+
summary_bytes = st.session_state.summary.encode('utf-8')
|
| 356 |
+
st.download_button(
|
| 357 |
+
label="💾 Download Summary",
|
| 358 |
+
data=summary_bytes,
|
| 359 |
+
file_name="user_guide_summary.txt",
|
| 360 |
+
mime="text/plain"
|
| 361 |
+
)
|
| 362 |
+
|
| 363 |
+
with col_copy:
|
| 364 |
+
# Copy to clipboard (placeholder - requires JavaScript)
|
| 365 |
+
if st.button("📋 Copy to Clipboard"):
|
| 366 |
+
st.info("💡 Use Ctrl+A, Ctrl+C to copy the summary above")
|
| 367 |
+
|
| 368 |
+
# Display statistics
|
| 369 |
+
if st.session_state.summary and st.session_state.last_input:
|
| 370 |
+
st.subheader("📊 Statistics")
|
| 371 |
+
input_words = len(st.session_state.last_input.split())
|
| 372 |
+
output_words = len(st.session_state.summary.split())
|
| 373 |
+
compression_ratio = round((1 - output_words/input_words) * 100, 1) if input_words > 0 else 0
|
| 374 |
+
|
| 375 |
+
col_stat1, col_stat2, col_stat3 = st.columns(3)
|
| 376 |
+
col_stat1.metric("Input Words", input_words)
|
| 377 |
+
col_stat2.metric("Output Words", output_words)
|
| 378 |
+
col_stat3.metric("Compression", f"{compression_ratio}%")
|
| 379 |
+
|
| 380 |
+
with tab2:
|
| 381 |
+
st.header("🤖 User Guide Q&A Chatbot")
|
| 382 |
+
|
| 383 |
+
# Check if there's a summary to chat about
|
| 384 |
+
if not st.session_state.summary:
|
| 385 |
+
st.info("� Please generate a user guide summary first to start chatting about it!")
|
| 386 |
+
st.markdown("Go to the **User Guide Summary** tab to upload a document and generate a summary.")
|
| 387 |
+
else:
|
| 388 |
+
# Display user guide summary context
|
| 389 |
+
with st.expander("📋 User Guide Context", expanded=False):
|
| 390 |
+
st.markdown("**Current User Guide Summary:**")
|
| 391 |
+
st.text_area("Summary", st.session_state.summary, height=100, disabled=True)
|
| 392 |
+
|
| 393 |
+
# Chat interface
|
| 394 |
+
st.markdown("**Ask questions about the user guide:**")
|
| 395 |
+
st.info("💡 **Smart Language Detection**: Ask questions in any supported language, and I'll respond in the same language! The configured language above is used for summaries only.")
|
| 396 |
+
|
| 397 |
+
# Display chat history
|
| 398 |
+
if st.session_state.chat_history:
|
| 399 |
+
st.markdown("### 💬 Conversation History")
|
| 400 |
+
|
| 401 |
+
for i, (question, answer) in enumerate(st.session_state.chat_history):
|
| 402 |
+
# User question
|
| 403 |
+
st.markdown(f"**👤 You:** {question}")
|
| 404 |
+
# Bot answer
|
| 405 |
+
st.markdown(f"**🤖 Assistant:** {answer}")
|
| 406 |
+
st.markdown("---")
|
| 407 |
+
|
| 408 |
+
# Question input
|
| 409 |
+
col_input, col_ask = st.columns([4, 1])
|
| 410 |
+
|
| 411 |
+
with col_input:
|
| 412 |
+
question = st.text_input(
|
| 413 |
+
"Ask a question:",
|
| 414 |
+
placeholder="e.g., How do I configure this feature? | ¿Cómo configuro esta característica? | Comment configurer cette fonctionnalité?",
|
| 415 |
+
key="question_input"
|
| 416 |
+
)
|
| 417 |
+
|
| 418 |
+
with col_ask:
|
| 419 |
+
st.markdown("<br>", unsafe_allow_html=True) # Align button with input
|
| 420 |
+
ask_button = st.button("🚀 Ask", type="primary")
|
| 421 |
+
|
| 422 |
+
# Process question
|
| 423 |
+
if ask_button and question:
|
| 424 |
+
if client:
|
| 425 |
+
with st.spinner("🤔 Thinking..."):
|
| 426 |
+
# Use auto-detection for chatbot, but keep manual language for summaries
|
| 427 |
+
answer = answer_question_auto_lang(
|
| 428 |
+
client,
|
| 429 |
+
question,
|
| 430 |
+
st.session_state.summary,
|
| 431 |
+
st.session_state.last_input,
|
| 432 |
+
language, # fallback language
|
| 433 |
+
model
|
| 434 |
+
)
|
| 435 |
+
|
| 436 |
+
# Add to chat history
|
| 437 |
+
st.session_state.chat_history.append((question, answer))
|
| 438 |
+
|
| 439 |
+
# Clear input and rerun to show new message
|
| 440 |
+
st.rerun()
|
| 441 |
+
else:
|
| 442 |
+
st.error("❌ Unable to process question. Please check your API configuration.")
|
| 443 |
+
|
| 444 |
+
# Chat controls
|
| 445 |
+
col_clear, col_export = st.columns(2)
|
| 446 |
+
|
| 447 |
+
with col_clear:
|
| 448 |
+
if st.button("🗑️ Clear Chat") and st.session_state.chat_history:
|
| 449 |
+
st.session_state.chat_history = []
|
| 450 |
+
st.rerun()
|
| 451 |
+
|
| 452 |
+
with col_export:
|
| 453 |
+
if st.session_state.chat_history:
|
| 454 |
+
# Export chat history
|
| 455 |
+
chat_export = "User Guide Q&A Session\n" + "="*50 + "\n\n"
|
| 456 |
+
chat_export += f"User Guide Summary:\n{st.session_state.summary}\n\n"
|
| 457 |
+
chat_export += "Conversation:\n" + "-"*30 + "\n"
|
| 458 |
+
|
| 459 |
+
for i, (q, a) in enumerate(st.session_state.chat_history, 1):
|
| 460 |
+
chat_export += f"Q{i}: {q}\n"
|
| 461 |
+
chat_export += f"A{i}: {a}\n\n"
|
| 462 |
+
|
| 463 |
+
st.download_button(
|
| 464 |
+
label="💾 Export Chat",
|
| 465 |
+
data=chat_export.encode('utf-8'),
|
| 466 |
+
file_name="user_guide_qa_session.txt",
|
| 467 |
+
mime="text/plain"
|
| 468 |
+
)
|
| 469 |
+
|
| 470 |
+
# Suggested questions
|
| 471 |
+
if st.session_state.summary and not st.session_state.chat_history:
|
| 472 |
+
st.markdown("### 💡 Suggested Questions (Multi-Language)")
|
| 473 |
+
suggested_questions = [
|
| 474 |
+
"What are the main features described in this guide?",
|
| 475 |
+
"¿Cuáles son las características principales descritas en esta guía?",
|
| 476 |
+
"Quelles sont les procédures étape par étape?",
|
| 477 |
+
"Welche wichtigen Konfigurationsschritte gibt es?",
|
| 478 |
+
"このガイドの主要な機能は何ですか?"
|
| 479 |
+
]
|
| 480 |
+
|
| 481 |
+
cols = st.columns(2)
|
| 482 |
+
for i, suggestion in enumerate(suggested_questions):
|
| 483 |
+
with cols[i % 2]:
|
| 484 |
+
if st.button(f"💭 {suggestion}", key=f"suggestion_{i}"):
|
| 485 |
+
# Set the question and trigger ask
|
| 486 |
+
if client:
|
| 487 |
+
with st.spinner("🤔 Thinking..."):
|
| 488 |
+
# Use auto-detection for suggested questions too
|
| 489 |
+
answer = answer_question_auto_lang(
|
| 490 |
+
client,
|
| 491 |
+
suggestion,
|
| 492 |
+
st.session_state.summary,
|
| 493 |
+
st.session_state.last_input,
|
| 494 |
+
language, # fallback language
|
| 495 |
+
model
|
| 496 |
+
)
|
| 497 |
+
|
| 498 |
+
st.session_state.chat_history.append((suggestion, answer))
|
| 499 |
+
st.rerun()
|
| 500 |
+
|
| 501 |
+
if __name__ == "__main__":
|
| 502 |
+
main()
|
requirements.txt
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
openai>=1.0.0
|
| 3 |
+
python-dotenv>=1.0.0
|
| 4 |
+
streamlit>=1.28.0
|
| 5 |
+
python-pptx>=0.6.21
|
test_app.py
ADDED
|
@@ -0,0 +1,296 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Test cases for Meeting Notes Automation App
|
| 3 |
+
Based on the requirements provided
|
| 4 |
+
"""
|
| 5 |
+
|
| 6 |
+
import os
|
| 7 |
+
import sys
|
| 8 |
+
from dotenv import load_dotenv
|
| 9 |
+
|
| 10 |
+
# Add the current directory to the path for imports
|
| 11 |
+
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
| 12 |
+
|
| 13 |
+
# Import the functions from our app
|
| 14 |
+
try:
|
| 15 |
+
from app import initialize_client, summarize_meeting, answer_question, answer_question_auto_lang, detect_question_language
|
| 16 |
+
load_dotenv()
|
| 17 |
+
except ImportError as e:
|
| 18 |
+
print(f"Error importing modules: {e}")
|
| 19 |
+
sys.exit(1)
|
| 20 |
+
|
| 21 |
+
def test_case_01():
|
| 22 |
+
"""TC_01: Summarize a short meeting transcript → concise notes produced"""
|
| 23 |
+
print("\n🧪 Test Case 01: Short meeting transcript")
|
| 24 |
+
|
| 25 |
+
short_transcript = """
|
| 26 |
+
Meeting: Quick standup
|
| 27 |
+
Alice: Good morning team. What did everyone work on yesterday?
|
| 28 |
+
Bob: I completed the API integration.
|
| 29 |
+
Carol: I finished the UI mockups.
|
| 30 |
+
Alice: Great! Any blockers for today?
|
| 31 |
+
Bob: None from me.
|
| 32 |
+
Carol: All good here too.
|
| 33 |
+
Alice: Perfect, let's reconvene tomorrow.
|
| 34 |
+
"""
|
| 35 |
+
|
| 36 |
+
client = initialize_client()
|
| 37 |
+
if client:
|
| 38 |
+
result = summarize_meeting(client, short_transcript, "concise", 150, 0.3)
|
| 39 |
+
print(f"✅ Result: {result}")
|
| 40 |
+
return "✅ PASS" if len(result) > 10 and "❌" not in result else "❌ FAIL"
|
| 41 |
+
else:
|
| 42 |
+
return "❌ FAIL - Client initialization failed"
|
| 43 |
+
|
| 44 |
+
def test_case_02():
|
| 45 |
+
"""TC_02: Summarize a long transcript with multiple topics → clear sectioned notes"""
|
| 46 |
+
print("\n🧪 Test Case 02: Long transcript with multiple topics")
|
| 47 |
+
|
| 48 |
+
long_transcript = """
|
| 49 |
+
Meeting: Quarterly Review
|
| 50 |
+
|
| 51 |
+
Alice: Welcome to our Q3 review. Let's start with the engineering team update.
|
| 52 |
+
Bob: We completed 85% of our planned features. The main achievements were the new API endpoints and improved performance.
|
| 53 |
+
Carol: From the design side, we delivered all mockups on time and got great user feedback.
|
| 54 |
+
|
| 55 |
+
Alice: Now let's discuss Q4 planning.
|
| 56 |
+
Bob: We need to focus on scalability and security improvements.
|
| 57 |
+
Carol: I suggest we also prioritize user experience enhancements.
|
| 58 |
+
|
| 59 |
+
Alice: Budget discussion - we're on track but need to allocate more for cloud infrastructure.
|
| 60 |
+
Bob: Agreed, we'll need at least 20% more for the expected traffic growth.
|
| 61 |
+
|
| 62 |
+
Alice: Action items - Bob will prepare the infrastructure proposal, Carol will research UX tools.
|
| 63 |
+
"""
|
| 64 |
+
|
| 65 |
+
client = initialize_client()
|
| 66 |
+
if client:
|
| 67 |
+
result = summarize_meeting(client, long_transcript, "detailed", 400, 0.3)
|
| 68 |
+
print(f"✅ Result: {result}")
|
| 69 |
+
return "✅ PASS" if len(result) > 50 and "❌" not in result else "❌ FAIL"
|
| 70 |
+
else:
|
| 71 |
+
return "❌ FAIL - Client initialization failed"
|
| 72 |
+
|
| 73 |
+
def test_case_03():
|
| 74 |
+
"""TC_03: Empty input text → returns helpful error or prompt to retry"""
|
| 75 |
+
print("\n🧪 Test Case 03: Empty input handling")
|
| 76 |
+
|
| 77 |
+
empty_transcript = ""
|
| 78 |
+
|
| 79 |
+
client = initialize_client()
|
| 80 |
+
if client:
|
| 81 |
+
result = summarize_meeting(client, empty_transcript, "concise", 150, 0.3)
|
| 82 |
+
print(f"✅ Result: {result}")
|
| 83 |
+
return "✅ PASS" if "No content" in result or "⚠️" in result else "❌ FAIL"
|
| 84 |
+
else:
|
| 85 |
+
return "❌ FAIL - Client initialization failed"
|
| 86 |
+
|
| 87 |
+
def test_case_04():
|
| 88 |
+
"""TC_04: Invalid API key → handle authentication error"""
|
| 89 |
+
print("\n🧪 Test Case 04: Invalid API key handling")
|
| 90 |
+
|
| 91 |
+
# Temporarily modify environment variables to simulate invalid credentials
|
| 92 |
+
original_key = os.getenv("AZURE_OPENAI_API_KEY")
|
| 93 |
+
os.environ["AZURE_OPENAI_API_KEY"] = "invalid_key_test"
|
| 94 |
+
|
| 95 |
+
client = initialize_client()
|
| 96 |
+
|
| 97 |
+
# Restore original key
|
| 98 |
+
if original_key:
|
| 99 |
+
os.environ["AZURE_OPENAI_API_KEY"] = original_key
|
| 100 |
+
|
| 101 |
+
if client is None:
|
| 102 |
+
print("✅ Result: Client initialization failed gracefully")
|
| 103 |
+
return "✅ PASS"
|
| 104 |
+
else:
|
| 105 |
+
# If client was created, try to use it and expect an error
|
| 106 |
+
test_transcript = "Test meeting content"
|
| 107 |
+
result = summarize_meeting(client, test_transcript, "concise", 150, 0.3)
|
| 108 |
+
print(f"✅ Result: {result}")
|
| 109 |
+
return "✅ PASS" if "❌" in result or "Error" in result else "❌ FAIL"
|
| 110 |
+
|
| 111 |
+
def test_case_05():
|
| 112 |
+
"""TC_05: Chatbot Q&A functionality → answers questions about meeting summary"""
|
| 113 |
+
print("\n🧪 Test Case 05: Chatbot Q&A functionality")
|
| 114 |
+
|
| 115 |
+
# Sample meeting summary for testing
|
| 116 |
+
sample_summary = """
|
| 117 |
+
Meeting Summary:
|
| 118 |
+
- Discussed Q3 performance review
|
| 119 |
+
- Bob completed API integration project
|
| 120 |
+
- Carol finished UI mockups ahead of schedule
|
| 121 |
+
- Action items: Bob to prepare infrastructure proposal, Carol to research UX tools
|
| 122 |
+
- Budget discussion: need 20% more allocation for cloud infrastructure
|
| 123 |
+
"""
|
| 124 |
+
|
| 125 |
+
test_question = "What are the action items from this meeting?"
|
| 126 |
+
|
| 127 |
+
client = initialize_client()
|
| 128 |
+
if client:
|
| 129 |
+
result = answer_question(client, test_question, sample_summary)
|
| 130 |
+
print(f"✅ Question: {test_question}")
|
| 131 |
+
print(f"✅ Result: {result}")
|
| 132 |
+
return "✅ PASS" if len(result) > 10 and "❌" not in result else "❌ FAIL"
|
| 133 |
+
else:
|
| 134 |
+
return "❌ FAIL - Client initialization failed"
|
| 135 |
+
|
| 136 |
+
def test_case_06():
|
| 137 |
+
"""TC_06: Empty question handling → returns helpful prompt"""
|
| 138 |
+
print("\n🧪 Test Case 06: Empty question handling")
|
| 139 |
+
|
| 140 |
+
sample_summary = "Meeting summary with some content"
|
| 141 |
+
empty_question = ""
|
| 142 |
+
|
| 143 |
+
client = initialize_client()
|
| 144 |
+
if client:
|
| 145 |
+
result = answer_question(client, empty_question, sample_summary)
|
| 146 |
+
print(f"✅ Result: {result}")
|
| 147 |
+
return "✅ PASS" if "ask a question" in result.lower() or "⚠️" in result else "❌ FAIL"
|
| 148 |
+
else:
|
| 149 |
+
return "❌ FAIL - Client initialization failed"
|
| 150 |
+
|
| 151 |
+
def test_case_07():
|
| 152 |
+
"""TC_07: Multi-language summary generation → generates summary in specified language"""
|
| 153 |
+
print("\n🧪 Test Case 07: Multi-language summary generation")
|
| 154 |
+
|
| 155 |
+
short_transcript = """
|
| 156 |
+
Meeting: Quick standup
|
| 157 |
+
Alice: Good morning team. What did everyone work on yesterday?
|
| 158 |
+
Bob: I completed the API integration.
|
| 159 |
+
Carol: I finished the UI mockups.
|
| 160 |
+
Alice: Great! Any blockers for today?
|
| 161 |
+
Bob: None from me.
|
| 162 |
+
Carol: All good here too.
|
| 163 |
+
Alice: Perfect, let's reconvene tomorrow.
|
| 164 |
+
"""
|
| 165 |
+
|
| 166 |
+
client = initialize_client()
|
| 167 |
+
if client:
|
| 168 |
+
# Test Spanish summary
|
| 169 |
+
result = summarize_meeting(client, short_transcript, "concise", 150, 0.3, "Spanish")
|
| 170 |
+
print(f"✅ Spanish Result: {result}")
|
| 171 |
+
|
| 172 |
+
# Simple check - if it contains Spanish words or characters, consider it a pass
|
| 173 |
+
spanish_indicators = ['reunión', 'equipo', 'trabajo', 'ayer', 'hoy', 'mañana', 'completé', 'terminé']
|
| 174 |
+
has_spanish = any(word in result.lower() for word in spanish_indicators) or "✅" not in result
|
| 175 |
+
|
| 176 |
+
return "✅ PASS" if has_spanish and "❌" not in result else "❌ FAIL"
|
| 177 |
+
else:
|
| 178 |
+
return "❌ FAIL - Client initialization failed"
|
| 179 |
+
|
| 180 |
+
def test_case_08():
|
| 181 |
+
"""TC_08: Multi-language Q&A → answers questions in specified language"""
|
| 182 |
+
print("\n🧪 Test Case 08: Multi-language Q&A")
|
| 183 |
+
|
| 184 |
+
sample_summary = """
|
| 185 |
+
Meeting Summary:
|
| 186 |
+
- Discussed Q3 performance review
|
| 187 |
+
- Bob completed API integration project
|
| 188 |
+
- Action items: Prepare infrastructure proposal
|
| 189 |
+
"""
|
| 190 |
+
|
| 191 |
+
test_question = "What are the action items?"
|
| 192 |
+
|
| 193 |
+
client = initialize_client()
|
| 194 |
+
if client:
|
| 195 |
+
# Test French Q&A
|
| 196 |
+
result = answer_question(client, test_question, sample_summary, "", "French")
|
| 197 |
+
print(f"✅ French Q&A Result: {result}")
|
| 198 |
+
|
| 199 |
+
# Simple check for French response
|
| 200 |
+
french_indicators = ['éléments', 'actions', 'tâches', 'proposer', 'infrastructure', 'projet']
|
| 201 |
+
has_french = any(word in result.lower() for word in french_indicators) or len(result) > 10
|
| 202 |
+
|
| 203 |
+
return "✅ PASS" if has_french and "❌" not in result else "❌ FAIL"
|
| 204 |
+
else:
|
| 205 |
+
return "❌ FAIL - Client initialization failed"
|
| 206 |
+
|
| 207 |
+
def test_case_09():
|
| 208 |
+
"""TC_09: Language auto-detection → detects question language correctly"""
|
| 209 |
+
print("\n🧪 Test Case 09: Language auto-detection")
|
| 210 |
+
|
| 211 |
+
client = initialize_client()
|
| 212 |
+
if client:
|
| 213 |
+
# Test different language questions
|
| 214 |
+
test_cases = [
|
| 215 |
+
("What are the action items?", "English"),
|
| 216 |
+
("¿Cuáles son los elementos de acción?", "Spanish"),
|
| 217 |
+
("Quels sont les éléments d'action?", "French")
|
| 218 |
+
]
|
| 219 |
+
|
| 220 |
+
results = []
|
| 221 |
+
for question, expected_lang in test_cases:
|
| 222 |
+
detected = detect_question_language(client, question)
|
| 223 |
+
print(f"✅ Question: '{question}' → Detected: {detected} (Expected: {expected_lang})")
|
| 224 |
+
results.append(detected.lower() == expected_lang.lower())
|
| 225 |
+
|
| 226 |
+
# Pass if at least 2 out of 3 detections are correct
|
| 227 |
+
success_rate = sum(results) / len(results)
|
| 228 |
+
return "✅ PASS" if success_rate >= 0.66 else "❌ FAIL"
|
| 229 |
+
else:
|
| 230 |
+
return "❌ FAIL - Client initialization failed"
|
| 231 |
+
|
| 232 |
+
def test_case_10():
|
| 233 |
+
"""TC_10: Auto-language Q&A → responds in detected question language"""
|
| 234 |
+
print("\n🧪 Test Case 10: Auto-language Q&A")
|
| 235 |
+
|
| 236 |
+
sample_summary = """
|
| 237 |
+
Meeting Summary:
|
| 238 |
+
- Discussed Q3 performance review
|
| 239 |
+
- Bob completed API integration project
|
| 240 |
+
- Action items: Prepare infrastructure proposal
|
| 241 |
+
"""
|
| 242 |
+
|
| 243 |
+
client = initialize_client()
|
| 244 |
+
if client:
|
| 245 |
+
# Test Spanish question with auto-detection
|
| 246 |
+
spanish_question = "¿Cuáles fueron las decisiones principales?"
|
| 247 |
+
result = answer_question_auto_lang(client, spanish_question, sample_summary)
|
| 248 |
+
print(f"✅ Spanish Auto-Detection Result: {result}")
|
| 249 |
+
|
| 250 |
+
# Check if response contains Spanish elements or is substantial
|
| 251 |
+
spanish_indicators = ['decisiones', 'principales', 'reunión', 'proyecto', 'revisión']
|
| 252 |
+
has_spanish = any(word in result.lower() for word in spanish_indicators) or len(result) > 20
|
| 253 |
+
|
| 254 |
+
return "✅ PASS" if has_spanish and "❌" not in result else "❌ FAIL"
|
| 255 |
+
else:
|
| 256 |
+
return "❌ FAIL - Client initialization failed"
|
| 257 |
+
|
| 258 |
+
def run_all_tests():
|
| 259 |
+
"""Run all test cases and display results"""
|
| 260 |
+
print("🚀 Running Meeting Notes Automation Test Suite")
|
| 261 |
+
print("=" * 60)
|
| 262 |
+
|
| 263 |
+
test_results = {
|
| 264 |
+
"TC_01": test_case_01(),
|
| 265 |
+
"TC_02": test_case_02(),
|
| 266 |
+
"TC_03": test_case_03(),
|
| 267 |
+
"TC_04": test_case_04(),
|
| 268 |
+
"TC_05": test_case_05(),
|
| 269 |
+
"TC_06": test_case_06(),
|
| 270 |
+
"TC_07": test_case_07(),
|
| 271 |
+
"TC_08": test_case_08(),
|
| 272 |
+
"TC_09": test_case_09(),
|
| 273 |
+
"TC_10": test_case_10()
|
| 274 |
+
}
|
| 275 |
+
|
| 276 |
+
print("\n" + "=" * 60)
|
| 277 |
+
print("📊 TEST RESULTS SUMMARY")
|
| 278 |
+
print("=" * 60)
|
| 279 |
+
|
| 280 |
+
passed = 0
|
| 281 |
+
total = len(test_results)
|
| 282 |
+
|
| 283 |
+
for test_id, result in test_results.items():
|
| 284 |
+
print(f"{test_id}: {result}")
|
| 285 |
+
if "PASS" in result:
|
| 286 |
+
passed += 1
|
| 287 |
+
|
| 288 |
+
print(f"\n🎯 Overall Result: {passed}/{total} tests passed")
|
| 289 |
+
|
| 290 |
+
if passed == total:
|
| 291 |
+
print("🎉 All tests passed!")
|
| 292 |
+
else:
|
| 293 |
+
print("⚠️ Some tests failed. Please check the implementation.")
|
| 294 |
+
|
| 295 |
+
if __name__ == "__main__":
|
| 296 |
+
run_all_tests()
|