工业 AI 交互画布 · 操作流程与技术链路
+选择视角,分别查看"用户界面交互路径"或"背后技术判断逻辑"。语音输入经过四阶段前置拦截后再进入 BERT NLU。
+From a29a91867d287ff9bcb705a48d8c81116894a9db Mon Sep 17 00:00:00 2001 From: Zou-Seay <81679448+Zou-Seay@users.noreply.github.com> Date: Thu, 11 Jun 2026 16:28:00 +0800 Subject: [PATCH] Update project and configurations --- .gitignore | 11 + ai_assistant_features.md | 55 + archive/test-ai.js | 2 + archive/test-ai.mjs | 9 + docs/DBUS_API.md | 473 + docs/architecture_overview.html | 642 + docs/bert_integration_analysis.md | 371 + docs/industrial_ai_interaction_plan.md | 1332 + docs/nlu_integration_design.md | 310 + docs/归档(包含调机流程).html | 469 + intelligent_cabin/.vscode/launch.json | 44 + intelligent_cabin/README.md | 161 + intelligent_cabin/app/__init__.py | 1 + .../app/__pycache__/__init__.cpython-311.pyc | Bin 0 -> 251 bytes .../app/__pycache__/__init__.cpython-312.pyc | Bin 0 -> 242 bytes .../app/__pycache__/__init__.cpython-313.pyc | Bin 0 -> 240 bytes .../app/__pycache__/main.cpython-311.pyc | Bin 0 -> 7932 bytes .../app/__pycache__/main.cpython-312.pyc | Bin 0 -> 7244 bytes .../app/__pycache__/main.cpython-313.pyc | Bin 0 -> 6862 bytes intelligent_cabin/app/core/__init__.py | 1 + .../core/__pycache__/__init__.cpython-311.pyc | Bin 0 -> 223 bytes .../core/__pycache__/__init__.cpython-312.pyc | Bin 0 -> 214 bytes .../core/__pycache__/__init__.cpython-313.pyc | Bin 0 -> 212 bytes .../__pycache__/bootstrap.cpython-311.pyc | Bin 0 -> 13919 bytes .../__pycache__/bootstrap.cpython-312.pyc | Bin 0 -> 14082 bytes .../__pycache__/bootstrap.cpython-313.pyc | Bin 0 -> 13458 bytes .../core/__pycache__/config.cpython-311.pyc | Bin 0 -> 4055 bytes .../core/__pycache__/config.cpython-312.pyc | Bin 0 -> 3808 bytes .../core/__pycache__/config.cpython-313.pyc | Bin 0 -> 3704 bytes intelligent_cabin/app/core/bootstrap.py | 323 + intelligent_cabin/app/core/config.py | 61 + .../data/bert_intent_eval_independent.jsonl | 42 + ...t_intent_multilabel_eval_independent.jsonl | 37 + .../data/bert_intent_multilabel_train.jsonl | 72 + .../app/data/bert_intent_test.jsonl | 35 + .../app/data/bert_intent_train.jsonl | 118 + intelligent_cabin/app/data/intents.json | 352 + .../app/data/joint_nlu_eval.jsonl | 10 + .../app/data/joint_nlu_eval_independent.jsonl | 43 + .../app/data/joint_nlu_multilabel_eval.jsonl | 12 + .../app/data/joint_nlu_seed.jsonl | 27 + intelligent_cabin/app/main.py | 151 + intelligent_cabin/app/plugins/__init__.py | 1 + .../__pycache__/__init__.cpython-311.pyc | Bin 0 -> 237 bytes .../__pycache__/__init__.cpython-312.pyc | Bin 0 -> 228 bytes .../__pycache__/__init__.cpython-313.pyc | Bin 0 -> 226 bytes .../plugins/__pycache__/base.cpython-311.pyc | Bin 0 -> 1938 bytes .../plugins/__pycache__/base.cpython-312.pyc | Bin 0 -> 1673 bytes .../plugins/__pycache__/base.cpython-313.pyc | Bin 0 -> 1731 bytes .../plugins/__pycache__/mock.cpython-311.pyc | Bin 0 -> 15003 bytes .../plugins/__pycache__/mock.cpython-312.pyc | Bin 0 -> 13759 bytes .../plugins/__pycache__/mock.cpython-313.pyc | Bin 0 -> 13909 bytes intelligent_cabin/app/plugins/base.py | 27 + intelligent_cabin/app/plugins/mock.py | 216 + intelligent_cabin/app/schemas/__init__.py | 1 + .../__pycache__/__init__.cpython-311.pyc | Bin 0 -> 238 bytes .../__pycache__/__init__.cpython-312.pyc | Bin 0 -> 229 bytes .../__pycache__/__init__.cpython-313.pyc | Bin 0 -> 227 bytes .../schemas/__pycache__/chat.cpython-311.pyc | Bin 0 -> 2658 bytes .../schemas/__pycache__/chat.cpython-312.pyc | Bin 0 -> 2398 bytes .../schemas/__pycache__/chat.cpython-313.pyc | Bin 0 -> 2301 bytes .../__pycache__/configuration.cpython-311.pyc | Bin 0 -> 8184 bytes .../__pycache__/configuration.cpython-312.pyc | Bin 0 -> 7793 bytes .../__pycache__/configuration.cpython-313.pyc | Bin 0 -> 7028 bytes .../schemas/__pycache__/debug.cpython-311.pyc | Bin 0 -> 2792 bytes .../schemas/__pycache__/debug.cpython-312.pyc | Bin 0 -> 2297 bytes .../schemas/__pycache__/debug.cpython-313.pyc | Bin 0 -> 2379 bytes .../schemas/__pycache__/demo.cpython-311.pyc | Bin 0 -> 1390 bytes .../schemas/__pycache__/demo.cpython-312.pyc | Bin 0 -> 1153 bytes .../schemas/__pycache__/demo.cpython-313.pyc | Bin 0 -> 1231 bytes .../__pycache__/intent.cpython-311.pyc | Bin 0 -> 1205 bytes .../__pycache__/intent.cpython-312.pyc | Bin 0 -> 988 bytes .../__pycache__/intent.cpython-313.pyc | Bin 0 -> 1020 bytes .../__pycache__/workflow.cpython-311.pyc | Bin 0 -> 2732 bytes .../__pycache__/workflow.cpython-312.pyc | Bin 0 -> 2269 bytes .../__pycache__/workflow.cpython-313.pyc | Bin 0 -> 2339 bytes intelligent_cabin/app/schemas/chat.py | 46 + .../app/schemas/configuration.py | 135 + intelligent_cabin/app/schemas/debug.py | 42 + intelligent_cabin/app/schemas/demo.py | 20 + intelligent_cabin/app/schemas/intent.py | 16 + intelligent_cabin/app/schemas/workflow.py | 38 + intelligent_cabin/app/services/__init__.py | 1 + .../__pycache__/__init__.cpython-311.pyc | Bin 0 -> 262 bytes .../__pycache__/__init__.cpython-312.pyc | Bin 0 -> 253 bytes .../__pycache__/__init__.cpython-313.pyc | Bin 0 -> 251 bytes .../__pycache__/agent_service.cpython-311.pyc | Bin 0 -> 66814 bytes .../__pycache__/agent_service.cpython-312.pyc | Bin 0 -> 66986 bytes .../__pycache__/agent_service.cpython-313.pyc | Bin 0 -> 63599 bytes .../__pycache__/classifier.cpython-311.pyc | Bin 0 -> 28453 bytes .../__pycache__/classifier.cpython-312.pyc | Bin 0 -> 24420 bytes .../__pycache__/classifier.cpython-313.pyc | Bin 0 -> 25034 bytes .../__pycache__/config_loader.cpython-311.pyc | Bin 0 -> 10615 bytes .../__pycache__/config_loader.cpython-312.pyc | Bin 0 -> 10705 bytes .../__pycache__/config_loader.cpython-313.pyc | Bin 0 -> 9911 bytes .../__pycache__/dialog_act.cpython-311.pyc | Bin 0 -> 2343 bytes .../__pycache__/dialog_act.cpython-312.pyc | Bin 0 -> 2815 bytes .../__pycache__/dialog_act.cpython-313.pyc | Bin 0 -> 2180 bytes .../__pycache__/dialog_rules.cpython-311.pyc | Bin 0 -> 3558 bytes .../__pycache__/dialog_rules.cpython-312.pyc | Bin 0 -> 3155 bytes .../__pycache__/dialog_rules.cpython-313.pyc | Bin 0 -> 3233 bytes .../intent_registry.cpython-311.pyc | Bin 0 -> 3007 bytes .../intent_registry.cpython-312.pyc | Bin 0 -> 2418 bytes .../intent_registry.cpython-313.pyc | Bin 0 -> 2512 bytes .../__pycache__/joint_nlu.cpython-311.pyc | Bin 0 -> 23829 bytes .../__pycache__/joint_nlu.cpython-312.pyc | Bin 0 -> 22192 bytes .../__pycache__/joint_nlu.cpython-313.pyc | Bin 0 -> 21263 bytes .../__pycache__/knowledge_llm.cpython-312.pyc | Bin 0 -> 10786 bytes .../knowledge_store.cpython-312.pyc | Bin 0 -> 7650 bytes .../multi_intent_detector.cpython-311.pyc | Bin 0 -> 12491 bytes .../multi_intent_detector.cpython-312.pyc | Bin 0 -> 10654 bytes .../multi_intent_detector.cpython-313.pyc | Bin 0 -> 10894 bytes .../__pycache__/planner.cpython-311.pyc | Bin 0 -> 64022 bytes .../__pycache__/planner.cpython-312.pyc | Bin 0 -> 55836 bytes .../__pycache__/planner.cpython-313.pyc | Bin 0 -> 57125 bytes .../response_policy.cpython-311.pyc | Bin 0 -> 19819 bytes .../response_policy.cpython-312.pyc | Bin 0 -> 17523 bytes .../response_policy.cpython-313.pyc | Bin 0 -> 18094 bytes .../rewrite_engine.cpython-311.pyc | Bin 0 -> 6055 bytes .../rewrite_engine.cpython-312.pyc | Bin 0 -> 5979 bytes .../rewrite_engine.cpython-313.pyc | Bin 0 -> 5607 bytes .../__pycache__/router.cpython-311.pyc | Bin 0 -> 20312 bytes .../__pycache__/router.cpython-312.pyc | Bin 0 -> 18031 bytes .../__pycache__/router.cpython-313.pyc | Bin 0 -> 18732 bytes .../__pycache__/session_store.cpython-311.pyc | Bin 0 -> 7539 bytes .../__pycache__/session_store.cpython-312.pyc | Bin 0 -> 6654 bytes .../__pycache__/session_store.cpython-313.pyc | Bin 0 -> 6776 bytes .../__pycache__/social.cpython-311.pyc | Bin 0 -> 13847 bytes .../__pycache__/social.cpython-312.pyc | Bin 0 -> 12102 bytes .../__pycache__/social.cpython-313.pyc | Bin 0 -> 12360 bytes .../app/services/agent_service.py | 1305 + intelligent_cabin/app/services/classifier.py | 600 + .../app/services/config_loader.py | 173 + intelligent_cabin/app/services/dialog_act.py | 51 + .../app/services/dialog_rules.py | 62 + .../app/services/intent_registry.py | 29 + intelligent_cabin/app/services/joint_nlu.py | 430 + .../app/services/knowledge_llm.py | 238 + .../app/services/knowledge_store.py | 152 + .../app/services/multi_intent_detector.py | 219 + intelligent_cabin/app/services/planner.py | 1347 + .../app/services/response_policy.py | 299 + .../app/services/rewrite_engine.py | 108 + intelligent_cabin/app/services/router.py | 407 + .../app/services/session_store.py | 125 + intelligent_cabin/app/services/social.py | 250 + intelligent_cabin/archive/demo/demo.html | 2254 ++ .../archive/docs/current_system_flow.md | 1722 ++ intelligent_cabin/archive/docs/design.md | 2104 ++ .../archive/docs/solution_review.md | 467 + .../patents/202510261979_CN120089140A.pdf | Bin 0 -> 1642936 bytes .../archive/patents/CN114299931B.pdf | Bin 0 -> 1047415 bytes .../archive/patents/CN115394300A.pdf | Bin 0 -> 747898 bytes .../texts/202510261979_CN120089140A.txt | 1195 + .../archive/patents/texts/CN114299931B.txt | 1095 + .../archive/patents/texts/CN115394300A.txt | 1814 ++ .../archive/reports/bert_local_test_report.md | 65 + .../reports/bert_local_test_result.json | 426 + .../bert_multi_intent_independent_report.md | 47 + .../bert_multi_intent_independent_result.json | 2582 ++ .../reports/joint_nlu_independent_report.md | 40 + .../reports/joint_nlu_independent_result.json | 1706 ++ ...val_joint_bert_multi_intent_independent.py | 92 + .../archive/scripts/eval_joint_bert_nlu.py | 59 + .../scripts/eval_joint_nlu_independent.py | 275 + .../archive/scripts/eval_local_bert_intent.py | 231 + .../scripts/eval_local_bert_multi_intent.py | 123 + ...val_local_bert_multi_intent_independent.py | 247 + .../archive/scripts/test_local_bert_intent.py | 97 + .../archive/scripts/train_joint_bert_nlu.py | 500 + .../scripts/train_local_bert_intent.py | 684 + .../scripts/train_local_bert_multi_intent.py | 415 + .../archive/tests/test_agent_cloud_route.py | 132 + intelligent_cabin/archive/tests/test_bert.py | 235 + .../archive/tests/test_chat_stream.py | 109 + .../archive/tests/test_config_loader.py | 90 + ...st_dialog_continuation_and_multi_intent.py | 202 + .../tests/test_intent_coverage_and_stop.py | 149 + .../tests/test_joint_nlu_integration.py | 93 + .../tests/test_multi_intent_detector.py | 144 + .../archive/tests/test_router_decisions.py | 195 + .../archive/tests/test_social_chat.py | 180 + .../archive/tests/test_workflow_templates.py | 184 + intelligent_cabin/config/actions.yml | 38 + intelligent_cabin/config/context_rewrite.yml | 76 + intelligent_cabin/config/dialog_acts.yml | 79 + intelligent_cabin/config/domain.yml | 38 + intelligent_cabin/config/forms.yml | 39 + .../config/knowledge/false_weld_alarm.md | 82 + intelligent_cabin/config/responses.yml | 30 + intelligent_cabin/config/rules.yml | 43 + intelligent_cabin/config/voice_aliases.yml | 95 + intelligent_cabin/config/workflows.yml | 34 + .../models/local_bert_intent/config.json | 108 + .../models/local_bert_intent/label_map.json | 38 + .../local_bert_intent/special_tokens_map.json | 37 + .../models/local_bert_intent/tokenizer.json | 21292 ++++++++++++++++ .../local_bert_intent/tokenizer_config.json | 56 + .../local_bert_intent/train_summary.json | 10 + .../models/local_bert_intent/vocab.txt | 21128 +++++++++++++++ .../local_bert_multi_intent/config.json | 104 + .../local_bert_multi_intent/label_map.json | 36 + .../special_tokens_map.json | 37 + .../local_bert_multi_intent/tokenizer.json | 21292 ++++++++++++++++ .../tokenizer_config.json | 56 + .../train_summary.json | 56 + .../models/local_bert_multi_intent/vocab.txt | 21128 +++++++++++++++ .../joint_nlu_config.json | 57 + .../special_tokens_map.json | 37 + .../local_joint_bert_nlu/tokenizer.json | 21292 ++++++++++++++++ .../tokenizer_config.json | 56 + .../local_joint_bert_nlu/train_summary.json | 17 + .../models/local_joint_bert_nlu/vocab.txt | 21128 +++++++++++++++ intelligent_cabin/pyproject.toml | 24 + intelligent_cabin/requirements.txt | 8 + package-lock.json | 844 +- package.json | 10 +- scripts/generate-voice-aliases.mjs | 98 + src/app/api/chat/route.ts | 138 + src/app/globals.css | 13 +- src/app/layout.tsx | 20 +- src/app/page.tsx | 656 +- src/app/practice/page.tsx | 209 + src/components/artifacts/ArtifactRenderer.tsx | 524 + .../artifacts/DieMaterialAdjust.tsx | 235 + .../artifacts/DieStatusOverview.tsx | 275 + .../artifacts/KnowledgeArtifact.tsx | 220 + src/lib/artifacts/die-mock-data.ts | 63 + src/lib/artifacts/factory.ts | 319 + src/lib/artifacts/mock.ts | 258 + src/lib/artifacts/reducer.ts | 169 + src/lib/artifacts/types.ts | 195 + src/lib/nlu/client.ts | 66 + src/lib/nlu/mock.ts | 205 + src/lib/nlu/pipeline.ts | 189 + src/lib/nlu/types.ts | 168 + src/lib/nlu/voice-aliases.gen.ts | 90 + 237 files changed, 164880 insertions(+), 90 deletions(-) create mode 100644 ai_assistant_features.md create mode 100644 archive/test-ai.js create mode 100644 archive/test-ai.mjs create mode 100644 docs/DBUS_API.md create mode 100644 docs/architecture_overview.html create mode 100644 docs/bert_integration_analysis.md create mode 100644 docs/industrial_ai_interaction_plan.md create mode 100644 docs/nlu_integration_design.md create mode 100644 docs/归档(包含调机流程).html create mode 100644 intelligent_cabin/.vscode/launch.json create mode 100644 intelligent_cabin/README.md create mode 100644 intelligent_cabin/app/__init__.py create mode 100644 intelligent_cabin/app/__pycache__/__init__.cpython-311.pyc create mode 100644 intelligent_cabin/app/__pycache__/__init__.cpython-312.pyc create mode 100644 intelligent_cabin/app/__pycache__/__init__.cpython-313.pyc create mode 100644 intelligent_cabin/app/__pycache__/main.cpython-311.pyc create mode 100644 intelligent_cabin/app/__pycache__/main.cpython-312.pyc create mode 100644 intelligent_cabin/app/__pycache__/main.cpython-313.pyc create mode 100644 intelligent_cabin/app/core/__init__.py create mode 100644 intelligent_cabin/app/core/__pycache__/__init__.cpython-311.pyc create mode 100644 intelligent_cabin/app/core/__pycache__/__init__.cpython-312.pyc create mode 100644 intelligent_cabin/app/core/__pycache__/__init__.cpython-313.pyc create mode 100644 intelligent_cabin/app/core/__pycache__/bootstrap.cpython-311.pyc create mode 100644 intelligent_cabin/app/core/__pycache__/bootstrap.cpython-312.pyc create mode 100644 intelligent_cabin/app/core/__pycache__/bootstrap.cpython-313.pyc create mode 100644 intelligent_cabin/app/core/__pycache__/config.cpython-311.pyc create mode 100644 intelligent_cabin/app/core/__pycache__/config.cpython-312.pyc create mode 100644 intelligent_cabin/app/core/__pycache__/config.cpython-313.pyc create mode 100644 intelligent_cabin/app/core/bootstrap.py create mode 100644 intelligent_cabin/app/core/config.py create mode 100644 intelligent_cabin/app/data/bert_intent_eval_independent.jsonl create mode 100644 intelligent_cabin/app/data/bert_intent_multilabel_eval_independent.jsonl create mode 100644 intelligent_cabin/app/data/bert_intent_multilabel_train.jsonl create mode 100644 intelligent_cabin/app/data/bert_intent_test.jsonl create mode 100644 intelligent_cabin/app/data/bert_intent_train.jsonl create mode 100644 intelligent_cabin/app/data/intents.json create mode 100644 intelligent_cabin/app/data/joint_nlu_eval.jsonl create mode 100644 intelligent_cabin/app/data/joint_nlu_eval_independent.jsonl create mode 100644 intelligent_cabin/app/data/joint_nlu_multilabel_eval.jsonl create mode 100644 intelligent_cabin/app/data/joint_nlu_seed.jsonl create mode 100644 intelligent_cabin/app/main.py create mode 100644 intelligent_cabin/app/plugins/__init__.py create mode 100644 intelligent_cabin/app/plugins/__pycache__/__init__.cpython-311.pyc create mode 100644 intelligent_cabin/app/plugins/__pycache__/__init__.cpython-312.pyc create mode 100644 intelligent_cabin/app/plugins/__pycache__/__init__.cpython-313.pyc create mode 100644 intelligent_cabin/app/plugins/__pycache__/base.cpython-311.pyc create mode 100644 intelligent_cabin/app/plugins/__pycache__/base.cpython-312.pyc create mode 100644 intelligent_cabin/app/plugins/__pycache__/base.cpython-313.pyc create mode 100644 intelligent_cabin/app/plugins/__pycache__/mock.cpython-311.pyc create mode 100644 intelligent_cabin/app/plugins/__pycache__/mock.cpython-312.pyc create mode 100644 intelligent_cabin/app/plugins/__pycache__/mock.cpython-313.pyc create mode 100644 intelligent_cabin/app/plugins/base.py create mode 100644 intelligent_cabin/app/plugins/mock.py create mode 100644 intelligent_cabin/app/schemas/__init__.py create mode 100644 intelligent_cabin/app/schemas/__pycache__/__init__.cpython-311.pyc create mode 100644 intelligent_cabin/app/schemas/__pycache__/__init__.cpython-312.pyc create mode 100644 intelligent_cabin/app/schemas/__pycache__/__init__.cpython-313.pyc create mode 100644 intelligent_cabin/app/schemas/__pycache__/chat.cpython-311.pyc create mode 100644 intelligent_cabin/app/schemas/__pycache__/chat.cpython-312.pyc create mode 100644 intelligent_cabin/app/schemas/__pycache__/chat.cpython-313.pyc create mode 100644 intelligent_cabin/app/schemas/__pycache__/configuration.cpython-311.pyc create mode 100644 intelligent_cabin/app/schemas/__pycache__/configuration.cpython-312.pyc create mode 100644 intelligent_cabin/app/schemas/__pycache__/configuration.cpython-313.pyc create mode 100644 intelligent_cabin/app/schemas/__pycache__/debug.cpython-311.pyc create mode 100644 intelligent_cabin/app/schemas/__pycache__/debug.cpython-312.pyc create mode 100644 intelligent_cabin/app/schemas/__pycache__/debug.cpython-313.pyc create mode 100644 intelligent_cabin/app/schemas/__pycache__/demo.cpython-311.pyc create mode 100644 intelligent_cabin/app/schemas/__pycache__/demo.cpython-312.pyc create mode 100644 intelligent_cabin/app/schemas/__pycache__/demo.cpython-313.pyc create mode 100644 intelligent_cabin/app/schemas/__pycache__/intent.cpython-311.pyc create mode 100644 intelligent_cabin/app/schemas/__pycache__/intent.cpython-312.pyc create mode 100644 intelligent_cabin/app/schemas/__pycache__/intent.cpython-313.pyc create mode 100644 intelligent_cabin/app/schemas/__pycache__/workflow.cpython-311.pyc create mode 100644 intelligent_cabin/app/schemas/__pycache__/workflow.cpython-312.pyc create mode 100644 intelligent_cabin/app/schemas/__pycache__/workflow.cpython-313.pyc create mode 100644 intelligent_cabin/app/schemas/chat.py create mode 100644 intelligent_cabin/app/schemas/configuration.py create mode 100644 intelligent_cabin/app/schemas/debug.py create mode 100644 intelligent_cabin/app/schemas/demo.py create mode 100644 intelligent_cabin/app/schemas/intent.py create mode 100644 intelligent_cabin/app/schemas/workflow.py create mode 100644 intelligent_cabin/app/services/__init__.py create mode 100644 intelligent_cabin/app/services/__pycache__/__init__.cpython-311.pyc create mode 100644 intelligent_cabin/app/services/__pycache__/__init__.cpython-312.pyc create mode 100644 intelligent_cabin/app/services/__pycache__/__init__.cpython-313.pyc create mode 100644 intelligent_cabin/app/services/__pycache__/agent_service.cpython-311.pyc create mode 100644 intelligent_cabin/app/services/__pycache__/agent_service.cpython-312.pyc create mode 100644 intelligent_cabin/app/services/__pycache__/agent_service.cpython-313.pyc create mode 100644 intelligent_cabin/app/services/__pycache__/classifier.cpython-311.pyc create mode 100644 intelligent_cabin/app/services/__pycache__/classifier.cpython-312.pyc create mode 100644 intelligent_cabin/app/services/__pycache__/classifier.cpython-313.pyc create mode 100644 intelligent_cabin/app/services/__pycache__/config_loader.cpython-311.pyc create mode 100644 intelligent_cabin/app/services/__pycache__/config_loader.cpython-312.pyc create mode 100644 intelligent_cabin/app/services/__pycache__/config_loader.cpython-313.pyc create mode 100644 intelligent_cabin/app/services/__pycache__/dialog_act.cpython-311.pyc create mode 100644 intelligent_cabin/app/services/__pycache__/dialog_act.cpython-312.pyc create mode 100644 intelligent_cabin/app/services/__pycache__/dialog_act.cpython-313.pyc create mode 100644 intelligent_cabin/app/services/__pycache__/dialog_rules.cpython-311.pyc create mode 100644 intelligent_cabin/app/services/__pycache__/dialog_rules.cpython-312.pyc create mode 100644 intelligent_cabin/app/services/__pycache__/dialog_rules.cpython-313.pyc create mode 100644 intelligent_cabin/app/services/__pycache__/intent_registry.cpython-311.pyc create mode 100644 intelligent_cabin/app/services/__pycache__/intent_registry.cpython-312.pyc create mode 100644 intelligent_cabin/app/services/__pycache__/intent_registry.cpython-313.pyc create mode 100644 intelligent_cabin/app/services/__pycache__/joint_nlu.cpython-311.pyc create mode 100644 intelligent_cabin/app/services/__pycache__/joint_nlu.cpython-312.pyc create mode 100644 intelligent_cabin/app/services/__pycache__/joint_nlu.cpython-313.pyc create mode 100644 intelligent_cabin/app/services/__pycache__/knowledge_llm.cpython-312.pyc create mode 100644 intelligent_cabin/app/services/__pycache__/knowledge_store.cpython-312.pyc create mode 100644 intelligent_cabin/app/services/__pycache__/multi_intent_detector.cpython-311.pyc create mode 100644 intelligent_cabin/app/services/__pycache__/multi_intent_detector.cpython-312.pyc create mode 100644 intelligent_cabin/app/services/__pycache__/multi_intent_detector.cpython-313.pyc create mode 100644 intelligent_cabin/app/services/__pycache__/planner.cpython-311.pyc create mode 100644 intelligent_cabin/app/services/__pycache__/planner.cpython-312.pyc create mode 100644 intelligent_cabin/app/services/__pycache__/planner.cpython-313.pyc create mode 100644 intelligent_cabin/app/services/__pycache__/response_policy.cpython-311.pyc create mode 100644 intelligent_cabin/app/services/__pycache__/response_policy.cpython-312.pyc create mode 100644 intelligent_cabin/app/services/__pycache__/response_policy.cpython-313.pyc create mode 100644 intelligent_cabin/app/services/__pycache__/rewrite_engine.cpython-311.pyc create mode 100644 intelligent_cabin/app/services/__pycache__/rewrite_engine.cpython-312.pyc create mode 100644 intelligent_cabin/app/services/__pycache__/rewrite_engine.cpython-313.pyc create mode 100644 intelligent_cabin/app/services/__pycache__/router.cpython-311.pyc create mode 100644 intelligent_cabin/app/services/__pycache__/router.cpython-312.pyc create mode 100644 intelligent_cabin/app/services/__pycache__/router.cpython-313.pyc create mode 100644 intelligent_cabin/app/services/__pycache__/session_store.cpython-311.pyc create mode 100644 intelligent_cabin/app/services/__pycache__/session_store.cpython-312.pyc create mode 100644 intelligent_cabin/app/services/__pycache__/session_store.cpython-313.pyc create mode 100644 intelligent_cabin/app/services/__pycache__/social.cpython-311.pyc create mode 100644 intelligent_cabin/app/services/__pycache__/social.cpython-312.pyc create mode 100644 intelligent_cabin/app/services/__pycache__/social.cpython-313.pyc create mode 100644 intelligent_cabin/app/services/agent_service.py create mode 100644 intelligent_cabin/app/services/classifier.py create mode 100644 intelligent_cabin/app/services/config_loader.py create mode 100644 intelligent_cabin/app/services/dialog_act.py create mode 100644 intelligent_cabin/app/services/dialog_rules.py create mode 100644 intelligent_cabin/app/services/intent_registry.py create mode 100644 intelligent_cabin/app/services/joint_nlu.py create mode 100644 intelligent_cabin/app/services/knowledge_llm.py create mode 100644 intelligent_cabin/app/services/knowledge_store.py create mode 100644 intelligent_cabin/app/services/multi_intent_detector.py create mode 100644 intelligent_cabin/app/services/planner.py create mode 100644 intelligent_cabin/app/services/response_policy.py create mode 100644 intelligent_cabin/app/services/rewrite_engine.py create mode 100644 intelligent_cabin/app/services/router.py create mode 100644 intelligent_cabin/app/services/session_store.py create mode 100644 intelligent_cabin/app/services/social.py create mode 100644 intelligent_cabin/archive/demo/demo.html create mode 100644 intelligent_cabin/archive/docs/current_system_flow.md create mode 100644 intelligent_cabin/archive/docs/design.md create mode 100644 intelligent_cabin/archive/docs/solution_review.md create mode 100644 intelligent_cabin/archive/patents/202510261979_CN120089140A.pdf create mode 100644 intelligent_cabin/archive/patents/CN114299931B.pdf create mode 100644 intelligent_cabin/archive/patents/CN115394300A.pdf create mode 100644 intelligent_cabin/archive/patents/texts/202510261979_CN120089140A.txt create mode 100644 intelligent_cabin/archive/patents/texts/CN114299931B.txt create mode 100644 intelligent_cabin/archive/patents/texts/CN115394300A.txt create mode 100644 intelligent_cabin/archive/reports/bert_local_test_report.md create mode 100644 intelligent_cabin/archive/reports/bert_local_test_result.json create mode 100644 intelligent_cabin/archive/reports/bert_multi_intent_independent_report.md create mode 100644 intelligent_cabin/archive/reports/bert_multi_intent_independent_result.json create mode 100644 intelligent_cabin/archive/reports/joint_nlu_independent_report.md create mode 100644 intelligent_cabin/archive/reports/joint_nlu_independent_result.json create mode 100644 intelligent_cabin/archive/scripts/eval_joint_bert_multi_intent_independent.py create mode 100644 intelligent_cabin/archive/scripts/eval_joint_bert_nlu.py create mode 100644 intelligent_cabin/archive/scripts/eval_joint_nlu_independent.py create mode 100644 intelligent_cabin/archive/scripts/eval_local_bert_intent.py create mode 100644 intelligent_cabin/archive/scripts/eval_local_bert_multi_intent.py create mode 100644 intelligent_cabin/archive/scripts/eval_local_bert_multi_intent_independent.py create mode 100644 intelligent_cabin/archive/scripts/test_local_bert_intent.py create mode 100644 intelligent_cabin/archive/scripts/train_joint_bert_nlu.py create mode 100644 intelligent_cabin/archive/scripts/train_local_bert_intent.py create mode 100644 intelligent_cabin/archive/scripts/train_local_bert_multi_intent.py create mode 100644 intelligent_cabin/archive/tests/test_agent_cloud_route.py create mode 100644 intelligent_cabin/archive/tests/test_bert.py create mode 100644 intelligent_cabin/archive/tests/test_chat_stream.py create mode 100644 intelligent_cabin/archive/tests/test_config_loader.py create mode 100644 intelligent_cabin/archive/tests/test_dialog_continuation_and_multi_intent.py create mode 100644 intelligent_cabin/archive/tests/test_intent_coverage_and_stop.py create mode 100644 intelligent_cabin/archive/tests/test_joint_nlu_integration.py create mode 100644 intelligent_cabin/archive/tests/test_multi_intent_detector.py create mode 100644 intelligent_cabin/archive/tests/test_router_decisions.py create mode 100644 intelligent_cabin/archive/tests/test_social_chat.py create mode 100644 intelligent_cabin/archive/tests/test_workflow_templates.py create mode 100644 intelligent_cabin/config/actions.yml create mode 100644 intelligent_cabin/config/context_rewrite.yml create mode 100644 intelligent_cabin/config/dialog_acts.yml create mode 100644 intelligent_cabin/config/domain.yml create mode 100644 intelligent_cabin/config/forms.yml create mode 100644 intelligent_cabin/config/knowledge/false_weld_alarm.md create mode 100644 intelligent_cabin/config/responses.yml create mode 100644 intelligent_cabin/config/rules.yml create mode 100644 intelligent_cabin/config/voice_aliases.yml create mode 100644 intelligent_cabin/config/workflows.yml create mode 100644 intelligent_cabin/models/local_bert_intent/config.json create mode 100644 intelligent_cabin/models/local_bert_intent/label_map.json create mode 100644 intelligent_cabin/models/local_bert_intent/special_tokens_map.json create mode 100644 intelligent_cabin/models/local_bert_intent/tokenizer.json create mode 100644 intelligent_cabin/models/local_bert_intent/tokenizer_config.json create mode 100644 intelligent_cabin/models/local_bert_intent/train_summary.json create mode 100644 intelligent_cabin/models/local_bert_intent/vocab.txt create mode 100644 intelligent_cabin/models/local_bert_multi_intent/config.json create mode 100644 intelligent_cabin/models/local_bert_multi_intent/label_map.json create mode 100644 intelligent_cabin/models/local_bert_multi_intent/special_tokens_map.json create mode 100644 intelligent_cabin/models/local_bert_multi_intent/tokenizer.json create mode 100644 intelligent_cabin/models/local_bert_multi_intent/tokenizer_config.json create mode 100644 intelligent_cabin/models/local_bert_multi_intent/train_summary.json create mode 100644 intelligent_cabin/models/local_bert_multi_intent/vocab.txt create mode 100644 intelligent_cabin/models/local_joint_bert_nlu/joint_nlu_config.json create mode 100644 intelligent_cabin/models/local_joint_bert_nlu/special_tokens_map.json create mode 100644 intelligent_cabin/models/local_joint_bert_nlu/tokenizer.json create mode 100644 intelligent_cabin/models/local_joint_bert_nlu/tokenizer_config.json create mode 100644 intelligent_cabin/models/local_joint_bert_nlu/train_summary.json create mode 100644 intelligent_cabin/models/local_joint_bert_nlu/vocab.txt create mode 100644 intelligent_cabin/pyproject.toml create mode 100644 intelligent_cabin/requirements.txt create mode 100644 scripts/generate-voice-aliases.mjs create mode 100644 src/app/api/chat/route.ts create mode 100644 src/app/practice/page.tsx create mode 100644 src/components/artifacts/ArtifactRenderer.tsx create mode 100644 src/components/artifacts/DieMaterialAdjust.tsx create mode 100644 src/components/artifacts/DieStatusOverview.tsx create mode 100644 src/components/artifacts/KnowledgeArtifact.tsx create mode 100644 src/lib/artifacts/die-mock-data.ts create mode 100644 src/lib/artifacts/factory.ts create mode 100644 src/lib/artifacts/mock.ts create mode 100644 src/lib/artifacts/reducer.ts create mode 100644 src/lib/artifacts/types.ts create mode 100644 src/lib/nlu/client.ts create mode 100644 src/lib/nlu/mock.ts create mode 100644 src/lib/nlu/pipeline.ts create mode 100644 src/lib/nlu/types.ts create mode 100644 src/lib/nlu/voice-aliases.gen.ts diff --git a/.gitignore b/.gitignore index 5ef6a52..952c3c4 100644 --- a/.gitignore +++ b/.gitignore @@ -39,3 +39,14 @@ yarn-error.log* # typescript *.tsbuildinfo next-env.d.ts + +# models +*.pt +*.pth +*.safetensors +*.onnx +*.bin +*.h5 +*.ckpt +*.tflite +*.pb diff --git a/ai_assistant_features.md b/ai_assistant_features.md new file mode 100644 index 0000000..440ce00 --- /dev/null +++ b/ai_assistant_features.md @@ -0,0 +1,55 @@ +# AI 智能助理系统功能点与架构梳理 + +## 一、 核心功能点清单 + +### 1. 权限驱动的 AI 技能系统 (AI Skills & Query) +* **联系人与群组权限管控**:支持配置 AI 对特定微信联系人和微信群组的读取和回复权限,确保隐私安全。 +* **历史聊天检索 Skill**:AI 具备调用本地工具的能力,可按需查询和检索授权范围内的历史聊天内容,作为精准回复和数据分析的上下文。 + +### 2. 增强型三方协同对话 (Tripartite Collaborative Chat) +* **本地 Web 交互终端**:提供用户与 AI 专属对话的本地可视化 Web 界面。 +* **全局上下文静默监听**:AI 能够静默监听“我”与“微信联系人”的实时聊天记录,确保 AI 在被唤醒或介入时,已经掌握完整的对话背景。 +* **灵活的消息代发与审批工作流**: + * **模式 A(人审机发)**:我起草或修改合同/文案 -> 发给 AI 检查、润色 -> AI 直接将最终版发送给客户。 + * **模式 B(机审人发)**:AI 自动起草或修改合同/文案 -> 发给我 -> 我进行人工二次修改和确认 -> 由我发送给客户。 + +### 3. AI 行为审计与溯源机制 (Audit & Traceability) +* **全量行为事件日志**:详细记录 AI 的每一次工具调用(Skill 执行)、系统决策及状态流转。 +* **外部交互记录存档**:独立且完整地记录 AI 与所有外部微信联系人的对话明细。 +* **安全评估与熔断**:基于日志进行溯源,用于评估 AI 行为是否符合预期;支持在出现偏差时的人工介入和及时补救(如消息撤回、服务阻断等)。 + +### 4. 记忆库人工维护 (Memory Base Management) +* **Hermes Agent 集成**:采用 Hermes 架构理念来管理和沉淀 AI 智能体的状态与经验。 +* **人工介入知识库**:提供记忆库管理机制,允许人工查阅、修正、添加或删除 AI 的长短期记忆,确保 AI 的业务知识和认知能够准确演进。 + +--- + +## 二、 本地与远端架构切分方案评估与建议 + +您目前的方案非常合理,既保证了本地数据处理的执行效率和操作隐私,又充分利用了云端大模型的算力、中心化管控和数据汇总能力。以下是针对该方案的详细拆解与优化建议: + +### 1. 本地服务 (Local) - 侧重于“感知、执行、交互” +* **本地 Web 交互界面**:保障您日常操作的响应速度和最高的数据隐私。 +* **Skill 与工具执行引擎**:由于工具通常需要操作本地文件、调用本地微信客户端 RPA 接口或访问局域网资源,将其配置和执行放在本地是最佳且必须的实践。 +* **微信协议/客户端监听模块**:负责实时抓取微信聊天记录并发送消息,此模块强依赖本地环境。 +* **上下文聚合与组装**:在本地将抓取到的微信聊天记录、本地执行的 Skill 结果打包组装成 Prompt,再向上游远端发起请求。 + +### 2. 远端服务 (Remote) - 侧重于“大脑、管控、资产” +* **大模型 API 路由网关**:统一对接外部 LLM,隐藏真实的 API Key,便于统一计费和限流。 +* **AI 数字员工身份管理 (ID System)**: + * 统一定义和分配不同数字员工的 AI ID。 + * 集中配置、版本化管理并下发不同 ID 对应的 **系统提示词 (System Prompt)**。 +* **中心化记忆库 (Hermes Agent Memory)**: + * **优势**:放在远端可以实现跨设备、跨终端的同步。未来在其他设备登录,AI 依然拥有同样的上下文和记忆。 + * 提供统一的后台界面,供人工集中维护和调优记忆。 +* **行为审计中心 (Log Server)**: + * 接收来自本地异步上报的日志数据。 + * 通过 AI ID 进行区分,提供数据可视化面板,方便集中进行溯源、统计、安全审查和模型能力评估。 + +### 3. 架构切分建议与注意事项 +1. **私有化安全与本地独享模式 (Privacy & Local-exclusive AI)**:由于远端平台部署在局域网内,仅处理工作内容,无需进行额外的数据脱敏。若用户需要处理极度涉密数据或纯个人隐私数据,系统支持配置“本地独享 AI”模式:该模式下,AI 仅在本地运行和可见,不向远端平台上传任何聊天记录或行为日志,实现彻底的本地物理隔离。 +2. **弱网容灾机制**:本地应有简易的日志队列缓存。当局域网网络波动时,日志可先落盘本地,网络恢复后自动补传,保证审计数据的完整性。 +3. **指令与配置下发通道**:如果远端平台修改了 System Prompt 或人工更新了记忆库,需要有一个机制(如 WebSocket 长连接或本地定时轮询)让本地应用能够实时感知并更新,避免配置滞后。 + +### 总结 +您设计的这套架构是典型的 **“云端大脑 + 边缘四肢(端云结合)”** 架构。远端统筹认知、记忆与合规管控,本地负责敏捷感知(监听微信)、行动(工具调用)和即时交互。整体方案逻辑清晰、健壮,非常有利于后续的持续迭代与多数字员工扩展。 diff --git a/archive/test-ai.js b/archive/test-ai.js new file mode 100644 index 0000000..4f87180 --- /dev/null +++ b/archive/test-ai.js @@ -0,0 +1,2 @@ +const { streamText } = require('ai'); +console.log(Object.keys(streamText({}))); diff --git a/archive/test-ai.mjs b/archive/test-ai.mjs new file mode 100644 index 0000000..911b518 --- /dev/null +++ b/archive/test-ai.mjs @@ -0,0 +1,9 @@ +import { streamText } from 'ai'; +const mockModel = { + provider: 'mock', + specificationVersion: 'v1', + defaultObjectGenerationMode: 'json', + doStream: async () => ({ stream: new ReadableStream(), rawCall: { rawPrompt: '', rawSettings: {} } }) +}; +const result = streamText({ model: mockModel, messages: [] }); +console.log(Object.keys(result).filter(k => k.includes('to'))); diff --git a/docs/DBUS_API.md b/docs/DBUS_API.md new file mode 100644 index 0000000..bcbc416 --- /dev/null +++ b/docs/DBUS_API.md @@ -0,0 +1,473 @@ +# 线切割控制系统 DBus 接口说明文档 + +## 基本信息 + +| 项目 | 值 | +|------|-----| +| **服务名** | `com.wirecut.service` | +| **对象路径** | `/com/wirecut/control` | +| **接口名** | `com.wirecut.IControl` | +| **总线类型** | System Bus(系统总线) | +| **设计用途** | 供"小龙虾"等外部程序对接线切割控制系统 | + +--- + +## 目录 + +1. [运动控制接口](#1-运动控制接口) +2. [加工参数接口](#2-加工参数接口) +3. [状态查询接口](#3-状态查询接口) +4. [NC 文件操作接口](#4-nc-文件操作接口) +5. [工件坐标接口](#5-工件坐标接口) +6. [放电设置接口](#6-放电设置接口) +7. [信号(推送通知)](#7-信号推送通知) +8. [状态码说明](#8-状态码说明) +9. [命令行调用示例](#9-命令行调用示例) +10. [注意事项](#10-注意事项) + +--- + +## 1. 运动控制接口 + +### startRun() - 启动加工 +- **描述**: 启动加工程序,等价于点击界面"运行"按钮 +- **参数**: 无 +- **返回**: 无 + +```powershell +# 启动加工 +qdbus com.wirecut.service /com/wirecut/control startRun +``` + +### stopRun() - 停止加工 +- **描述**: 停止当前加工,等价于点击"停止"按钮 +- **参数**: 无 +- **返回**: 无 + +```bash +qdbus com.wirecut.service /com/wirecut/control stopRun +``` + +### pauseRun() - 暂停加工 +- **描述**: 暂停加工(变频),等价于点击"变频暂停" +- **参数**: 无 +- **返回**: 无 + +```bash +qdbus mock_qdbus.py com.wirecut.service /com/wirecut/control pauseRun +``` + +### homeAll() - 全轴回零 +- **描述**: 所有轴执行回零操作 +- **参数**: 无 +- **返回**: 无 + +```bash +qdbus com.wirecut.service /com/wirecut/control homeAll +``` + +### startKongZou() - 开始空走 +- **描述**: 启动空走模式(不放电测试) +- **参数**: 无 +- **返回**: 无 + +```bash +qdbus com.wirecut.service /com/wirecut/control startKongZou +``` + +### stopKongZou() - 停止空走 +- **描述**: 停止空走模式 +- **参数**: 无 +- **返回**: 无 + +```bash +qdbus com.wirecut.service /com/wirecut/control stopKongZou +``` + +--- + +## 2. 加工参数接口 + +### setSpeed(speed: int) -> int - 设置加工速度 +- **描述**: 设置加工速度 +- **参数**: + - `speed`: 速度值,单位 mm/min,范围 1-9999 +- **返回**: 实际设置的速度值 + +```bash +qdbus com.wirecut.service /com/wirecut/control setSpeed 80 +``` + +### getSpeed() -> int - 获取设定速度 +- **描述**: 获取当前设定的加工速度 +- **参数**: 无 +- **返回**: 设定速度值 (mm/min) + +```bash +qdbus com.wirecut.service /com/wirecut/control getSpeed +``` + +### setVoltage(vol: int) - 设置放电电压 +- **描述**: 设置放电电压值 +- **参数**: + - `vol`: 电压值 +- **返回**: 无 + +```bash +qdbus com.wirecut.service /com/wirecut/control setVoltage 90 +``` + +### setCurrent(cur: int) - 设置放电电流 +- **描述**: 设置放电电流值 +- **参数**: + - `cur`: 电流值 +- **返回**: 无 + +```bash +qdbus com.wirecut.service /com/wirecut/control setCurrent 5 +``` + +--- + +## 3. 状态查询接口 + +### getStatus() -> QVariantMap - 获取完整状态 +- **描述**: 获取系统完整状态信息(字典格式) +- **参数**: 无 +- **返回字段**: + +| 字段 | 类型 | 说明 | +|------|------|------| +| `running` | int | 运行状态:0=停止 1=运行中 2=暂停 | +| `is_homed` | int | 是否已回零:0=否 1=是 | +| `is_homing` | int | 是否正在回零:0=否 1=是 | +| `pos_x` | double | X轴位置 (mm) | +| `pos_y` | double | Y轴位置 (mm) | +| `pos_z` | double | Z轴位置 (mm) | +| `pos_u` | double | U轴位置 (mm) | +| `pos_v` | double | V轴位置 (mm) | +| `vol` | int | 当前电压值 | +| `cur` | int | 当前电流值 | +| `daohao` | int | 导号(加工段号) | +| `speed` | int | 设定速度 (mm/min) | + +```bash +qdbus com.wirecut.service /com/wirecut/control getStatus +``` + +### getAxisPos() -> QString - 获取各轴位置 +- **描述**: 轻量级接口,获取各轴当前位置 +- **参数**: 无 +- **返回**: `"x,y,z,u,v"` 格式字符串,保留3位小数,单位 mm + +```bash +qdbus com.wirecut.service /com/wirecut/control getAxisPos +# 返回示例: "10.500,20.321,0.000,0.123,0.000" +``` + +### isRunning() -> bool - 是否正在加工 +- **描述**: 查询是否处于加工状态 +- **参数**: 无 +- **返回**: true=运行中 false=已停止 + +```bash +qdbus com.wirecut.service /com/wirecut/control isRunning +``` + +### isHomed() -> bool - 是否已回零 +- **描述**: 查询是否已完成回零 +- **参数**: 无 +- **返回**: true=已回零 false=未回零 + +```bash +qdbus com.wirecut.service /com/wirecut/control isHomed +``` + +--- + +## 4. NC 文件操作接口 + +### loadNC(path: QString) -> bool - 加载 NC 文件 +- **描述**: 加载 NC 程序文件 +- **参数**: + - `path`: NC 文件的**绝对路径** +- **返回**: true=成功 false=失败 + +```bash +qdbus com.wirecut.service /com/wirecut/control loadNC "/home/user/test.ngc" +``` + +### getCurrentNC() -> QString - 获取当前 NC 文件 +- **描述**: 获取当前已加载的 NC 文件路径 +- **参数**: 无 +- **返回**: NC 文件路径 + +```bash +qdbus com.wirecut.service /com/wirecut/control getCurrentNC +``` + +--- + +## 5. 工件坐标接口 + +### clearAxisOffset(axis: int) - 清除单轴工件坐标 +- **描述**: 清除指定轴的工件坐标偏移 +- **参数**: + - `axis`: 轴编号:0=X 1=Y 2=Z 3=U 4=V 5=C +- **返回**: 无 + +```bash +# 清除 X 轴工件坐标 +qdbus com.wirecut.service /com/wirecut/control clearAxisOffset 0 +``` + +### clearAllAxisOffset() - 清除所有轴工件坐标 +- **描述**: 清除全部6个轴的工件坐标偏移 +- **参数**: 无 +- **返回**: 无 + +```bash +qdbus com.wirecut.service /com/wirecut/control clearAllAxisOffset +``` + +--- + +## 6. 放电设置接口 + +### ShowDischargeSetting() - 打开放电设置界面 +- **描述**: 弹出放电设置窗口 +- **参数**: 无 +- **返回**: 无 + +```bash +qdbus com.wirecut.service /com/wirecut/control ShowDischargeSetting +``` + +### HideDischargeSetting() - 关闭放电设置界面 +- **描述**: 隐藏放电设置窗口 +- **参数**: 无 +- **返回**: 无 + +```bash +qdbus com.wirecut.service /com/wirecut/control HideDischargeSetting +``` + +### SetWorkpieceId(workpieceId: int) - 设置当前工件号 +- **描述**: 切换到指定工件编号 +- **参数**: + - `workpieceId`: 工件编号,范围 0-8 +- **返回**: 无 + +```bash +# 切换到工件3 +qdbus com.wirecut.service /com/wirecut/control SetWorkpieceId 3 +``` + +### SetDischargePara(workpieceId, knifeId, paramType, value) - 设置放电参数 +- **描述**: 设置指定工件、指定刀号的放电参数 +- **参数**: + - `workpieceId`: 工件编号 (0-8) + - `knifeId`: 刀号 (1-11) + - `paramType`: 参数类型字符串: + - `"voltage"` / `"放电码"` - 放电码 + - `"current"` / `"跟踪值"` - 跟踪值 + - `"servo"` / `"速度"` - 速度上限 + - `value`: 参数值 +- **返回**: 无 + +```bash +# 设置工件0,刀号1,放电码为80 +qdbus com.wirecut.service /com/wirecut/control SetDischargePara 0 1 voltage 80 +``` + +### GetDischargePara(workpieceId, knifeId, paramType) -> int - 获取放电参数 +- **描述**: 获取指定工件、指定刀号的放电参数值 +- **参数**: 同 SetDischargePara +- **返回**: 参数值 + +```bash +# 获取工件0,刀号1的放电码 +qdbus com.wirecut.service /com/wirecut/control GetDischargePara 0 1 voltage +``` + +### CopyToAllWorkpieces() - 复制到所有工件 +- **描述**: 将当前工件的放电参数复制到所有工件 +- **参数**: 无 +- **返回**: 无 + +```bash +qdbus com.wirecut.service /com/wirecut/control CopyToAllWorkpieces +``` + +--- + +## 7. 信号(推送通知) + +DBus 服务会主动推送以下信号,外部程序可以监听: + +### runStateChanged(state: int) - 运行状态变化 +- **触发时机**: 运行状态改变时 +- **参数**: + - `state`: 0=停止 / 1=运行 / 2=暂停 + +### alarmMessage(type: int, msg: QString) - 报警/提示 +- **触发时机**: 系统产生报警或提示时 +- **参数**: + - `type`: 0=提示 / 1=警告 / 2=错误 + - `msg`: 消息内容 + +### axisPosUpdated(x, y, z, u, v: double) - 轴位置刷新 +- **触发时机**: 每 500ms 周期推送一次 +- **参数**: 各轴当前位置 (mm) + +### machiningFinished() - 加工完成 +- **触发时机**: 加工程序执行完成时 +- **参数**: 无 + +--- + +## 8. 状态码说明 + +### 运行状态码 (running 字段) + +| 值 | 状态 | 说明 | +|----|------|------| +| 0 | 停止 | 未运行或已停止 | +| 1 | 运行中 | 正在加工 | +| 2 | 暂停 | 已暂停(变频) | + +### 轴编号 + +| 值 | 轴 | 说明 | +|----|-----|------| +| 0 | X | X轴 | +| 1 | Y | Y轴 | +| 2 | Z | Z轴 | +| 3 | U | U轴 | +| 4 | V | V轴 | +| 5 | C | C轴 | + +--- + +## 9. 命令行调用示例 + +### 完整加工流程 + +```bash +# 1. 查看当前状态 +qdbus com.wirecut.service /com/wirecut/control getStatus + +# 2. 加载 NC 文件(必须绝对路径) +qdbus com.wirecut.service /com/wirecut/control loadNC "/home/pi/sample.ngc" + +# 3. 设置加工速度 +qdbus com.wirecut.service /com/wirecut/control setSpeed 80 + +# 4. 开始加工 +qdbus com.wirecut.service /com/wirecut/control startRun + +# 5. 实时查看轴位置 +qdbus com.wirecut.service /com/wirecut/control getAxisPos + +# 6. 暂停加工 +qdbus com.wirecut.service /com/wirecut/control pauseRun + +# 7. 停止加工 +qdbus com.wirecut.service /com/wirecut/control stopRun +``` + +### 空走测试流程 + +```bash +# 1. 回零 +qdbus com.wirecut.service /com/wirecut/control homeAll + +# 2. 开始空走(不放电) +qdbus com.wirecut.service /com/wirecut/control startKongZou + +# 3. 停止空走 +qdbus com.wirecut.service /com/wirecut/control stopKongZou +``` + +### Python 调用示例(使用 dbus-python) + +```python +import dbus + +# 连接系统总线 +bus = dbus.SystemBus() + +# 获取服务对象 +obj = bus.get_object('com.wirecut.service', '/com/wirecut/control') +iface = dbus.Interface(obj, 'com.wirecut.IControl') + +# 调用方法 +status = iface.getStatus() +print("运行状态:", status['running']) +print("X轴位置:", status['pos_x']) + +# 加载 NC 文件 +iface.loadNC("/home/pi/test.ngc") + +# 启动加工 +iface.startRun() +``` + +--- + +## 10. 注意事项 + +### ⚠️ 重要提醒 + +1. **CNC 软件必须运行** + - 所有 DBus 接口只有在 CNC 主程序启动后才能使用 + - 软件未启动时调用会返回 DBus 错误 + +2. **NC 文件路径必须为绝对路径** + - `loadNC()` 的 path 参数必须使用完整绝对路径 + - 相对路径会导致加载失败 + +3. **速度设置范围** + - 速度值范围:1-9999 mm/min + - 超出范围会被截断或忽略 + +4. **System Bus 权限** + - 服务运行在 System Bus 上,可能需要 root 权限 + - 普通用户调用可能需要配置 DBus 权限规则 + +5. **线程安全** + - 所有接口调用都是异步队列执行(QueuedConnection) + - 调用后不会阻塞,实际执行由主界面事件循环处理 + +6. **共享内存依赖** + - 部分参数(电压、电流、位置)依赖共享内存 + - 共享内存未就绪时返回 0 或默认值 + +--- + +## 附录:DBus 权限配置 + +如果普通用户无法调用,需要在 `/etc/dbus-1/system.d/` 下添加权限配置文件 `com.wirecut.conf`: + +```xml +<!DOCTYPE busconfig PUBLIC + "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN" + "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> +<busconfig> + <policy user="pi"> + <allow own="com.wirecut.service"/> + <allow send_destination="com.wirecut.service"/> + <allow receive_sender="com.wirecut.service"/> + </policy> + <policy context="default"> + <allow send_destination="com.wirecut.service"/> + <allow receive_sender="com.wirecut.service"/> + </policy> +</busconfig> +``` + +--- + +**文档版本**: v1.0 +**生成日期**: 2026-05-20 +**对应源码**: `/usr/share/runf/wirecutdbus.h` / `wirecutdbus.cpp` diff --git a/docs/architecture_overview.html b/docs/architecture_overview.html new file mode 100644 index 0000000..00b278a --- /dev/null +++ b/docs/architecture_overview.html @@ -0,0 +1,642 @@ + + +
+ + +选择视角,分别查看"用户界面交互路径"或"背后技术判断逻辑"。语音输入经过四阶段前置拦截后再进入 BERT NLU。
+选择视角,分别查看"用户界面交互路径"或"背后技术判断逻辑"。语音输入经过四阶段前置拦截后再进入 BERT NLU。
+qDSxz4ag@jZ*CQPOz`9Sa9y?aaKaL>NrUib@Z
z n1gk>)SDJD-~MyI`bXhseTA9qb0zWp3#X5y39#L1Hn
z$Nt><*1LD@d*#iunW`4eg?&vm;R^s?OaCuG8*c!#jcJF8$eCdi4b=J_D2d2b|0QwV
tegGJP|IPr&zrvwV=cC&ubP#cSFy9^tpt;|F%O?L+qz3??x!X{{XKo#7+PJ
literal 0
HcmV?d00001
diff --git a/intelligent_cabin/app/core/__pycache__/config.cpython-313.pyc b/intelligent_cabin/app/core/__pycache__/config.cpython-313.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..f8547270e2926a2091b25727fbe027e4487c9539
GIT binary patch
literal 3704
zcmai%+fN($701VTAcjCNV8GlQV=%V4*yeu8g=9&Z&85kvPI?p4Xs`z}WbARzj6*dQ)1RobUWE3Ih%f_-SKK2+)}D?jY$r%Kgo)pn!4w93Bpt>>H>gNb&xM*jNu
z`JMASzu)=YW_Z)l(I(;NuODC9oo$t*&j{+DX0PyO1q;8Fa#GHBU%KZ5-@PViib`QA
zCgqw2rJR4$x9E3$!N2K`NsC@Xkc)Dv`883hNwmMCT3SxCZM|HyM0dTkVV1Y`;w?RI
z=e=h9bK3czo2c_m34A#TnsPqy$FW?T9G=7j1do`?LfcOHUOuZ1$zU=(TPW``yKsLi$V0k7~SuJ5N`NM9|4EM
z>w=a%U6xBwPFgeU-oN#bJg`&QLuwmzC}0+$ZcD*#6*N2!JHP`DxVPblF?CrjjgX8H
zE;BWHp7@-t%A;0U_lWHp8TOUxVaQYM3*iaiiO0yrBtcoimZz&Bqc3YFprI?#2sDB)
zX8$ADt;cl7WDIYa$+_1ux*OY;fZYNd@|bc71O$SMh7x@hDx5&p6W>B`4FPIbh~6E-
zJUXU%k4-vLCnoPA@jas5&G@yXhfQ^H1AZ|m*$47}P2#}`r56K90i*DiUg69*ywOpJ
zxJ;nBjo>p|CpQw3-s_0)=@HS0b%U0}V7DFx-