mirror of
https://github.com/SigNoz/signoz.git
synced 2026-05-15 06:30:30 +01:00
* feat: add AI Assistant with interactive blocks for data visualization * feat: add AI Assistant with interactive blocks for data visualization * chore: format taglines for better readability in AIAssistantIconPreview * feat: add AI Assistant action block and speech recognition capabilities * feat: enhance voice input functionality and integrate streaming chat * feat: implement message feedback component and enhance message bubble styling * feat: enhance AI Assistant SSE event handling and markdown rendering Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: implement thread management and feedback submission in AI Assistant * feat: refactor AI Assistant state management to support per-conversation streaming * chore: remove unused icons and page * feat: introduce thinking step and message block structure in AI Assistant * refactor: update Tooltip imports to use @signozhq/ui across components * refactor: migrate button components to @signozhq/ui and update styles for consistency * feat: enhance home header layout with new HeaderRightSection component and updated styles * refactor: improve code readability and consistency * feat: integrate AI assistant feature with conditional routing and environment configuration * feat: update openapi.yml and improve ui * feat: add character limit warning to ChatInput component * feat: enhance AI Assistant button with pending user input badge and styles * feat: implement conversation archiving and restoration functionality in AI Assistant * feat: streamline AI Assistant UI components and improve styles * feat: add MessageContext interface and enhance message sending functionality in AI Assistant * feat: update AI Assistant styles and components to use new icon library and improve layout * feat: move to css modules * feat: enhance AI Assistant with new API integration and UI components * refactor: update AIAssistant components to use Button from Signoz UI and enhance styling * refactor: simplify action handling and enhance streaming message indicators * refactor: improve loading indicators in HistorySidebar component * refactor: enhance ConversationView loading state and improve action key stability * refactor: implement AIAssistant axios instance and enhance SSE authentication handling * refactor: support auto-derived contexts and enhance diff display functionality * refactor: enhance ChatInput component with improved overflow handling and context fetching logic * refactor: enhance AIAssistantModal and ConversationItem components with improved key handling and UI * refactor: streamline Spinner component and update ChatInput styles for improved UI consistency * feat: implement push-to-talk functionality in ChatInput for improved voice interaction * feat: add edit and resend functionality to user messages in ConversationView and ChatInput * feat: implement AI Assistant UI components for enhanced user interaction * feat: improve tool call instance rendering * feat: add accessibility attributes and feedback buttons to HeaderRightSection * chore: update openapi.yaml with improved formatting and structure for API documentation * feat: enhance AI Assistant components with new enums, improved clarification handling, code block * refactor: remove edit and resend functionality, streamline message handling * refactor: remove AI backend URL from environment variables * refactor: update styles and structure for MessageBubble, ThinkingStep, and ToolCallStep components * feat: enhance conversation item and history sidebar with search functionality and dropdown actions * feat: update AI Assistant UI components with new icons * feat: add displayText property to ToolCallBlock * feat: implement message regeneration functionality in AI Assistant * feat: pass comment for negative feedback * fix(frontend): position chat support around AI assistant * feat: add SigNoz URL header to AI Assistant requests for multi-tenant support * feat: add header actions to TraceDetailV2 for sharing and feedback * chore: remove hardcoded url * fix: skip custom AI block markers in language validation script * feat: implement AI API instance with request/response interceptors * feat: enhance AI Assistant conversation handling with hydration state * feat: implement SSE backoff strategy and error handling in AI Assistant * refactor: update color variables in AI Assistant styles for consistency and improved theming * chore: increase margin for title in Block component for improved spacing * chore: fmt * feat: use default domain url for X-SigNoz-URL * refactor: simplify AIAssistant enabled state management across components * refactor: replace HistorySidebar with ConversationsList component in AIAssistant * feat: improve css * feat: enhance voice input functionality with microphone permission handling * feat: add rule to enforce subpath imports for @signozhq/ui components * fix: renameConversation requires reload to render * refactor: update imports for @signozhq/ui components to use subpath imports * refactor: adjust imports for @signozhq/ui components to use specific subpath imports * chore: remove temp files * chore: remove temp files * chore: move types to ai assistant folder * chore: remove unused chart blocks from AI assistant Removes BarChart, LineChart, PieChart, and Timeseries block components along with the shared chartSetup and Chart.module.scss. These rendered hex-color literals outside the design-token system and weren't being emitted by any current response flow. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * feat: update header button color to use accent primary * chore: remove the rule files * chore: remove react chartjs * refactor: replace hardcoded radius values with CSS variables * chore: use css variable --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: makeavish <makeavish786@gmail.com>
117 lines
3.0 KiB
TypeScript
117 lines
3.0 KiB
TypeScript
import {
|
|
interceptorRejected,
|
|
interceptorsRequestBasePath,
|
|
interceptorsRequestResponse,
|
|
interceptorsResponse,
|
|
} from 'api';
|
|
import { ENVIRONMENT } from 'constants/env';
|
|
|
|
import axios, { AxiosError, AxiosRequestConfig } from 'axios';
|
|
|
|
// generated API Instance
|
|
const generatedAPIAxiosInstance = axios.create({
|
|
baseURL: ENVIRONMENT.baseURL,
|
|
});
|
|
|
|
let generatedAPIQueryKeyHeaderContext: Record<string, unknown> | undefined;
|
|
|
|
export const setGeneratedAPIQueryKeyHeaderContext = <THeaders extends object>(
|
|
headers?: THeaders,
|
|
): void => {
|
|
generatedAPIQueryKeyHeaderContext = headers
|
|
? { ...(headers as Record<string, unknown>) }
|
|
: undefined;
|
|
};
|
|
|
|
const hashHeaderValue = (value: string): string => {
|
|
let hash = 0;
|
|
|
|
for (let index = 0; index < value.length; index += 1) {
|
|
hash = (hash * 31 + value.charCodeAt(index)) >>> 0;
|
|
}
|
|
|
|
return hash.toString(16);
|
|
};
|
|
|
|
const mergeHeaderRecord = (
|
|
target: Record<string, unknown>,
|
|
source: unknown,
|
|
): Record<string, unknown> => {
|
|
if (!source || typeof source !== 'object') {
|
|
return target;
|
|
}
|
|
|
|
return Object.assign(target, source as Record<string, unknown>);
|
|
};
|
|
|
|
export const GeneratedAPIInstance = <T>(
|
|
config: AxiosRequestConfig,
|
|
): Promise<T> => {
|
|
return generatedAPIAxiosInstance({ ...config }).then(({ data }) => data);
|
|
};
|
|
|
|
generatedAPIAxiosInstance.interceptors.request.use(interceptorsRequestBasePath);
|
|
generatedAPIAxiosInstance.interceptors.request.use(interceptorsRequestResponse);
|
|
generatedAPIAxiosInstance.interceptors.request.use(interceptorsRequestBasePath);
|
|
generatedAPIAxiosInstance.interceptors.response.use(
|
|
interceptorsResponse,
|
|
interceptorRejected,
|
|
);
|
|
|
|
const getDefaultQueryKeyHeaders = (): Record<string, unknown> => {
|
|
const defaults = generatedAPIAxiosInstance.defaults
|
|
.headers as unknown as Record<string, unknown>;
|
|
const headers: Record<string, unknown> = {};
|
|
const methodKeys = new Set([
|
|
'common',
|
|
'delete',
|
|
'get',
|
|
'head',
|
|
'options',
|
|
'patch',
|
|
'post',
|
|
'put',
|
|
]);
|
|
|
|
mergeHeaderRecord(headers, defaults?.common);
|
|
mergeHeaderRecord(headers, defaults?.get);
|
|
|
|
for (const [key, value] of Object.entries(defaults ?? {})) {
|
|
if (!methodKeys.has(key)) {
|
|
headers[key] = value;
|
|
}
|
|
}
|
|
|
|
return headers;
|
|
};
|
|
|
|
export const getGeneratedAPIQueryKeyHeaders = <THeaders extends object>(
|
|
headers?: THeaders,
|
|
): [{ headers: Record<string, unknown> }] | [] => {
|
|
const mergedHeaders = {
|
|
...getDefaultQueryKeyHeaders(),
|
|
...generatedAPIQueryKeyHeaderContext,
|
|
...(headers as Record<string, unknown> | undefined),
|
|
};
|
|
|
|
const queryKeyHeaders = Object.fromEntries(
|
|
Object.entries(mergedHeaders)
|
|
.filter(([, value]) => value !== undefined)
|
|
.sort(([left], [right]) => left.localeCompare(right))
|
|
.map(([key, value]) => {
|
|
if (key.toLowerCase() === 'authorization' && typeof value === 'string') {
|
|
return [key, hashHeaderValue(value)];
|
|
}
|
|
|
|
return [key, value];
|
|
}),
|
|
);
|
|
|
|
return Object.keys(queryKeyHeaders).length
|
|
? [{ headers: queryKeyHeaders }]
|
|
: [];
|
|
};
|
|
|
|
export type ErrorType<Error> = AxiosError<Error>;
|
|
export type BodyType<BodyData> = BodyData;
|