mirror of
https://github.com/openobserve/openobserve.git
synced 2026-11-06 00:09:22 +00:00
### **PR Type**
Enhancement
___
### **Description**
- Introduce incidents context provider for SRE agent
- Export and register new provider in index
- Enhance `fetchAiChat` to accept explicit context
- Auto-register and clean incident context in drawer
___
### Diagram Walkthrough
```mermaid
flowchart LR
A["IncidentDetailDrawer.vue"]
B["contextRegistry"]
C["createIncidentsContextProvider"]
D["useAiChat.fetchAiChat"]
E["AI Chat API"]
A -- "register/unregister incidents" --> B
B -- "provides incident context" --> C
C -- "getContext()" --> D
D -- "send payload" --> E
```
<details> <summary><h3> File Walkthrough</h3></summary>
<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table>
<tr>
<td>
<details>
<summary><strong>incidentsContextProvider.ts</strong><dd><code>New
incidents context provider</code>
</dd></summary>
<hr>
web/src/composables/contextProviders/incidentsContextProvider.ts
<ul><li>Add new <code>createIncidentsContextProvider</code> factory<br>
<li> Build SRE agent structured incident context<br> <li> Include
optional fields: dimensions, topology, triggers, RCA</ul>
</details>
</td>
<td><a
href="https://github.com/openobserve/openobserve/pull/10186/files#diff-012246fbc305620dd85432d34ec1fecc32c7bb377474b7a02dc6ed3b6beba78c">+72/-0</a>
</td>
</tr>
<tr>
<td>
<details>
<summary><strong>useAiChat.ts</strong><dd><code>Support explicit and
structured context</code>
</dd></summary>
<hr>
web/src/composables/useAiChat.ts
<ul><li>Add <code>explicitContext</code> parameter to
<code>fetchAiChat</code><br> <li> Prioritize explicit, then structured,
then legacy context<br> <li> Rebuild request payload with root
<code>agent_type</code></ul>
</details>
</td>
<td><a
href="https://github.com/openobserve/openobserve/pull/10186/files#diff-830ee4f21bdbbd0fa5c5c0f43b0a1d0200831e07ccddc91982cf0371c801b046">+27/-12</a>
</td>
</tr>
<tr>
<td>
<details>
<summary><strong>IncidentDetailDrawer.vue</strong><dd><code>Auto-register
incidents context in drawer</code>
</dd></summary>
<hr>
web/src/components/alerts/IncidentDetailDrawer.vue
<ul><li>Remove manual AI chat panel rendering<br> <li>
Auto-register/unregister incidents context via <code>watch</code> and
<code>onUnmounted</code><br> <li> Simplify <code>openSREChat</code> and
remove <code>showAIChat</code> state<br> <li> Update imports to include
context provider</ul>
</details>
</td>
<td><a
href="https://github.com/openobserve/openobserve/pull/10186/files#diff-6973d58a5f49658b07d3533d4db5d32cc6430433b51732481e7497243dadb0b0">+30/-26</a>
</td>
</tr>
</table></td></tr><tr><td><strong>Configuration
changes</strong></td><td><table>
<tr>
<td>
<details>
<summary><strong>index.ts</strong><dd><code>Export incidents context
provider</code>
</dd></summary>
<hr>
web/src/composables/contextProviders/index.ts
<ul><li>Export <code>createIncidentsContextProvider</code><br> <li>
Ensure proper newline and ordering</ul>
</details>
</td>
<td><a
href="https://github.com/openobserve/openobserve/pull/10186/files#diff-2f5cd69b9d0b7e1c87c1dbe6ad7cdb7b182014a03594481085561a9d694d2659">+2/-1</a>
</td>
</tr>
</table></td></tr></tr></tbody></table>
</details>
___