aichat2md 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 PlaceNameDay
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,288 @@
1
+ Metadata-Version: 2.4
2
+ Name: aichat2md
3
+ Version: 1.0.0
4
+ Summary: Convert AI chat conversations to structured Markdown
5
+ Author: PlaceNameDay
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/yourusername/aichat2md
8
+ Project-URL: Repository, https://github.com/yourusername/aichat2md
9
+ Project-URL: Issues, https://github.com/yourusername/aichat2md/issues
10
+ Keywords: chatgpt,claude,markdown,ai,converter,deepseek
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.8
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Topic :: Software Development :: Documentation
21
+ Classifier: Topic :: Text Processing :: Markup :: Markdown
22
+ Requires-Python: >=3.8
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ Requires-Dist: playwright>=1.40.0
26
+ Requires-Dist: requests>=2.31.0
27
+ Dynamic: license-file
28
+
29
+ # aichat2md
30
+
31
+ Convert AI chat conversations to structured Markdown documents.
32
+
33
+ ## Features
34
+
35
+ - 🌐 **Extract from URLs** - ChatGPT share links (with JS rendering via Playwright)
36
+ - πŸ“„ **Extract from webarchive** - Safari .webarchive files (offline mode)
37
+ - πŸ€– **Multiple AI backends** - DeepSeek, OpenAI, Groq, or any OpenAI-compatible API
38
+ - 🌍 **Bilingual support** - English/Chinese prompts
39
+ - πŸ“ **Clean output** - Knowledge-focused Markdown, not chat logs
40
+ - ⚑ **Simple CLI** - pip-installable, one-time setup
41
+
42
+ ## Quick Start
43
+
44
+ ```bash
45
+ # Install
46
+ pip install aichat2md
47
+
48
+ # Configure (one-time setup)
49
+ aichat2md --setup
50
+
51
+ # Convert a ChatGPT share URL
52
+ aichat2md https://chatgpt.com/share/xxx
53
+
54
+ # Convert a webarchive file
55
+ aichat2md ~/Downloads/chat.webarchive
56
+ ```
57
+
58
+ ## Supported AI Backends
59
+
60
+ - **DeepSeek** (default) - Cost-effective, Chinese service
61
+ - **OpenAI** - GPT-4o-mini, GPT-4
62
+ - **Groq** - Fast inference with Llama models
63
+ - **Custom** - Any OpenAI-compatible API
64
+
65
+ ## Installation
66
+
67
+ ### Prerequisites
68
+
69
+ - Python 3.8 or higher
70
+ - Playwright (automatically installed, but requires browser setup)
71
+
72
+ ### Install from PyPI
73
+
74
+ ```bash
75
+ pip install aichat2md
76
+ ```
77
+
78
+ ### Install Playwright browsers
79
+
80
+ ```bash
81
+ playwright install chromium
82
+ ```
83
+
84
+ ### First-time Setup
85
+
86
+ ```bash
87
+ aichat2md --setup
88
+ ```
89
+
90
+ You'll be prompted to:
91
+ 1. Select your AI provider (DeepSeek, OpenAI, Groq, or custom)
92
+ 2. Enter your API key
93
+ 3. Choose prompt language (English or Chinese)
94
+ 4. Set output directory (default: ~/Downloads)
95
+
96
+ ## Usage
97
+
98
+ ### Basic Usage
99
+
100
+ ```bash
101
+ # Convert from URL (uses configured output directory)
102
+ aichat2md https://chatgpt.com/share/xxx
103
+
104
+ # Convert from webarchive (outputs to same directory as input)
105
+ aichat2md ~/Downloads/chat.webarchive
106
+ ```
107
+
108
+ ### Override Language
109
+
110
+ ```bash
111
+ # Use Chinese prompts (even if English is configured)
112
+ aichat2md <url> --lang zh
113
+
114
+ # Use English prompts
115
+ aichat2md <url> --lang en
116
+ ```
117
+
118
+ ### Custom Output Path
119
+
120
+ ```bash
121
+ # Specify output file
122
+ aichat2md <url> -o ~/Documents/my-notes.md
123
+ aichat2md <url> --output ~/Documents/my-notes.md
124
+ ```
125
+
126
+ ### Override Model
127
+
128
+ ```bash
129
+ # Use a different model than configured
130
+ aichat2md <url> --model gpt-4o
131
+ aichat2md <url> --model deepseek-chat
132
+ ```
133
+
134
+ ### Version Info
135
+
136
+ ```bash
137
+ aichat2md --version
138
+ ```
139
+
140
+ ## Configuration
141
+
142
+ Configuration is stored in `~/.config/aichat2md/config.json` (cross-platform).
143
+
144
+ ### Example Config
145
+
146
+ ```json
147
+ {
148
+ "api_key": "sk-your-api-key",
149
+ "api_base_url": "https://api.deepseek.com",
150
+ "model": "deepseek-chat",
151
+ "language": "en",
152
+ "output_dir": "/Users/you/Downloads",
153
+ "max_tokens": 4000,
154
+ "temperature": 0.7
155
+ }
156
+ ```
157
+
158
+ ### Reconfigure
159
+
160
+ ```bash
161
+ aichat2md --setup
162
+ ```
163
+
164
+ ## Output Format
165
+
166
+ The tool converts chat conversations into structured Markdown with:
167
+
168
+ - **Front matter** - Tags, date, source
169
+ - **Summary** - 2-3 sentence overview
170
+ - **Key topics** - Bullet point list
171
+ - **Knowledge sections** - Reorganized content with logical headings
172
+ - **Code examples** - Extracted code blocks with comments
173
+
174
+ ### Example Output
175
+
176
+ ```markdown
177
+ ---
178
+ tags: [Python, API, Web]
179
+ date: 2026-02-02
180
+ source: https://chatgpt.com/share/xxx
181
+ ---
182
+
183
+ # Building REST APIs with FastAPI
184
+
185
+ ## Summary
186
+ This document covers building production-ready REST APIs using FastAPI...
187
+
188
+ ## Key Topics
189
+ - API design patterns
190
+ - Request validation
191
+ - Error handling
192
+
193
+ ## API Design Principles
194
+ ...
195
+
196
+ ## Code Examples
197
+ \```python
198
+ from fastapi import FastAPI
199
+ app = FastAPI()
200
+ ...
201
+ \```
202
+ ```
203
+
204
+ ## How It Works
205
+
206
+ 1. **Extract** - Playwright (URLs) or plistlib (webarchive) extracts raw text
207
+ 2. **Structurize** - AI API reorganizes into knowledge document
208
+ 3. **Save** - Auto-generated filename or specified path
209
+
210
+ ### Why Two-Stage Processing?
211
+
212
+ - **Stage 1 (Extract)** - No AI tokens used, just HTML parsing
213
+ - **Stage 2 (Structurize)** - AI organizes content efficiently
214
+
215
+ This saves costs and allows local caching of extracted content.
216
+
217
+ ## Development
218
+
219
+ ### Local Installation
220
+
221
+ ```bash
222
+ # Clone repository
223
+ git clone https://github.com/yourusername/aichat2md.git
224
+ cd aichat2md
225
+
226
+ # Install in editable mode
227
+ pip install -e .
228
+
229
+ # Install Playwright
230
+ playwright install chromium
231
+ ```
232
+
233
+ ### Run Tests
234
+
235
+ ```bash
236
+ pip install pytest
237
+ pytest tests/
238
+ ```
239
+
240
+ ### Build Package
241
+
242
+ ```bash
243
+ pip install build
244
+ python -m build
245
+ ```
246
+
247
+ ## Troubleshooting
248
+
249
+ ### "Configuration file not found"
250
+
251
+ Run `aichat2md --setup` to create configuration.
252
+
253
+ ### "API authentication failed"
254
+
255
+ Check your API key in `~/.config/aichat2md/config.json`.
256
+
257
+ ### Playwright errors
258
+
259
+ Install browsers: `playwright install chromium`
260
+
261
+ ### Empty output
262
+
263
+ The conversation might be too short or the AI response failed. Check error messages.
264
+
265
+ ## Contributing
266
+
267
+ Contributions welcome! Please:
268
+
269
+ 1. Fork the repository
270
+ 2. Create a feature branch
271
+ 3. Add tests for new features
272
+ 4. Submit a pull request
273
+
274
+ ## License
275
+
276
+ MIT License - see [LICENSE](LICENSE) file.
277
+
278
+ ## Links
279
+
280
+ - [GitHub Repository](https://github.com/yourusername/aichat2md)
281
+ - [Issue Tracker](https://github.com/yourusername/aichat2md/issues)
282
+ - [δΈ­ζ–‡ζ–‡ζ‘£](README_zh.md)
283
+
284
+ ## Acknowledgments
285
+
286
+ - [Playwright](https://playwright.dev/) - Web automation
287
+ - [DeepSeek](https://www.deepseek.com/) - Cost-effective AI API
288
+ - [OpenAI](https://openai.com/) - API compatibility standard
@@ -0,0 +1,260 @@
1
+ # aichat2md
2
+
3
+ Convert AI chat conversations to structured Markdown documents.
4
+
5
+ ## Features
6
+
7
+ - 🌐 **Extract from URLs** - ChatGPT share links (with JS rendering via Playwright)
8
+ - πŸ“„ **Extract from webarchive** - Safari .webarchive files (offline mode)
9
+ - πŸ€– **Multiple AI backends** - DeepSeek, OpenAI, Groq, or any OpenAI-compatible API
10
+ - 🌍 **Bilingual support** - English/Chinese prompts
11
+ - πŸ“ **Clean output** - Knowledge-focused Markdown, not chat logs
12
+ - ⚑ **Simple CLI** - pip-installable, one-time setup
13
+
14
+ ## Quick Start
15
+
16
+ ```bash
17
+ # Install
18
+ pip install aichat2md
19
+
20
+ # Configure (one-time setup)
21
+ aichat2md --setup
22
+
23
+ # Convert a ChatGPT share URL
24
+ aichat2md https://chatgpt.com/share/xxx
25
+
26
+ # Convert a webarchive file
27
+ aichat2md ~/Downloads/chat.webarchive
28
+ ```
29
+
30
+ ## Supported AI Backends
31
+
32
+ - **DeepSeek** (default) - Cost-effective, Chinese service
33
+ - **OpenAI** - GPT-4o-mini, GPT-4
34
+ - **Groq** - Fast inference with Llama models
35
+ - **Custom** - Any OpenAI-compatible API
36
+
37
+ ## Installation
38
+
39
+ ### Prerequisites
40
+
41
+ - Python 3.8 or higher
42
+ - Playwright (automatically installed, but requires browser setup)
43
+
44
+ ### Install from PyPI
45
+
46
+ ```bash
47
+ pip install aichat2md
48
+ ```
49
+
50
+ ### Install Playwright browsers
51
+
52
+ ```bash
53
+ playwright install chromium
54
+ ```
55
+
56
+ ### First-time Setup
57
+
58
+ ```bash
59
+ aichat2md --setup
60
+ ```
61
+
62
+ You'll be prompted to:
63
+ 1. Select your AI provider (DeepSeek, OpenAI, Groq, or custom)
64
+ 2. Enter your API key
65
+ 3. Choose prompt language (English or Chinese)
66
+ 4. Set output directory (default: ~/Downloads)
67
+
68
+ ## Usage
69
+
70
+ ### Basic Usage
71
+
72
+ ```bash
73
+ # Convert from URL (uses configured output directory)
74
+ aichat2md https://chatgpt.com/share/xxx
75
+
76
+ # Convert from webarchive (outputs to same directory as input)
77
+ aichat2md ~/Downloads/chat.webarchive
78
+ ```
79
+
80
+ ### Override Language
81
+
82
+ ```bash
83
+ # Use Chinese prompts (even if English is configured)
84
+ aichat2md <url> --lang zh
85
+
86
+ # Use English prompts
87
+ aichat2md <url> --lang en
88
+ ```
89
+
90
+ ### Custom Output Path
91
+
92
+ ```bash
93
+ # Specify output file
94
+ aichat2md <url> -o ~/Documents/my-notes.md
95
+ aichat2md <url> --output ~/Documents/my-notes.md
96
+ ```
97
+
98
+ ### Override Model
99
+
100
+ ```bash
101
+ # Use a different model than configured
102
+ aichat2md <url> --model gpt-4o
103
+ aichat2md <url> --model deepseek-chat
104
+ ```
105
+
106
+ ### Version Info
107
+
108
+ ```bash
109
+ aichat2md --version
110
+ ```
111
+
112
+ ## Configuration
113
+
114
+ Configuration is stored in `~/.config/aichat2md/config.json` (cross-platform).
115
+
116
+ ### Example Config
117
+
118
+ ```json
119
+ {
120
+ "api_key": "sk-your-api-key",
121
+ "api_base_url": "https://api.deepseek.com",
122
+ "model": "deepseek-chat",
123
+ "language": "en",
124
+ "output_dir": "/Users/you/Downloads",
125
+ "max_tokens": 4000,
126
+ "temperature": 0.7
127
+ }
128
+ ```
129
+
130
+ ### Reconfigure
131
+
132
+ ```bash
133
+ aichat2md --setup
134
+ ```
135
+
136
+ ## Output Format
137
+
138
+ The tool converts chat conversations into structured Markdown with:
139
+
140
+ - **Front matter** - Tags, date, source
141
+ - **Summary** - 2-3 sentence overview
142
+ - **Key topics** - Bullet point list
143
+ - **Knowledge sections** - Reorganized content with logical headings
144
+ - **Code examples** - Extracted code blocks with comments
145
+
146
+ ### Example Output
147
+
148
+ ```markdown
149
+ ---
150
+ tags: [Python, API, Web]
151
+ date: 2026-02-02
152
+ source: https://chatgpt.com/share/xxx
153
+ ---
154
+
155
+ # Building REST APIs with FastAPI
156
+
157
+ ## Summary
158
+ This document covers building production-ready REST APIs using FastAPI...
159
+
160
+ ## Key Topics
161
+ - API design patterns
162
+ - Request validation
163
+ - Error handling
164
+
165
+ ## API Design Principles
166
+ ...
167
+
168
+ ## Code Examples
169
+ \```python
170
+ from fastapi import FastAPI
171
+ app = FastAPI()
172
+ ...
173
+ \```
174
+ ```
175
+
176
+ ## How It Works
177
+
178
+ 1. **Extract** - Playwright (URLs) or plistlib (webarchive) extracts raw text
179
+ 2. **Structurize** - AI API reorganizes into knowledge document
180
+ 3. **Save** - Auto-generated filename or specified path
181
+
182
+ ### Why Two-Stage Processing?
183
+
184
+ - **Stage 1 (Extract)** - No AI tokens used, just HTML parsing
185
+ - **Stage 2 (Structurize)** - AI organizes content efficiently
186
+
187
+ This saves costs and allows local caching of extracted content.
188
+
189
+ ## Development
190
+
191
+ ### Local Installation
192
+
193
+ ```bash
194
+ # Clone repository
195
+ git clone https://github.com/yourusername/aichat2md.git
196
+ cd aichat2md
197
+
198
+ # Install in editable mode
199
+ pip install -e .
200
+
201
+ # Install Playwright
202
+ playwright install chromium
203
+ ```
204
+
205
+ ### Run Tests
206
+
207
+ ```bash
208
+ pip install pytest
209
+ pytest tests/
210
+ ```
211
+
212
+ ### Build Package
213
+
214
+ ```bash
215
+ pip install build
216
+ python -m build
217
+ ```
218
+
219
+ ## Troubleshooting
220
+
221
+ ### "Configuration file not found"
222
+
223
+ Run `aichat2md --setup` to create configuration.
224
+
225
+ ### "API authentication failed"
226
+
227
+ Check your API key in `~/.config/aichat2md/config.json`.
228
+
229
+ ### Playwright errors
230
+
231
+ Install browsers: `playwright install chromium`
232
+
233
+ ### Empty output
234
+
235
+ The conversation might be too short or the AI response failed. Check error messages.
236
+
237
+ ## Contributing
238
+
239
+ Contributions welcome! Please:
240
+
241
+ 1. Fork the repository
242
+ 2. Create a feature branch
243
+ 3. Add tests for new features
244
+ 4. Submit a pull request
245
+
246
+ ## License
247
+
248
+ MIT License - see [LICENSE](LICENSE) file.
249
+
250
+ ## Links
251
+
252
+ - [GitHub Repository](https://github.com/yourusername/aichat2md)
253
+ - [Issue Tracker](https://github.com/yourusername/aichat2md/issues)
254
+ - [δΈ­ζ–‡ζ–‡ζ‘£](README_zh.md)
255
+
256
+ ## Acknowledgments
257
+
258
+ - [Playwright](https://playwright.dev/) - Web automation
259
+ - [DeepSeek](https://www.deepseek.com/) - Cost-effective AI API
260
+ - [OpenAI](https://openai.com/) - API compatibility standard
@@ -0,0 +1,5 @@
1
+ """aichat2md - Convert AI chat conversations to structured Markdown."""
2
+
3
+ __version__ = "1.0.0"
4
+ __author__ = "PlaceNameDay"
5
+ __description__ = "Convert AI chat conversations to structured Markdown"