feat: neural engine OpenAI proposals (Stage 0)#67
Conversation
There was a problem hiding this comment.
Sorry @sonra44, your pull request is larger than the review limit of 150000 diff characters
|
Caution Review failedFailed to post review comments 📝 WalkthroughОбзорPR вводит полноценную систему управления инцидентами для консоли оператора ORION, интеграцию с сервисом QIKI для обработки запросов через NATS, поддержку OpenAI для генерации предложений, новые протокольные модели и расширенную документацию по дизайну. Добавлены конфигурация, тесты и обновления UI/i18n. Изменения
Диаграммы последовательностиsequenceDiagram
participant Operator as Оператор
participant ORION as ORION Console
participant Store as IncidentStore
participant Rules as Rules Config
Operator->>ORION: Событие (sensor data)
ORION->>Rules: Загрузить правила
ORION->>Store: ingest(event)
Store->>Store: Применить правила
Note over Store: Вычислить ключ инцидента<br/>Проверить min_duration_s<br/>Обновить счётчик/peak_value
Store->>ORION: Вернуть список инцидентов
ORION->>Operator: Отобразить инцидент<br/>в Events таблице
Operator->>ORION: Ack/Подтвердить
ORION->>Store: ack(incident_id)
Store->>ORION: Успех
ORION->>Operator: Обновить статус
sequenceDiagram
participant User as Пользователь
participant ORION as ORION UI
participant NATS as NATS
participant QIKI as QIKI Chat
participant OpenAI as OpenAI API
User->>ORION: Ввод "q: scan 360"
ORION->>ORION: parse_qiki_intent()
ORION->>NATS: Опубликовать IntentV1<br/>на qiki.chat.v1
NATS->>QIKI: Доставить запрос
QIKI->>QIKI: Валидировать QikiChatRequestV1
QIKI->>OpenAI: create_response_json_schema()
OpenAI->>OpenAI: Генерировать proposal<br/>с JSON Schema
OpenAI->>QIKI: Вернуть JSON response
QIKI->>QIKI: Парсить и трансформировать<br/>в ProposalV1
QIKI->>NATS: Ответить QikiChatResponseV1
NATS->>ORION: Получить response
ORION->>ORION: _ingest_proposals_batch()
ORION->>User: Показать proposal<br/>в Inspector
sequenceDiagram
participant NeuralEngine as NeuralEngine
participant OpenAI as OpenAIResponsesClient
participant LLM as OpenAI LLM
Note over NeuralEngine: generate_proposals(context)
alt API Key Present
NeuralEngine->>NeuralEngine: _build_min_context()
NeuralEngine->>OpenAI: create_response_json_schema()
OpenAI->>OpenAI: POST с system prompt<br/>и JSON Schema
OpenAI->>LLM: Запрос structured output
LLM->>OpenAI: JSON response
OpenAI->>OpenAI: parse_response_json()
OpenAI->>NeuralEngine: _LLMProposalsResponseV1
NeuralEngine->>NeuralEngine: Strip actions<br/>Трансформировать в Proposal
NeuralEngine->>NeuralEngine: Вернуть proposals
else API Key Missing
NeuralEngine->>NeuralEngine: Вернуть diagnostics stub
else LLM Error
NeuralEngine->>NeuralEngine: Логировать warning<br/>Вернуть diagnostics stub
end
Оценённые затраты на review🎯 5 (Critical) | ⏱️ ~120 minutes Масштабная PR с множественными новыми подсистемами: система управления инцидентами (~250 строк интенсивной логики), полная QIKI чат-интеграция (~200+ строк), OpenAI интеграция с retry логикой и валидацией (~200+ строк), новые протокольные модели (~150+ строк), 8+ файлов документации, расширенные тесты. Требуется тщательная проверка логики инцидентов, обработки ошибок OpenAI, валидации protocol v1, и корректности интеграции NATS. Поэма
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Comment |
💡 Codex Reviewhttps://github.com/sonra44/QIKI_DTMP/blob/e9f1fe83e642acfc3249c62a9a902f06509a6d94/src/qiki/services/operator_console/core/incidents.py#L44-L48 Because https://github.com/sonra44/QIKI_DTMP/blob/e9f1fe83e642acfc3249c62a9a902f06509a6d94/src/qiki/services/q_core_agent/core/neural_engine.py#L114-L117
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Note Docstrings generation - SUCCESS |
Docstrings generation was requested by @sonra44. * https://github.com/sonra44/QIKI_DTMP/pull/67#issuecomment-3724542532 The following files were modified: * `src/qiki/services/operator_console/clients/nats_client.py` * `src/qiki/services/operator_console/main_orion.py` * `src/qiki/services/operator_console/tests/test_qiki_routing.py` * `src/qiki/services/q_core_agent/core/neural_engine.py` * `src/qiki/services/q_core_agent/core/openai_responses_client.py` * `src/qiki/services/q_core_agent/tests/test_agent.py` * `src/qiki/services/q_core_agent/tests/test_neuralengine_proposals_only.py` * `src/qiki/shared/models/orion_qiki_protocol.py` * `tests/unit/test_orion_qiki_protocol_v1.py`
Stage 0: introduce initial NeuralEngine proposals for OpenAI integration. This PR adds initial API stubs and aligns naming conventions, preparing for Stage 1 compute contracts.
Summary by CodeRabbit
Примечания к выпуску
Новые функции
Документация
✏️ Tip: You can customize this high-level summary in your review settings.