
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Discover the scope of your conversations
A powerful Python library for analyzing and categorizing ChatGPT conversation exports using OpenAI's API. This tool helps you understand your ChatGPT usage patterns by automatically categorizing your conversations into topics like Programming, AI, Psychology, Philosophy, and more.
pip install chatscope
pip install chatscope[plotting]
git clone https://github.com/22wojciech/chatscope.git
cd chatscope
pip install -e .[dev]
conversations.json
Create a .env
file in your project directory:
OPENAI_API_KEY=your_openai_api_key_here
Or set it as an environment variable:
export OPENAI_API_KEY="your_openai_api_key_here"
from chatscope import ChatGPTAnalyzer
# Initialize analyzer
analyzer = ChatGPTAnalyzer()
# Run analysis
results = analyzer.analyze('conversations.json')
# Print results
print(f"Total conversations: {results['total_conversations']}")
for category, count in results['counts'].items():
if count > 0:
print(f"{category}: {count}")
# Basic usage
chatscope conversations.json
# Custom output paths
chatscope conversations.json -o my_chart.png -r my_results.json
# Don't show the plot
chatscope conversations.json --no-show
from chatscope import ChatGPTAnalyzer
custom_categories = [
"Work",
"Personal",
"Learning",
"Creative",
"Technical",
"Other"
]
analyzer = ChatGPTAnalyzer(categories=custom_categories)
results = analyzer.analyze('conversations.json')
analyzer = ChatGPTAnalyzer(
batch_size=10, # Process 10 titles per request
delay_between_requests=2.0, # Wait 2 seconds between requests
max_tokens_per_request=3000 # Limit tokens per request
)
analyzer = ChatGPTAnalyzer()
results = analyzer.analyze(
'conversations.json',
output_chart='custom_chart.png',
show_plot=False # Don't display, just save
)
The package includes a comprehensive CLI:
chatscope --help
# Basic analysis
chatscope conversations.json
# Custom API key and batch size
chatscope --api-key sk-... --batch-size 15 conversations.json
# Custom categories
chatscope --categories "Work" "Personal" "Learning" conversations.json
# Verbose output
chatscope -v conversations.json
# Quiet mode (only errors)
chatscope -q conversations.json
# Custom figure size
chatscope --figsize 16 10 conversations.json
Your conversations.json
should follow this structure:
[
{
"title": "Python Data Analysis Tutorial",
"create_time": 1699123456.789,
"update_time": 1699123456.789
},
{
"title": "Machine Learning Basics",
"create_time": 1699123456.789,
"update_time": 1699123456.789
}
]
The analyzer uses these categories by default:
The analyzer generates several output files:
conversation_categories.png
)A bar chart showing the distribution of conversations across categories.
categorization_results.json
){
"timestamp": "2024-01-15T10:30:00",
"total_conversations": 150,
"categories": {
"Programming": ["Python Tutorial", "Debug Help"],
"AI": ["ChatGPT Tips", "ML Basics"]
},
"counts": {
"Programming": 45,
"AI": 32,
"Other": 73
}
}
The library includes comprehensive error handling:
from chatscope import ChatGPTAnalyzer
from chatscope.exceptions import ChatGPTAnalyzerError
try:
analyzer = ChatGPTAnalyzer()
results = analyzer.analyze('conversations.json')
except APIError as e:
print(f"OpenAI API error: {e}")
except DataError as e:
print(f"Data processing error: {e}")
except Exception as e:
print(f"Unexpected error: {e}")
openai>=0.28.0
python-dotenv>=0.19.0
requests>=2.25.0
matplotlib>=3.5.0
(for plotting)The tool uses OpenAI's GPT-4 API. Costs depend on:
Typical costs:
Contributions are welcome! Please feel free to submit a Pull Request.
git clone https://github.com/22wojciech/chatscope.git
cd chatscope
pip install -e .[dev]
pytest
black chatscope/
flake8 chatscope/
This project is licensed under the Custom Non-Commercial License (CNCL) v1.0 - see the LICENSE file for details.
⚠️ Important: This software is free for personal, academic, and research use only. Commercial use requires a separate license. Contact plus4822@icloud.com for commercial licensing.
If you encounter any issues or have questions:
Made with ❤️ for the ChatGPT community
FAQs
Analyze and categorize ChatGPT conversation exports using OpenAI API
We found that chatscope demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.