mirror of
https://github.com/openobserve/openobserve.git
synced 2026-11-05 16:10:43 +00:00
### **User description** 1. This PR adds the additional context to the following pages - logs, dashboards , pipelines , alerts 2. fixed auto scrolling when user trying to stop the scroll in ai chat 3. in add alert page when user opens the ai chat it was overlapping the buttons of generate ___ ### **PR Type** Enhancement, Bug fix ___ ### **Description** - Introduce global AI context provider system - Add page-specific context providers - Fix AI chat auto-scroll behavior - Prevent AI chat overlap on Add Alert ___ ### Diagram Walkthrough ```mermaid flowchart LR Registry["ContextRegistry singleton"] -- "register/setActive" --> LogsProv["Logs context provider"] Registry -- "register/setActive" --> PipesProv["Pipelines context provider"] Registry -- "register/setActive" --> AlertsProv["Alerts context provider"] Registry -- "register/setActive" --> DashProv["Dashboards context provider"] Registry -- "fallback" --> DefaultProv["Default context provider"] UIChat["AI Chat"] -- "getActiveContext()" --> Registry Pages["Pages (Logs/Pipelines/Alerts/Dashboards)"] -- "mount/unmount" --> Registry ``` <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><details><summary>14 files</summary><table> <tr> <td><strong>alertsContextProvider.ts</strong><dd><code>New alerts page context provider</code> </dd></td> <td><a href="https://github.com/openobserve/openobserve/pull/8697/files#diff-95b95a1b18db00eb9a3b4b9155cf23a078e4d54032f023d6fdf7445afb9e4661">+52/-0</a> </td> </tr> <tr> <td><strong>dashboardsContextProvider.ts</strong><dd><code>New dashboards context provider with intents</code> </dd></td> <td><a href="https://github.com/openobserve/openobserve/pull/8697/files#diff-c3323cfc4d7015b1b51ff5ec85fe3371c817dcc614e52ebb4fac76abc719b872">+76/-0</a> </td> </tr> <tr> <td><strong>defaultContextProvider.ts</strong><dd><code>Default app-wide context provider</code> </dd></td> <td><a href="https://github.com/openobserve/openobserve/pull/8697/files#diff-dedeb11e8ee3b92acda8c30cb84d2a749dec11cb1387547c613220a29744e236">+59/-0</a> </td> </tr> <tr> <td><strong>index.ts</strong><dd><code>Export registry and providers</code> </dd></td> <td><a href="https://github.com/openobserve/openobserve/pull/8697/files#diff-2f5cd69b9d0b7e1c87c1dbe6ad7cdb7b182014a03594481085561a9d694d2659">+36/-0</a> </td> </tr> <tr> <td><strong>logsContextProvider.ts</strong><dd><code>Logs context provider with time and fields</code> </dd></td> <td><a href="https://github.com/openobserve/openobserve/pull/8697/files#diff-bd6b1c67f0d9ef96110421aac3dd3e8f90115da95adf28e79c88e1c6fc594ac2">+198/-0</a> </td> </tr> <tr> <td><strong>pipelinesContextProvider.ts</strong><dd><code>Pipelines editor context provider</code> </dd></td> <td><a href="https://github.com/openobserve/openobserve/pull/8697/files#diff-9f09180c5d32d87f8c89fc0a8edc8d2153b37515dcf906123fbd8017c435fa75">+52/-0</a> </td> </tr> <tr> <td><strong>registry.ts</strong><dd><code>Context registry singleton with fallback</code> </dd></td> <td><a href="https://github.com/openobserve/openobserve/pull/8697/files#diff-771da8f6897a25741c485f6637da004e3a62f6e4b70d6dbb2a408a56ba9e3923">+136/-0</a> </td> </tr> <tr> <td><strong>types.ts</strong><dd><code>Context provider/core types</code> </dd></td> <td><a href="https://github.com/openobserve/openobserve/pull/8697/files#diff-f0c33d88011ac1afc87b85a1be56756616a2a13105537cf6f6a8090747b2beb3">+34/-0</a> </td> </tr> <tr> <td><strong>useAiChat.ts</strong><dd><code>Use structured context; add default provider init</code> </dd></td> <td><a href="https://github.com/openobserve/openobserve/pull/8697/files#diff-830ee4f21bdbbd0fa5c5c0f43b0a1d0200831e07ccddc91982cf0371c801b046">+62/-8</a> </td> </tr> <tr> <td><strong>main.ts</strong><dd><code>Initialize global default context provider</code> </dd></td> <td><a href="https://github.com/openobserve/openobserve/pull/8697/files#diff-37b29c5a3b76595194070205d9a0cdedcd717bf7c4367022d1e2667395962f2e">+5/-0</a> </td> </tr> <tr> <td><strong>PipelineEditor.vue</strong><dd><code>Register/cleanup pipelines context provider</code> </dd></td> <td><a href="https://github.com/openobserve/openobserve/pull/8697/files#diff-68c21f647336067eb79737ce9aca2d49632f2fa1c0878bcfdae55607e3473a15">+37/-0</a> </td> </tr> <tr> <td><strong>Index.vue</strong><dd><code>Register/cleanup logs context provider</code> </dd></td> <td><a href="https://github.com/openobserve/openobserve/pull/8697/files#diff-0323c3da69b369843c5d72bf4df5b00ca6b5147192a213baf331659ecf92af62">+42/-1</a> </td> </tr> <tr> <td><strong>ViewDashboard.vue</strong><dd><code>Register/cleanup dashboards context provider</code> </dd></td> <td><a href="https://github.com/openobserve/openobserve/pull/8697/files#diff-052badb6758aff09ceaf1645869b9ba96125e6a0ea21abb01a8ee0a40d6467f3">+16/-0</a> </td> </tr> <tr> <td><strong>AddPanel.vue</strong><dd><code>Register/cleanup context for add/edit panel</code> </dd></td> <td><a href="https://github.com/openobserve/openobserve/pull/8697/files#diff-c9632db1ad95af95aba10161bcbc7c5608318919f228637bdafae3f3a31267e8">+17/-0</a> </td> </tr> </table></details></td></tr><tr><td><strong>Bug fix</strong></td><td><details><summary>2 files</summary><table> <tr> <td><strong>O2AIChat.vue</strong><dd><code>Add auto-scroll control and event handling</code> </dd></td> <td><a href="https://github.com/openobserve/openobserve/pull/8697/files#diff-a6a125719a7b32b31b53fcfe05c12081d82c139a401699affdda0db8e73887e3">+22/-2</a> </td> </tr> <tr> <td><strong>AddAlert.vue</strong><dd><code>Avoid AI chat overlap; register alerts context</code> </dd></td> <td><a href="https://github.com/openobserve/openobserve/pull/8697/files#diff-7b426bb23e9ed0250c3877d6d97b099c42b2d20e22ddf4459915381b2233a0a8">+15/-2</a> </td> </tr> </table></details></td></tr></tr></tbody></table> </details> ___
117 lines
3.6 KiB
TypeScript
117 lines
3.6 KiB
TypeScript
// Copyright 2023 OpenObserve Inc.
|
|
//
|
|
// This program is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU Affero General Public License as published by
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
//
|
|
// This program is distributed in the hope that it will be useful
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU Affero General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU Affero General Public License
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
import { createApp } from "vue";
|
|
import { Notify, Dialog, Quasar, AppFullscreen } from "quasar";
|
|
import "quasar/src/css/index.sass";
|
|
import "@quasar/extras/roboto-font/roboto-font.css";
|
|
import "@quasar/extras/material-icons/material-icons.css";
|
|
|
|
import store from "./stores";
|
|
import App from "./App.vue";
|
|
import createRouter from "./router";
|
|
import i18n from "./locales";
|
|
import "./styles/quasar-overrides.scss";
|
|
import "./styles/tailwind.css";
|
|
import config from "./aws-exports";
|
|
import configService from "./services/config";
|
|
|
|
import { openobserveRum } from "@openobserve/browser-rum";
|
|
import { openobserveLogs } from "@openobserve/browser-logs";
|
|
import { useReo } from "./services/reodotdev_analytics";
|
|
import { contextRegistry, createDefaultContextProvider } from "./composables/contextProviders";
|
|
|
|
|
|
const app = createApp(App);
|
|
const router = createRouter(store);
|
|
|
|
app
|
|
.use(Quasar, {
|
|
plugins: {
|
|
Dialog,
|
|
Notify,
|
|
AppFullscreen,
|
|
},
|
|
})
|
|
.use(i18n);
|
|
|
|
// const router = createRouter(store);
|
|
app.use(store).use(router);
|
|
|
|
// Initialize default context provider globally
|
|
const defaultProvider = createDefaultContextProvider(router, store);
|
|
contextRegistry.register('default', defaultProvider);
|
|
|
|
const { reoInit } = useReo();
|
|
|
|
reoInit();
|
|
|
|
|
|
|
|
// app.use(SearchPlugin);
|
|
|
|
const getConfig = async () => {
|
|
await configService.get_config().then((res: any) => {
|
|
store.dispatch("setConfig", res.data);
|
|
config.enableAnalytics = res.data.telemetry_enabled.toString();
|
|
if (res.data.rum.enabled) {
|
|
const options = {
|
|
clientToken: res.data.rum.client_token,
|
|
applicationId: res.data.rum.application_id,
|
|
site: res.data.rum.site,
|
|
service: res.data.rum.service,
|
|
env: res.data.rum.env,
|
|
version: res.data.rum.version || "0.0.1",
|
|
organizationIdentifier: res.data.rum.organization_identifier,
|
|
insecureHTTP: res.data.rum.insecure_http || false,
|
|
apiVersion: res.data.rum.api_version || "v1",
|
|
};
|
|
|
|
openobserveRum.init({
|
|
applicationId: options.applicationId, // required, any string identifying your application
|
|
clientToken: options.clientToken,
|
|
site: options.site,
|
|
organizationIdentifier: options.organizationIdentifier,
|
|
service: options.service,
|
|
env: options.env,
|
|
version: options.version,
|
|
trackResources: true,
|
|
trackLongTasks: true,
|
|
trackUserInteractions: true,
|
|
apiVersion: options.apiVersion,
|
|
insecureHTTP: options.insecureHTTP,
|
|
});
|
|
|
|
openobserveLogs.init({
|
|
clientToken: options.clientToken,
|
|
site: options.site,
|
|
organizationIdentifier: options.organizationIdentifier,
|
|
service: options.service,
|
|
env: options.env,
|
|
version: options.version,
|
|
forwardErrorsToLogs: true,
|
|
insecureHTTP: options.insecureHTTP,
|
|
apiVersion: options.apiVersion,
|
|
});
|
|
|
|
openobserveRum.startSessionReplayRecording();
|
|
}
|
|
});
|
|
};
|
|
|
|
getConfig();
|
|
|
|
app.mount("#app");
|