poc/project/llmclipboard/README.md
2024-12-13 15:29:23 +08:00

69 lines
1.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 说明
Prompt
我的目标是写一个Python程序可以通过选择任何windows应用的一段富文本点击鼠标右键后弹出一个选项点击这个选项可以把富文本保存在配置路径的.markdown文件里这个markdown会保持选中富文本的图文等相对样式不变可以正常显示。请给出完整的实现步骤和代码应用.
# 应用步骤
1、激活venv的python环境.venv\Scripts\activate
2、配置config.ini文件配置保存路径
3、启动程序python main.py
4、选择需要保存的富文本右键双击
# 本地可执行文件打包
# 创建虚拟环境
python -m venv .venv
# 激活虚拟环境
# 对于 Windows:
source .venv/Scripts/activate
# 对于 Unix 或 MacOS:
source .venv/bin/activate
1. 项目目录结构:
llmclipboard/
├── llmclipboard/
│ ├── __init__.py
│ ├── app.py
├── config.ini
├── README.md
├── pyproject.toml
2. pyproject.toml 文件:
[project]
name = "llmclipboard"
version = "0.1.0"
description = "A text capture tool for saving formatted text from clipboard to markdown files."
readme = "README.md"
requires-python = ">=3.10"
dependencies = [
"pynput",
"pywin32",
"html2text",
"keyboard",
"configparser"
]
[project.scripts]
llmclipboard = "llmclipboard.app:main"
3. app.py 文件(确保有 main 函数)
4. 安装项目:
# 在编辑模式下安装项目
uv pip install -e .
5. 测试入口点:
llmclipboard
# 分发构建
1. 构建分发包
uv pip install build
python -m build
这将在项目根目录下生成一个 dist 目录,里面包含 .tar.gz 和 .whl 文件,这些就是你的分发包。
2. 其他python环境安装
pip install dist\llmclipboard-0.1.0.tar.gz
pip install dist\llmclipboard-0.1.0-py3-none-any.whl
3. 程序启动
llmclipboard