|
|
4 mēneši atpakaļ | |
|---|---|---|
| .. | ||
| server | 4 mēneši atpakaļ | |
| README.md | 4 mēneši atpakaļ | |
| content.js | 4 mēneši atpakaļ | |
| icon.svg | 4 mēneši atpakaļ | |
| icon128.png | 4 mēneši atpakaļ | |
| icon16.png | 4 mēneši atpakaļ | |
| icon48.png | 4 mēneši atpakaļ | |
| manifest.json | 4 mēneši atpakaļ | |
| popup.html | 4 mēneši atpakaļ | |
| popup.js | 4 mēneši atpakaļ | |
| styles.css | 4 mēneši atpakaļ | |
# 进入服务目录
cd medical-voice-extension/server
# 创建虚拟环境
python -m venv venv
source venv/bin/activate # Linux/Mac
# venv\Scripts\activate # Windows
# 安装依赖
pip install -r requirements.txt
requirements.txt:
flask==2.3.0
flask-cors==4.0.0
torch==2.0.1
transformers==4.30.0
faster-whisper==0.9.0
# 启动ASR服务(终端1)
python asr_server.py
# 启动NLP服务(终端2)
python nlp_server.py
chrome://extensions/ 或 edge://extensions/medical-voice-extension 文件夹about:debuggingmanifest.jsonmedical-voice-extension/
├── manifest.json # 扩展配置文件
├── content.js # 核心逻辑(注入HIS页面)
├── background.js # 后台脚本(可选)
├── styles.css # 按钮样式
├── popup.html # 扩展弹窗(可选)
├── server/
│ ├── asr_server.py # 语音识别服务
│ ├── nlp_server.py # 医疗NLP服务
│ └── requirements.txt # Python依赖
└── README.md # 本文件
编辑 content.js:
const CONFIG = {
ASR_URL: 'http://localhost:5000/transcribe', // ASR服务地址
NLP_URL: 'http://localhost:5001/extract', // NLP服务地址
};
编辑 content.js 中的 findInput 函数:
const idMap = {
'主诉': ['chief_complaint', 'custom_cc_field'], // 添加你的字段ID
'诊断': ['diagnosis', 'custom_diag_field'],
// ...
};
浏览器:
[医疗语音助手]开头服务端:
# 查看ASR服务日志
# 直接在终端查看输出
# 查看NLP服务日志
# 直接在终端查看输出
1. 点击按钮没反应
2. 识别失败
curl http://localhost:5000/health3. 无法填写表单
findInput函数添加字段映射4. Firefox不支持语音识别
# nlp_server.py
@app.before_request
def auth():
token = request.headers.get('X-Auth-Token')
if token != 'your-secret-token':
return jsonify({'error': 'Unauthorized'}), 401
// content.js
fetch(CONFIG.NLP_URL, {
headers: {
'X-Auth-Token': 'your-secret-token'
}
});
../医生端语音填表技术方案.md