Files
openobserve/web
Sai Nikhil f96b90e15f fix: o2 ai updates (#8734)
### **User description**
Loading Indicator will be visible everytime user hits the generate
before it was hidden
Implemented abort functionality for responses, allowing users to stop
generation mid-way.
Fixed the issue where empty messages appeared before actual responses,
ensuring a cleaner chat log.
when there is so much content incoming and if I try to stop it , it
should stop scroll

UI Enhancements:
Differentiated user messages and AI responses visually for better
clarity.
Updated the Send button with a gradient color and added styling for the
Stop button.
Improved the input experience by automatically focusing the input and
highlighting its border when clicking anywhere in the chat area.


___

### **PR Type**
Enhancement, Bug fix


___

### **Description**
- Add abortable streaming for AI chat

- Improve UI: send/stop buttons, avatars, gradients

- Auto-scroll to loading indicator on generate

- Prevent empty assistant messages during stream


___

### Diagram Walkthrough


```mermaid
flowchart LR
  UI["Chat UI (O2AIChat.vue)"]
  Fetch["fetchAiChat with AbortSignal (useAiChat.ts)"]
  AbortCtrl["AbortController lifecycle"]
  Stream["Streaming parser & message updates"]
  History["Save to history"]
  Styles["Theming, gradients, layout"]
  UI -- "Send -> creates AbortController" --> AbortCtrl
  AbortCtrl -- "signal" --> Fetch
  Fetch -- "stream chunks" --> Stream
  Stream -- "append assistant content" --> UI
  UI -- "Stop click" --> AbortCtrl
  AbortCtrl -- "abort()" --> Fetch
  Stream -- "on complete/error" --> History
  UI -- "focus + auto-scroll to loading" --> Styles
```



<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>useAiChat.ts</strong><dd><code>Abortable fetch with
streaming support and docs</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

web/src/composables/useAiChat.ts

<ul><li>Add JSDoc and AbortSignal param to <code>fetchAiChat</code><br>
<li> Include optional <code>signal</code> in fetch options<br> <li>
Handle <code>AbortError</code> distinctly; return <code>{ cancelled:
true }</code><br> <li> Generalize error handling and null fallback</ul>


</details>


  </td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8734/files#diff-830ee4f21bdbbd0fa5c5c0f43b0a1d0200831e07ccddc91982cf0371c801b046">+38/-9</a>&nbsp;
&nbsp; </td>

</tr>

<tr>
  <td>
    <details>
<summary><strong>O2AIChat.vue</strong><dd><code>Streaming UX,
cancellation, and UI enhancements</code>&nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

web/src/components/O2AIChat.vue

<ul><li>Implement AbortController lifecycle and Stop button<br> <li>
Avoid pre-creating empty assistant messages during stream<br> <li>
Auto-scroll to loading indicator; focus input on click<br> <li> UI/UX:
themed avatars, gradient backgrounds, send/stop styles</ul>


</details>


  </td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8734/files#diff-a6a125719a7b32b31b53fcfe05c12081d82c139a401699affdda0db8e73887e3">+382/-39</a></td>

</tr>
</table></td></tr></tr></tbody></table>

</details>

___
2025-10-06 15:49:30 +05:30
..
2023-02-02 09:03:11 +05:30
2025-10-06 15:49:30 +05:30
2023-08-06 01:29:13 +08:00
2023-02-02 09:03:11 +05:30
2023-02-02 09:03:11 +05:30
2023-02-02 09:03:11 +05:30
2024-04-03 12:49:25 +05:30
2023-02-02 09:03:11 +05:30

web

This template should help get you started developing with Vue 3 in Vite.

VSCode + Volar (and disable Vetur) + TypeScript Vue Plugin (Volar).

Type Support for .vue Imports in TS

TypeScript cannot handle type information for .vue imports by default, so we replace the tsc CLI with vue-tsc for type checking. In editors, we need TypeScript Vue Plugin (Volar) to make the TypeScript language service aware of .vue types.

If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a Take Over Mode that is more performant. You can enable it by the following steps:

  1. Disable the built-in TypeScript Extension
    1. Run Extensions: Show Built-in Extensions from VSCode's command palette
    2. Find TypeScript and JavaScript Language Features, right click and select Disable (Workspace)
  2. Reload the VSCode window by running Developer: Reload Window from the command palette.

Customize configuration

See Vite Configuration Reference.

Project Setup

npm install

Compile and Hot-Reload for Development

For stand-alone UI development environment, create .env file and which contains below environment variable

VITE_OPENOBSERVE_ENDPOINT=http://localhost:5080/
npm run dev

Type-Check, Compile and Minify for Production

npm run build

Run Unit Tests with Vitest

npm run test:unit

Run End-to-End Tests with Cypress

npm run test:e2e:dev

This runs the end-to-end tests against the Vite development server. It is much faster than the production build.

But it's still recommended to test the production build with test:e2e before deploying (e.g. in CI environments):

npm run build
npm run test:e2e

Lint with ESLint

npm run lint