UNPKG

@gsb-core/ai-assistant

Version:
133 lines (132 loc) 4.09 kB
/** * AI Chat related entity interfaces * * This file contains TypeScript interfaces that correspond to the GSB entity definitions * used for AI chat functionality. These interfaces are used to type data coming from * and going to the GSB backend. */ /** * LLM Provider enum * * Defines the supported LLM providers for AI chat integration. * Each provider may have different capabilities and configuration requirements. */ export declare enum LLMProvider { /** OpenAI API (ChatGPT, GPT-4, etc.) */ OpenAI = 1, /** Azure OpenAI Service */ OpenAIAzure = 2, /** HuggingFace Inference API */ HuggingFace = 4, /** Anthropic API (Claude models) */ Anthropic = 8 } /** * GSB AI Chat entity interface * * Represents an AI chat session with message history and configuration. * A chat can contain multiple messages and is associated with an LLM configuration. */ export interface GsbAiChat { /** Unique identifier for the chat */ id?: string; /** Title/name of the chat */ title?: string; /** The most recent user prompt */ prompt?: string; /** Messages in this chat (conversation history) */ messages?: GsbAiMessage[]; /** ID of the LLM configuration used for this chat */ configuration_id?: string; /** LLM configuration used for this chat */ configuration?: LlmConfiguration; /** Related report IDs and references */ estimation_id?: string; estimation?: any; competitor_id?: string; competitor?: any; customerfeedback_id?: string; customerfeedback?: any; scrumReport_id?: string; scrumReport?: any; diagramReport_id?: string; diagramReport?: any; /** Standard entity fields */ ownerTenant_id?: string; createdBy_id?: string; createdBy?: any; lastUpdatedBy_id?: string; lastUpdatedBy?: any; createDate?: Date; lastUpdateDate?: Date; } /** * GSB AI Message entity interface * * Represents a single message in an AI chat conversation. * Messages can be from the user (isSystem=false) or from the AI (isSystem=true). */ export interface GsbAiMessage { /** Unique identifier for the message */ id?: string; /** Optional title for the message */ title?: string; /** Message content/text */ content?: string; /** Full prompt with template processing (for user messages) */ fullPrompt?: string; /** Whether this is a system/AI message (true) or user message (false) */ isSystem?: boolean; /** Whether the user liked this message */ liked?: boolean; /** Whether the user disliked this message */ disliked?: boolean; /** ID of the chat this message belongs to */ chat_id?: string; /** Reference to the parent chat */ chat?: GsbAiChat; /** Standard entity fields */ ownerTenant_id?: string; createdBy_id?: string; createdBy?: any; lastUpdatedBy_id?: string; lastUpdatedBy?: any; createDate?: Date; lastUpdateDate?: Date; } /** * LLM Configuration entity interface * * Defines how to interact with an LLM provider, including templates, * provider settings, and context information. */ export interface LlmConfiguration { /** Unique identifier for the configuration */ id?: string; /** Title/name of the configuration */ title?: string; /** LLM provider to use */ provider?: LLMProvider; /** * Nunjucks template for prompt generation * Can include variables like {{ prompt }}, {{ entity.fieldName }}, etc. */ template?: string; /** Additional context information for the LLM */ context?: string; /** Provider-specific settings (model, temperature, etc.) */ settings?: any; /** Pre-defined system messages */ preMessages?: any; /** Test instance for this configuration */ testInstance?: any; /** Chats using this configuration */ chats?: GsbAiChat[]; /** Standard entity fields */ createdBy_id?: string; createdBy?: any; lastUpdatedBy_id?: string; lastUpdatedBy?: any; createDate?: Date; lastUpdateDate?: Date; }