diff --git a/.claude/settings.local.json b/.claude/settings.local.json index 505c1bca..d4252a5a 100644 --- a/.claude/settings.local.json +++ b/.claude/settings.local.json @@ -23,7 +23,9 @@ "mcp__playwright__browser_snapshot", "Bash(node -e \"JSON.parse\\(require\\(''fs''\\).readFileSync\\(''D:/Repos/Reveal/Documentation/i18n/en/code.json'',''utf8''\\)\\); console.log\\(''Valid JSON''\\)\")", "mcp__playwright__browser_wait_for", - "Bash(node -e \"JSON.parse\\(require\\(''fs''\\).readFileSync\\(''D:/Repos/Reveal/Documentation/i18n/ja/code.json'',''utf8''\\)\\); console.log\\(''Valid JSON''\\)\")" + "Bash(node -e \"JSON.parse\\(require\\(''fs''\\).readFileSync\\(''D:/Repos/Reveal/Documentation/i18n/ja/code.json'',''utf8''\\)\\); console.log\\(''Valid JSON''\\)\")", + "mcp__filesystem__list_directory_with_sizes", + "Bash(npx docusaurus clear)" ] } } diff --git a/docs/ai/_beta-message.md b/docs/ai/_beta-message.md deleted file mode 100644 index 1228a7e5..00000000 --- a/docs/ai/_beta-message.md +++ /dev/null @@ -1,5 +0,0 @@ -:::danger Product in Beta -The Reveal SDK AI features are currently in beta, and we welcome your feedback to help us improve for the final release. - -Please report any issues or suggestions through our support channels. -::: diff --git a/docs/ai/chat.md b/docs/ai/chat.md index 0e29c365..26d77fde 100644 --- a/docs/ai/chat.md +++ b/docs/ai/chat.md @@ -1,12 +1,9 @@ --- -sidebar_label: Chat +sidebar_label: Chat Endpoint --- -import BetaWarning from './_beta-message.md' - - -# AI Chat +# Chat Endpoint AI Chat transforms data analytics into a conversation. Instead of manually building dashboards or writing queries, users simply describe what they want to see or understand. The AI interprets the request, processes the data, and responds with insights, explanations, or generates/modifies dashboards automatically (based both on the current user message and the conversation history). @@ -26,11 +23,7 @@ The AI maintains conversation history, allowing follow-up questions and refineme --- -## Server API - -The Chat API provides endpoints for sending messages and managing conversation sessions. It supports two response modes: a plain JSON response for simple request/response workflows, and a streaming SSE response for real-time progress and text updates. - -### Endpoints +## Endpoints **Send Message** ``` @@ -39,10 +32,10 @@ POST /api/reveal/ai/chat **Clear Session** ``` -DELETE /api/reveal/ai/chat +DELETE /api/reveal/ai/chat/session ``` -### Request Format +## Request Format ```typescript { @@ -62,7 +55,7 @@ DELETE /api/reveal/ai/chat } ``` -#### Request Parameters +### Request Parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| @@ -80,9 +73,9 @@ DELETE /api/reveal/ai/chat - **`datasourceId`**: Required for all requests. Provides context about available data structures. - **`dashboard`**: Provide when editing existing dashboards or analyzing dashboard content. -### Response Format +## Response Format -#### Non-Streaming (default) +### Non-Streaming (default) When `stream` is `false` or omitted, the endpoint returns a plain JSON response: @@ -101,11 +94,11 @@ On error, the response includes an error message with the appropriate HTTP statu } ``` -#### Streaming +### Streaming When `stream` is `true`, the endpoint returns Server-Sent Events (SSE) with the following event types: -##### progress Event +#### progress Event Sent during processing to indicate current status. ```json @@ -119,17 +112,17 @@ Common progress messages: - "Adding filters to visualizations" - "Modifying visualization" -##### textchunk Event +#### text Event Contains fragments of the explanation text as it's generated. ```json -event: textchunk +event: text data: {"content": "Based on your data, I've created"} ``` Text chunks are delivered in ~8 word segments with 20ms delays for natural, ChatGPT-like streaming. -##### complete Event +#### complete Event Sent when processing finishes successfully. Always contains the full result. ```json @@ -147,7 +140,7 @@ data: { - `explanation`: Natural language explanation of what was done - `dashboard`: Generated or modified dashboard JSON (when applicable) -##### error Event +#### error Event Sent if processing fails. ```json @@ -155,7 +148,7 @@ event: error data: {"error": "Datasource not found"} ``` -### Conversation History +## Conversation History Chat maintains server-side conversation history per user and datasource. This enables contextual follow-up questions and iterative refinements. @@ -174,9 +167,9 @@ Chat maintains server-side conversation history per user and datasource. This en **Managing History:** -- **Clear history**: Send `DELETE /api/reveal/ai/chat` to reset the session +- **Clear history**: Send `DELETE /api/reveal/ai/chat/session` to reset the session -### Server-Side Implementation +## Server-Side Implementation The Chat endpoint is automatically registered when you configure Reveal AI in your ASP.NET Core application: @@ -193,7 +186,7 @@ builder.Services.AddControllers().AddReveal(revealBuilder => revealBuilder.AddDataSourceProvider(); }); -// Add Reveal AI - automatically registers /api/reveal/ai/chat endpoint +// Add Reveal AI - automatically registers chat endpoints builder.Services.AddRevealAI() .AddOpenAI(options => { @@ -209,395 +202,12 @@ app.Run(); No additional controller or routing configuration is needed. Both POST and DELETE endpoints are ready to use once you call `AddRevealAI()`. -### Metadata Configuration - -Chat requires a **metadata catalog** to understand your datasource structure. The catalog defines which datasources are available to the AI and how they are configured. - -The simplest approach is to define datasources in `appsettings.json`: - -```json title="appsettings.json" -{ - "RevealAI": { - "OpenAI": { - "ApiKey": "sk-your-api-key-here" - }, - "MetadataCatalog": { - "Datasources": [ - { - "Id": "SampleExcel", - "Provider": "WebService" - }, - { - "Id": "SqlServerData", - "Provider": "SQLServer" - } - ] - } - } -} -``` +## Metadata Configuration -The `datasourceId` parameter in chat requests must match an `Id` defined in your catalog. +Chat requires a **metadata catalog** to understand your datasource structure. The `datasourceId` parameter in chat requests must match an `Id` defined in your catalog. :::info -The metadata catalog supports multiple sources beyond `appsettings.json`, including external JSON files and custom providers (e.g., database-backed). See the [Metadata Catalog](metadata-catalog.md) topic for the full catalog schema, advanced configuration options, and examples. +See the [Metadata Catalog](./metadata-catalog.md) topic for the full catalog schema, configuration options, and examples. ::: - -**Clearing Session Example:** - -```csharp -// Client makes DELETE request to clear conversation -// DELETE /api/reveal/ai/chat -// Response: 204 No Content -``` - ---- - -## Client API - -The Reveal SDK AI Client provides a TypeScript API for conversational interactions from your web application. The `client.ai.chat.sendMessage()` method uses a single request object for all parameters and supports both non-streaming and streaming modes. - -### Non-Streaming (Default) - -Wait for the complete result before displaying. Returns `Promise`. - -```typescript -import { RevealSdkClient } from '@revealbi/api'; - -const client = RevealSdkClient.getInstance(); - -// Send a message and get the complete response -const response = await client.ai.chat.sendMessage({ - message: 'Show me sales trends for the last quarter', - datasourceId: 'my-datasource', -}); - -console.log(response.explanation); -// "I've analyzed your sales data for Q4 2024..." - -if (response.dashboard) { - // Load the generated dashboard - loadDashboard(response.dashboard); -} -``` - -### Streaming - -Add `stream: true` to the request to get an `AIStream` that yields events as they arrive. The stream supports three consumption patterns. - -#### Pattern 1: for-await (Full Control) - -```typescript -const stream = await client.ai.chat.sendMessage({ - message: 'Create a dashboard showing customer distribution by region', - datasourceId: 'my-datasource', - stream: true, -}); - -for await (const event of stream) { - switch (event.type) { - case 'progress': console.log('Status:', event.message); break; - case 'text': document.getElementById('chat-message').textContent += event.content; break; - case 'error': console.error('Error:', event.error); break; - } -} -``` - -#### Pattern 2: Event Listeners (Simple UI Wiring) - -```typescript -const stream = await client.ai.chat.sendMessage({ - message: 'Create a dashboard showing customer distribution by region', - datasourceId: 'my-datasource', - stream: true, -}); - -stream.on('progress', (message) => console.log('Status:', message)); -stream.on('text', (content) => { - document.getElementById('chat-message').textContent += content; -}); -stream.on('error', (error) => console.error('Error:', error)); - -const result = await stream.finalResponse(); -console.log('Complete:', result.explanation); - -if (result.dashboard) { - loadDashboard(result.dashboard); -} -``` - -#### Pattern 3: Aggregated Result from Stream - -```typescript -const stream = await client.ai.chat.sendMessage({ - message: 'Create a dashboard showing customer distribution by region', - datasourceId: 'my-datasource', - stream: true, -}); - -// Wait for completion, returns ChatResponse -const result = await stream.finalResponse(); -console.log(result.explanation); - -if (result.dashboard) { - loadDashboard(result.dashboard); -} -``` - -### Managing Conversation - -Clear the conversation history to start fresh: - -```typescript -// Reset the conversation context -await client.ai.chat.resetContext(); - -console.log('Conversation history cleared'); -``` - -Use this when: -- Starting a new topic -- Switching datasources -- User explicitly requests to "start over" - -### Dashboard Context - -Provide an existing dashboard for editing or analysis: - -```typescript -// Edit an existing dashboard -const response = await client.ai.chat.sendMessage({ - message: 'Add a date filter to this dashboard', - datasourceId: 'my-datasource', - dashboard: existingDashboardJson, // Provide current dashboard JSON -}); - -if (response.dashboard) { - // Load the modified dashboard - loadDashboard(response.dashboard); -} -``` - -**Using RVDashboard Objects:** - -```typescript -// From RevealView -const currentDashboard = revealView.dashboard; - -const response = await client.ai.chat.sendMessage({ - message: 'Explain what this dashboard shows', - datasourceId: 'my-datasource', - dashboard: currentDashboard, // Accepts RVDashboard object -}); - -console.log(response.explanation); -``` - -### Request Parameters - -All parameters are passed in a single request object: - -```typescript -// Non-streaming request -interface ChatRequest { - message: string; // User's natural language input (required) - datasourceId?: string; // Datasource identifier - dashboard?: string | RVDashboard; // Dashboard JSON or RVDashboard object - visualizationId?: string; // Visualization ID for visualization-specific context - intent?: string; // Intent for freeform LLM queries - updateChatState?: boolean; // Whether to update chat state - model?: string; // Override LLM model - signal?: AbortSignal; // For request cancellation - stream?: false; // Non-streaming (default) -} - -// Streaming request -interface ChatStreamRequest { - // ...same fields as above, plus: - stream: true; // Enable streaming -} -``` - -| Parameter | Type | Required | Description | -|-----------|------|----------|-------------| -| `message` | `string` | Yes | User's natural language message or request | -| `datasourceId` | `string` | No | Datasource identifier for context | -| `dashboard` | `string \| RVDashboard` | No | Dashboard JSON or RVDashboard object for editing/analysis | -| `visualizationId` | `string` | No | Visualization ID for visualization-specific context | -| `intent` | `string` | No | Intent for freeform LLM queries | -| `updateChatState` | `boolean` | No | Whether to update the chat state after this query | -| `model` | `string` | No | Name of specific LLM model to use | -| `signal` | `AbortSignal` | No | AbortSignal for cancelling the request | -| `stream` | `boolean` | No | Enable streaming mode (default: `false`) | - -### Response Types - -#### ChatResponse - -```typescript -interface ChatResponse { - explanation?: string; // AI-generated explanation - dashboard?: string; // Generated/modified dashboard JSON - error?: string; // Error message if request failed -} -``` - -The response contains an `explanation` field with the AI's natural language response. The `dashboard` field is populated when dashboards are generated or modified. - -#### AIStream (Streaming) - -When `stream: true`, the return type is `AIStream`, which provides: - -| Method / Pattern | Description | -|---------|-------------| -| `for await (const event of stream)` | Iterate over events as they arrive | -| `.on(event, handler)` | Register event-specific listeners | -| `.finalResponse()` | Returns a promise that resolves with the complete `ChatResponse` | -| `.abort()` | Cancel the stream | - -#### Stream Events - -```typescript -type AIStreamEvent = - | { type: 'progress'; message: string } - | { type: 'text'; content: string } - | { type: 'error'; error: string; details?: unknown }; -``` - -| Event Type | Description | -|------------|-------------| -| `progress` | Status messages during processing (e.g., "Creating a new dashboard") | -| `text` | Text fragments of the explanation as they are generated | -| `error` | Error information if processing fails | - ---- - -## Common Patterns - -### Building a Chat Interface - -Create a complete chat UI with message history and streaming: - -```typescript -const messages: Array<{role: 'user' | 'assistant', content: string}> = []; - -async function sendChatMessage(userInput: string) { - // Add user message to UI - messages.push({ role: 'user', content: userInput }); - renderMessages(); - - let currentMessage = ''; - - const stream = await client.ai.chat.sendMessage({ - message: userInput, - datasourceId: 'my-datasource', - stream: true, - }); - - stream.on('progress', (message) => { - showProgressIndicator(message); - }); - - stream.on('text', (content) => { - currentMessage += content; - // Update streaming message in UI - updateStreamingMessage(currentMessage); - scrollToBottom(); - }); - - stream.on('error', (error) => { - showError(error); - }); - - const result = await stream.finalResponse(); - - // Finalize message - messages.push({ role: 'assistant', content: currentMessage }); - renderMessages(); - - if (result.dashboard) { - loadDashboard(result.dashboard); - } - - hideProgressIndicator(); -} - -// Clear conversation -async function resetConversation() { - await client.ai.chat.resetContext(); - messages.length = 0; - renderMessages(); -} -``` - -### Error Handling - -Handle errors gracefully in both non-streaming and streaming modes: - -```typescript -// Non-streaming error handling -try { - const response = await client.ai.chat.sendMessage({ - message: 'Show me sales trends', - datasourceId: 'my-datasource', - }); - displayResponse(response.explanation); - - if (response.dashboard) { - loadDashboard(response.dashboard); - } -} catch (error) { - console.error('Chat request failed:', error); - showErrorMessage(error.message); -} - -// Streaming error handling -const stream = await client.ai.chat.sendMessage({ - message: 'Show me sales trends', - datasourceId: 'my-datasource', - stream: true, -}); - -stream.on('text', (content) => appendToUI(content)); -stream.on('error', (error, details) => { - console.error('Chat error:', error); - showErrorMessage(error); -}); - -const result = await stream.finalResponse(); - -if (result.dashboard) { - loadDashboard(result.dashboard); -} -``` - -### Request Cancellation - -Cancel an in-progress request using `AbortSignal`: - -```typescript -const controller = new AbortController(); - -// Non-streaming -const promise = client.ai.chat.sendMessage({ - message: 'Analyze my data', - datasourceId: 'my-datasource', - signal: controller.signal, -}); - -// Cancel after 5 seconds -setTimeout(() => controller.abort(), 5000); - -// Streaming -const stream = await client.ai.chat.sendMessage({ - message: 'Analyze my data', - datasourceId: 'my-datasource', - stream: true, - signal: controller.signal, -}); - -// Or abort the stream directly -stream.abort(); -``` diff --git a/docs/ai/getting-started-html.md b/docs/ai/getting-started-html.md index 8ae470e1..77067e11 100644 --- a/docs/ai/getting-started-html.md +++ b/docs/ai/getting-started-html.md @@ -2,9 +2,6 @@ sidebar_label: Getting Started - HTML/JavaScript --- -import BetaWarning from './_beta-message.md' - - # Getting Started with Reveal SDK AI - HTML/JavaScript @@ -17,8 +14,7 @@ This guide will walk you through creating your first AI-powered analytics applic A web application that: - Displays a Reveal dashboard - Adds AI-powered context menu items to the dashboard -- Generates three types of insights: Summary, Analysis, and Forecast -- Shows AI responses with optional streaming (ChatGPT-like experience) +- Generates AI insights (Summary, Analysis, and Forecast) ## Prerequisites @@ -54,6 +50,7 @@ Open `Program.cs` and replace its contents with: ```csharp title="Program.cs" using Reveal.Sdk; using Reveal.Sdk.AI; +using RevealAiServer.Reveal; var builder = WebApplication.CreateBuilder(args); @@ -66,8 +63,11 @@ builder.Services.AddCors(options => .AllowAnyMethod()); }); -// Add Reveal SDK -builder.Services.AddControllers().AddReveal(); +// Add Reveal SDK with data source provider +builder.Services.AddControllers().AddReveal(builder => +{ + builder.AddDataSourceProvider(); +}); // Add Reveal AI with OpenAI provider builder.Services.AddRevealAI() @@ -85,11 +85,6 @@ app.MapControllers(); app.Run(); ``` -That's it! Just three main steps: -1. Add CORS for local development -2. Add Reveal SDK with `AddReveal()` -3. Add AI services with `AddRevealAI()` and configure your LLM provider - ### 1.4 Configure Your API Key **Option A: Using appsettings.json** (not recommended for production) @@ -156,51 +151,6 @@ public class DataSourceProvider : IRVDataSourceProvider } ``` -Update `Program.cs` to register the provider: - -```csharp title="Program.cs" {16-19} -using Reveal.Sdk; -using Reveal.Sdk.AI; -using RevealAiServer.Reveal; - -var builder = WebApplication.CreateBuilder(args); - -builder.Services.AddCors(options => -{ - options.AddPolicy("AllowAll", - policy => policy.AllowAnyOrigin() - .AllowAnyHeader() - .AllowAnyMethod()); -}); - -// Add Reveal SDK with data source provider -builder.Services.AddControllers().AddReveal(builder => -{ - builder.AddDataSourceProvider(); -}); - -// Add Reveal AI with OpenAI provider -builder.Services.AddRevealAI() - .AddOpenAI(options => - { - options.ApiKey = builder.Configuration["RevealAI:OpenAI:ApiKey"]; - options.ModelId = "gpt-4.1"; - }); - -var app = builder.Build(); - -app.UseCors("AllowAll"); -app.MapControllers(); - -app.Run(); -``` - -:::info - -While AI insights don't directly require datasource configuration, the Reveal SDK itself needs a data source provider registered. In a real application, you'd already have this configured for your dashboards. - -::: - ### 1.6 Add the Sample Dashboard and Data Create the necessary folders in your project root: @@ -253,228 +203,66 @@ Create a new file `index.html` in your project root (or a separate `client` fold Reveal AI - Insights Demo - - - - - - - AI Insights - - - Stream Responses - - - - - Right-click on the dashboard or a visualization to generate AI insights. - Try "Summary", "Analysis", or "Forecast". - - - + Use the dashboard overflow menu and select an AI insight option. - - - - - - - - - - - - - - - ``` -または jsDelivr を使用: +または jsDelivr を使用する場合: ```html @@ -44,13 +41,13 @@ npm install @revealbi/api ## TypeScript サポート -AI クライアント SDK は TypeScript で記述されており、完全な型定義が含まれています。追加の `@types` パッケージは必要ありません。 +AI クライアント SDK は TypeScript で記述されており、完全な型定義を含んでいます。追加の `@types` パッケージは必要ありません。 -## フレームワーク固有のセットアップ +## フレームワーク別のセットアップ -### 素の JavaScript +### バニラ JavaScript -#### ES モジュールの使用 +#### ES Modules を使用する場合 ```html @@ -72,7 +69,7 @@ AI クライアント SDK は TypeScript で記述されており、完全な型 ``` -#### UMD バンドルの使用 +#### UMD バンドルを使用する場合 ```html @@ -95,7 +92,7 @@ AI クライアント SDK は TypeScript で記述されており、完全な型 ### Angular -`main.ts` ファイルで、アプリケーションをブートストラップする前に初期化します: +`main.ts` ファイルで、アプリケーションのブートストラップ前に初期化します: ```typescript import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; @@ -113,7 +110,7 @@ platformBrowserDynamic() ### React -`index.tsx` または `main.tsx` ファイルで、レンダリングする前に初期化します: +`index.tsx` または `main.tsx` ファイルで、レンダリング前に初期化します: ```typescript import React from 'react'; @@ -134,7 +131,7 @@ ReactDOM.createRoot(document.getElementById('root')!).render( ### Vue -`main.ts` ファイルで、アプリケーションをマウントする前に初期化します: +`main.ts` ファイルで、アプリケーションのマウント前に初期化します: ```typescript import { createApp } from 'vue'; diff --git a/i18n/ja/docusaurus-plugin-content-docs/current/ai/install-server-sdk.md b/i18n/ja/docusaurus-plugin-content-docs/current/ai/install-server-sdk.md index f569a4ab..8954af17 100644 --- a/i18n/ja/docusaurus-plugin-content-docs/current/ai/install-server-sdk.md +++ b/i18n/ja/docusaurus-plugin-content-docs/current/ai/install-server-sdk.md @@ -2,54 +2,51 @@ sidebar_label: サーバー SDK のインストール --- -import BetaWarning from './_beta-message.md' - - # AI サーバー SDK のインストール -Reveal SDK AI サーバーは、アプリケーションで AI 機能を強化するために必要なバックエンド サービスを提供します。LLM プロバイダーと統合し、インサイト生成、ダッシュボード作成、会話型分析などの AI 操作を管理します。 +Reveal SDK AI サーバーは、アプリケーションで AI 機能を動作させるために必要なバックエンドサービスを提供します。LLM プロバイダーと統合し、インサイト生成、ダッシュボード作成、会話型アナリティクスなどの AI 操作を管理します。 ## 前提条件 -AI サーバー SDK をインストールする前に、以下を確認してください: +AI サーバー SDK をインストールする前に、以下を確認してください: -1. 基本の [Reveal SDK サーバー](/web/install-server-sdk)がインストールされ、設定されていること -2. .NET 8.0 以上であること -3. 少なくとも 1 つの LLM プロバイダー (OpenAI、Anthropic、Google など) へのアクセス権があること -4. LLM プロバイダーの API キーが設定されていること +1. ベースの [Reveal SDK サーバー](/web/install-server-sdk) がインストールおよび設定済みであること +2. .NET 8.0 以上 +3. 少なくとも1つの LLM プロバイダー(OpenAI、Anthropic、Google など)へのアクセス +4. LLM プロバイダーの API キーが設定済みであること ## インストール方法 ### ASP.NET Core -ASP.NET Core 用 AI サーバー SDK は NuGet パッケージとして配布されています。 +ASP.NET Core 用の AI サーバー SDK は NuGet パッケージとして配布されています。 -#### 手順 1: NuGet パッケージのインストール +#### ステップ 1: NuGet パッケージのインストール -ソリューションまたはプロジェクトを右クリックし、ソリューションの **[NuGet パッケージの管理]** を選択します。 +ソリューションまたはプロジェクトを右クリックし、**Manage NuGet Packages** for Solution を選択します。  -パッケージ マネージャー ダイアログで **[参照]** タブを開き、**Reveal.Sdk.AI.AspNetCore** NuGet パッケージをプロジェクトにインストールします。 +パッケージマネージャーダイアログで **Browse** タブを開き、**Reveal.Sdk.AI.AspNetCore** NuGet パッケージをプロジェクトにインストールします。 **パッケージ名:** `Reveal.Sdk.AI.AspNetCore` -または、パッケージ マネージャー コンソールを使用する場合: +または Package Manager Console を使用する場合: ```bash Install-Package Reveal.Sdk.AI.AspNetCore ``` -または、.NET CLI を使用する場合: +または .NET CLI を使用する場合: ```bash dotnet add package Reveal.Sdk.AI.AspNetCore ``` -#### 手順 2: サービスの構成 +#### ステップ 2: サービスの設定 -`Program.cs` ファイルを開いて変更し、AI サービスを追加します。AI SDK は基本の Reveal SDK を拡張するため、両方を設定する必要があります: +`Program.cs` ファイルを開いて変更し、AI サービスを追加します。AI SDK はベースの Reveal SDK を拡張するため、両方の設定が必要です: ```csharp using Reveal.Sdk; @@ -57,21 +54,21 @@ using Reveal.Sdk.AI; var builder = WebApplication.CreateBuilder(args); -// Reveal SDK を追加 (必須) +// Add Reveal SDK (required) builder.Services.AddControllers().AddReveal(); -// Reveal AI サービスを追加 +// Add Reveal AI services builder.Services.AddRevealAI(); var app = builder.Build(); app.Run(); ``` -#### 手順 3: LLM プロバイダーの設定 +#### ステップ 3: LLM プロバイダーの設定 -少なくとも 1 つの LLM プロバイダーを設定します。`AddRevealAI()` の後にこの構成を追加します: +少なくとも1つの LLM プロバイダーを設定します。`AddRevealAI()` の後にこの設定を追加してください: -**OpenAI の場合:** +**OpenAI の場合:** ```csharp builder.Services.AddRevealAI() @@ -82,7 +79,7 @@ builder.Services.AddRevealAI() }); ``` -**Azure OpenAI の場合:** +**Azure OpenAI の場合:** ```csharp builder.Services.AddRevealAI() @@ -94,7 +91,7 @@ builder.Services.AddRevealAI() }); ``` -**Anthropic Claude の場合:** +**Anthropic Claude の場合:** ```csharp builder.Services.AddRevealAI() @@ -105,9 +102,9 @@ builder.Services.AddRevealAI() }); ``` -#### 手順 4: API キーを安全に保存 +#### ステップ 4: API キーの安全な保管 -LLM プロバイダーの API キーを `appsettings.json` またはユーザー シークレットに保存します: +LLM プロバイダーの API キーを `appsettings.json` または User Secrets に保存します: ```json title="appsettings.json" { @@ -125,13 +122,13 @@ LLM プロバイダーの API キーを `appsettings.json` またはユーザー :::danger API キーをコミットしないでください -API キーをソース管理にコミットしないでください。常にユーザー シークレット、環境変数、または安全なキー管理サービスを使用してください。 +API キーをソースコントロールにコミットしないでください。常に環境変数、User Secrets、または安全なキー管理サービスを使用してください。 ::: #### 完全な例 -AI 機能が設定された完全な `Program.cs` を次に示します: +AI 機能が設定された完全な `Program.cs` の例を以下に示します: ```csharp title="Program.cs" using Reveal.Sdk; @@ -139,7 +136,7 @@ using Reveal.Sdk.AI; var builder = WebApplication.CreateBuilder(args); -// クロスオリジン リクエスト用の CORS を追加 +// Add CORS for cross-origin requests builder.Services.AddCors(options => { options.AddDefaultPolicy(policy => @@ -150,7 +147,7 @@ builder.Services.AddCors(options => }); }); -// ベース Reveal SDK を追加 +// Add base Reveal SDK builder.Services.AddControllers().AddReveal(revealBuilder => { revealBuilder.AddSettings(settings => @@ -159,7 +156,7 @@ builder.Services.AddControllers().AddReveal(revealBuilder => }); }); -// OpenAI プロバイダーで Reveal AI を追加 +// Add Reveal AI with OpenAI provider builder.Services.AddRevealAI() .AddOpenAI(options => { @@ -175,39 +172,39 @@ app.MapControllers(); app.Run(); ``` -### Node.js (近日公開) +### Node.js(近日公開) -AI サーバー SDK の Node.js サポートは開発中であり、今後のリリースで利用可能になる予定です。 +AI サーバー SDK の Node.js サポートは現在開発中であり、将来のリリースで提供される予定です。 -現時点では、AI 機能には ASP.NET Core が推奨されるサーバー プラットフォームです。 +現時点では、AI 機能には ASP.NET Core が推奨サーバープラットフォームです。 -### Java (近日公開) +### Java(近日公開) -AI サーバー SDK の Java サポートは開発中であり、今後のリリースで利用可能になる予定です。 +AI サーバー SDK の Java サポートは現在開発中であり、将来のリリースで提供される予定です。 -現時点では、AI 機能には ASP.NET Core が推奨されるサーバー プラットフォームです。 +現時点では、AI 機能には ASP.NET Core が推奨サーバープラットフォームです。 ## インストールの確認 -インストール後、AI SDK が正しく設定されていることを確認します: +インストール後、AI SDK が正しく設定されていることを確認します: -### 手順 1: アプリケーションの実行 +### ステップ 1: アプリケーションの実行 ```bash dotnet run ``` -### 手順 2: AI エンドポイントの確認 +### ステップ 2: AI エンドポイントの確認 -AI SDK は `/api/reveal/ai/` の下にいくつかのエンドポイントを追加します: +AI SDK は `/api/reveal/ai/` 配下にいくつかのエンドポイントを追加します: -プロバイダー エンドポイントをテストします: +プロバイダーエンドポイントをテストします: ```bash curl http://localhost:5000/api/reveal/ai/providers ``` -期待されるレスポンス: +期待されるレスポンス: ```json { "providers": ["openai", "anthropic"] diff --git a/i18n/ja/docusaurus-plugin-content-docs/current/ai/metadata-catalog.md b/i18n/ja/docusaurus-plugin-content-docs/current/ai/metadata-catalog.md index 93c2250a..af84c7a7 100644 --- a/i18n/ja/docusaurus-plugin-content-docs/current/ai/metadata-catalog.md +++ b/i18n/ja/docusaurus-plugin-content-docs/current/ai/metadata-catalog.md @@ -1,36 +1,33 @@ --- -sidebar_label: メタデータ カタログ +sidebar_label: メタデータカタログ --- -import BetaWarning from './_beta-message.md' - +# メタデータカタログ -# メタデータ カタログ - -**メタデータ カタログ**は、Reveal SDK AI で使用可能なデータ ソースの中央定義です。各データ接続の存在、使用するプロバイダー、およびオプションのデータベース、テーブル、フィールドの説明を AI に伝えます。**チャット**と**メタデータ サービス**の両方の機能が、データの全体像を理解するためにカタログに依存しています。 +**メタデータカタログ**は、Reveal SDK AI で利用可能なデータソースの中心的な定義です。AI に対して、どのようなデータ接続が存在し、各接続がどのプロバイダーを使用し、オプションでそのデータベース、テーブル、フィールドを記述します。**チャット**と**メタデータサービス**の両機能は、データの全体像を理解するためにカタログに依存しています。 ## 仕組み -メタデータ システムには 3 つの異なる責務があります: +メタデータシステムには、3つの異なる責務があります: -| 対象 | 構成セクション | 目的 | -|---------|---------------|---------| -| **メタデータ カタログ** | `RevealAI:MetadataCatalog` | どのデータ ソースが存在し、どのように構成されているか | -| **メタデータ マネージャー** | `RevealAI:MetadataManager` | 生成されたメタデータ ファイルがディスクに書き込まれる場所 | -| **メタデータ サービス** | `RevealAI:MetadataService` | メタデータ生成がいつ実行されるか (起動時、スケジュール) | +| 関心事 | 目的 | +|---------|---------| +| **メタデータカタログ** | どのデータソースが存在し、どのような構造になっているか | +| **メタデータマネージャー** | 生成されたメタデータファイルがディスク上のどこに書き込まれるか | +| **メタデータサービス** | メタデータ生成がいつ実行されるか(起動時、スケジュール) | -**カタログ**は、構成が必要な唯一の要素です。マネージャーとサービスには適切なデフォルト値があり、オプションです。 +設定が必要なのは**カタログ**のみです。マネージャーとサービスには適切なデフォルト値があり、設定は任意です。 --- -## カタログ スキーマ +## カタログスキーマ -カタログは、`Datasources` 配列を持つ JSON オブジェクトです。各エントリは、プロバイダーとオプションのスキーマ詳細を含むデータ ソースを定義します。 +カタログは `Datasources` 配列を持つ JSON オブジェクトです。各エントリは、プロバイダーとオプションのスキーマ詳細を含むデータソースを定義します。 -### 最小限のサンプル +### 最小限の例 -最低限、各データ ソースには `Id` と `Provider` が必要です: +最低限、各データソースには `Id` と `Provider` が必要です: ```json { @@ -75,41 +72,41 @@ import BetaWarning from './_beta-message.md' } ``` -### スキーマ リファレンス +### スキーマリファレンス -#### データ ソース +#### データソース -| プロパティ | タイプ | 必須 | 説明 | +| プロパティ | 型 | 必須 | 説明 | |----------|------|----------|-------------| -| `Id` | string | はい | データ ソースの一意の識別子。API リクエストで `datasourceId` として使用されます。 | -| `Provider` | string | はい | データ プロバイダー タイプ (下記の[プロバイダー タイプ](#プロバイダー-タイプ)を参照) | -| `Databases` | array | いいえ | このデータ ソースで使用可能なデータベース スキーマのリスト | +| `Id` | string | はい | データソースの一意の識別子。API リクエストで `datasourceId` として使用されます。 | +| `Provider` | string | はい | データプロバイダーの種類(以下の[プロバイダータイプ](#provider-types)を参照) | +| `Databases` | array | いいえ | このデータソースで利用可能なデータベーススキーマのリスト | #### データベース -| プロパティ | タイプ | 必須 | 説明 | +| プロパティ | 型 | 必須 | 説明 | |----------|------|----------|-------------| | `Name` | string | はい | データベースの名前 | -| `DiscoveryMode` | string | いいえ | `"Default"` (すべてのテーブルを検出) または `"Restricted"` (一覧表示されたテーブルのみ)。デフォルトは `"Default"`。 | -| `Tables` | array | いいえ | このデータベースのテーブル スキーマのリスト | +| `DiscoveryMode` | string | いいえ | `"Default"`(すべてのテーブルを検出)または `"Restricted"`(リストされたテーブルのみ)。デフォルトは `"Default"` です。 | +| `Tables` | array | いいえ | このデータベース内のテーブルスキーマのリスト | #### テーブル -| プロパティ | タイプ | 必須 | 説明 | +| プロパティ | 型 | 必須 | 説明 | |----------|------|----------|-------------| -| `Name` | string | はい | 完全修飾テーブル名 (例: `"dbo.Orders"`) | -| `Description` | string | いいえ | テーブルの内容を AI が理解するのに役立つ説明。 | -| `Fields` | array | いいえ | このテーブルのフィールド スキーマのリスト | +| `Name` | string | はい | 完全修飾テーブル名(例: `"dbo.Orders"`) | +| `Description` | string | いいえ | 人間が読める説明。テーブルの内容を AI が理解するのに役立ちます。 | +| `Fields` | array | いいえ | このテーブル内のフィールドスキーマのリスト | #### フィールド -| プロパティ | タイプ | 必須 | 説明 | +| プロパティ | 型 | 必須 | 説明 | |----------|------|----------|-------------| -| `Name` | string | はい | データベースの実際の列名 | -| `Alias` | string | いいえ | フィールドの表示エイリアス (例: `"OrderDate"` に対する `"Order Date"`) | -| `Description` | string | いいえ | フィールドが何を表すかを AI が理解するのに役立つ説明。 | +| `Name` | string | はい | データベース内の実際のカラム名 | +| `Alias` | string | いいえ | フィールドの表示エイリアス(例: `"OrderDate"` に対して `"Order Date"`) | +| `Description` | string | いいえ | 人間が読める説明。フィールドが何を表しているかを AI が理解するのに役立ちます。 | -### プロバイダー タイプ +### プロバイダータイプ {#provider-types} 一般的なプロバイダー値: @@ -118,10 +115,10 @@ import BetaWarning from './_beta-message.md' | `SQLServer` | Microsoft SQL Server | | `PostgreSQL` | PostgreSQL | | `MySQL` | MySQL | -| `Oracle` | Oracle (サービス名) | -| `OracleSID` | Oracle (SID) | +| `Oracle` | Oracle(サービス名) | +| `OracleSID` | Oracle(SID) | | `SSAS` | SQL Server Analysis Services | -| `SSASHTTP` | SQL Server Analysis Services (HTTP) | +| `SSASHTTP` | SQL Server Analysis Services(HTTP) | | `Snowflake` | Snowflake | | `BigQuery` | Google BigQuery | | `AmazonAthena` | Amazon Athena | @@ -131,47 +128,15 @@ import BetaWarning from './_beta-message.md' --- -## カタログ ソース - -デフォルトでは、カタログは `appsettings.json` から読み込まれます。ソースをディスク上の JSON ファイルや完全なカスタム プロバイダー (データベースなど) に変更できます。 - -### オプション 1: appsettings.json (デフォルト) - -`appsettings.json` の `RevealAI:MetadataCatalog` セクションでデータ ソースを直接定義します。最も簡単なオプションで、追加の構成は不要です。 - -```json title="appsettings.json" -{ - "RevealAI": { - "OpenAI": { - "ApiKey": "sk-your-api-key-here" - }, - "MetadataCatalog": { - "Datasources": [ - { - "Id": "NorthwindDB", - "Provider": "SQLServer" - }, - { - "Id": "AnalyticsExcel", - "Provider": "WebService" - } - ] - } - } -} -``` +## カタログソース -```csharp title="Program.cs" -// 追加の構成は不要 — appsettings がデフォルトのソースです -builder.Services.AddRevealAI() - .AddOpenAI(); -``` +カタログは、ディスク上の JSON ファイルから読み込むか、完全なカスタムプロバイダー(例: データベースバックエンド)から読み込むことができます。 -### オプション 2: ディスク上の JSON ファイル +### オプション 1: ディスク上の JSON ファイル -カタログをスタンドアロンの JSON ファイルに保存します。データ ソース定義をアプリケーション設定とは別に管理したい場合、環境間で共有したい場合、または CI/CD パイプラインから生成したい場合に便利です。 +カタログを独立した JSON ファイルに保存します。これは最もシンプルなアプローチで、データソース定義をアプリケーション設定とは別に管理したい場合、環境間で共有したい場合、または CI/CD パイプラインから生成したい場合に便利です。 -**1. カタログ ファイルを作成:** +**1. カタログファイルの作成:** ```json title="config/catalog.json" { @@ -203,13 +168,13 @@ builder.Services.AddRevealAI() .AddOpenAI(); ``` -絶対パスと相対パスの両方がサポートされています。相対パスは、アプリケーションの現在の作業ディレクトリに対して解決されます。 +絶対パスと相対パスの両方がサポートされています。相対パスはアプリケーションの現在の作業ディレクトリを基準に解決されます。 -### オプション 3: カスタム プロバイダー +### オプション 2: カスタムプロバイダー -`IMetadataCatalogProvider` を実装して、データベース、API、キー ボールト、またはその他のソースからデータ ソース定義を読み込みます。 +`IMetadataCatalogProvider` を実装して、任意のソース(データベース、API、キー保管庫など)からデータソース定義を読み込みます。 -**1. インターフェイスを実装:** +**1. インターフェースの実装:** ```csharp title="DatabaseCatalogProvider.cs" using Reveal.Sdk.AI.Metadata.Catalog; @@ -239,7 +204,7 @@ public class DatabaseCatalogProvider : IMetadataCatalogProvider } ``` -**2. プロバイダーを登録:** +**2. プロバイダーの登録:** ```csharp title="Program.cs" builder.Services.AddRevealAI() @@ -247,13 +212,13 @@ builder.Services.AddRevealAI() .AddOpenAI(); ``` -プロバイダー クラスは依存関係の注入 (DI) を通じて解決されるため、コンストラクターで必要なサービスを注入できます。 +プロバイダークラスは依存性注入を通じて解決されるため、コンストラクタで必要なサービスを注入できます。 --- -## メタデータ マネージャー オプション +## メタデータマネージャーオプション -**メタデータ マネージャー**は、生成されたメタデータ ファイルがディスクに書き込まれる場所を制御します。これらのファイルは一時的なもので、自動的に生成され、いつでも再生成できます。 +**メタデータマネージャー**は、生成されたメタデータファイルがディスク上のどこに書き込まれるかを制御します。これらのファイルは一時的なものであり、自動的に生成され、いつでも再生成できます。 ```json title="appsettings.json" { @@ -265,15 +230,15 @@ builder.Services.AddRevealAI() } ``` -| プロパティ | タイプ | 必須 | 説明 | +| プロパティ | 型 | 必須 | 説明 | |----------|------|----------|-------------| -| `OutputPath` | string | いいえ | 生成されたメタデータ ファイルが保存されるディレクトリ。デフォルトは `{user-home}/reveal/ai/metadata`。 | +| `OutputPath` | string | いいえ | 生成されたメタデータファイルが保存されるディレクトリ。デフォルトは `{user-home}/reveal/ai/metadata` です。 | --- -## メタデータ サービス オプション +## メタデータサービスオプション -**メタデータ サービス**は、メタデータが生成されるタイミングを制御します。アプリケーションの起動時、定期的なスケジュール、またはその両方で生成をトリガーできます。 +**メタデータサービス**は、メタデータがいつ生成されるかを制御します。アプリケーション起動時、定期的なスケジュール、またはその両方で生成をトリガーできます。 ```json title="appsettings.json" { @@ -286,55 +251,58 @@ builder.Services.AddRevealAI() } ``` -| プロパティ | タイプ | 必須 | 説明 | +| プロパティ | 型 | 必須 | 説明 | |----------|------|----------|-------------| -| `GenerateOnStartup` | boolean | いいえ | `true` の場合、アプリケーションの起動時にメタデータを生成します。デフォルトは `false`。 | -| `CronSchedule` | string | いいえ | 定期的なメタデータ生成の Cron 式 (例: `"0 0 * * *"` は毎日深夜)。 | +| `GenerateOnStartup` | boolean | いいえ | `true` の場合、アプリケーション起動時にメタデータを生成します。デフォルトは `false` です。 | +| `CronSchedule` | string | いいえ | 定期的なメタデータ生成のための Cron 式(例: 毎日深夜に実行する場合は `"0 0 * * *"`)。 | --- -## 完全な構成サンプル +## 完全な設定例 -3 つのセクションすべてを含む完全な `appsettings.json` を以下に示します: +カタログファイル、マネージャーとサービスオプション用の `appsettings.json`、および `Program.cs` のセットアップを示す完全な例を以下に示します: -```json title="appsettings.json" +```json title="config/catalog.json" { - "RevealAI": { - "OpenAI": { - "ApiKey": "sk-your-api-key-here" - }, - "MetadataCatalog": { - "Datasources": [ + "Datasources": [ + { + "Id": "NorthwindDB", + "Provider": "SQLServer", + "Databases": [ { - "Id": "NorthwindDB", - "Provider": "SQLServer", - "Databases": [ + "Name": "Northwind", + "DiscoveryMode": "Restricted", + "Tables": [ { - "Name": "Northwind", - "DiscoveryMode": "Restricted", - "Tables": [ - { - "Name": "dbo.Orders", - "Description": "Customer purchase orders", - "Fields": [ - { "Name": "OrderDate", "Alias": "Order Date", "Description": "Date the order was placed" }, - { "Name": "ShipCountry", "Alias": "Ship Country" } - ] - }, - { - "Name": "dbo.Customers", - "Description": "Customer contact information" - } + "Name": "dbo.Orders", + "Description": "Customer purchase orders", + "Fields": [ + { "Name": "OrderDate", "Alias": "Order Date", "Description": "Date the order was placed" }, + { "Name": "ShipCountry", "Alias": "Ship Country" } ] + }, + { + "Name": "dbo.Customers", + "Description": "Customer contact information" } ] - }, - { - "Id": "SalesExcel", - "Provider": "WebService" } ] }, + { + "Id": "SalesExcel", + "Provider": "WebService" + } + ] +} +``` + +```json title="appsettings.json" +{ + "RevealAI": { + "OpenAI": { + "ApiKey": "sk-your-api-key-here" + }, "MetadataManager": { "OutputPath": "D:\\metadata\\output" }, @@ -348,7 +316,6 @@ builder.Services.AddRevealAI() ```csharp title="Program.cs" builder.Services.AddRevealAI() + .UseMetadataCatalogFile("config/catalog.json") .AddOpenAI(); ``` - -追加のコードは不要です。カタログ、マネージャー、サービスはすべて `appsettings.json` から自動的に構成されます。 diff --git a/i18n/ja/docusaurus-plugin-content-docs/current/ai/overview.md b/i18n/ja/docusaurus-plugin-content-docs/current/ai/overview.md index a3924d53..eab65079 100644 --- a/i18n/ja/docusaurus-plugin-content-docs/current/ai/overview.md +++ b/i18n/ja/docusaurus-plugin-content-docs/current/ai/overview.md @@ -2,70 +2,44 @@ sidebar_label: 概要 --- -import BetaWarning from './_beta-message.md' - - # Reveal SDK AI の概要 -Reveal SDK AI は、Reveal BI アプリケーションに強力な人工知能機能を追加し、ユーザーがインサイトを取得し、ダッシュボードを生成し、自然言語を通じてデータとやり取りできるようにします。 +Reveal SDK AI は、Reveal BI アプリケーションに強力な人工知能機能を追加し、ユーザーが自然言語を通じてインサイトを取得しデータと対話できるようにします。 -## Reveal SDK AI とは? +## Reveal SDK AI とは? -Reveal SDK AI は、大規模言語モデル (LLM) を統合して以下の機能を提供する Reveal SDK の拡張機能です: +Reveal SDK AI は、大規模言語モデル(LLM)を統合して以下の機能を提供する Reveal SDK の拡張機能です: -- **AI 生成インサイト**: ダッシュボードと表示形式の要約、分析、予測を自動的に生成します -- **自然言語によるダッシュボードの生成**: プレーン言語で必要なものを説明してダッシュボードを作成します -- **会話分析**: データに基づき、チャットで情報を探索、分析、視覚化します -- **スマート データ ディスカバリー**: AI を活用したデータ ソースの探索とメタデータの理解 +- **AI 生成インサイト**: ダッシュボードやビジュアライゼーションのサマリー、分析、予測を自動的に生成します +- **会話型アナリティクス**: データとチャットして、情報の探索、分析、可視化を行います -## 主要機能 +## 主な機能 ### AI インサイト -3 つのタイプの分析でデータからインテリジェントなインサイトを生成します: - -- **要約**: データが示す内容を簡潔に説明します -- **解析**: トレンド、パターン、異常の詳細な解釈を受け取ります -- **予測**: 履歴データに基づいて将来の値を予測します - -すべてのインサイトは、ChatGPT のようなユーザー エクスペリエンスのためにリアルタイムでストリーミングできます。 - -### ダッシュボードの生成 - -ユーザーは、見たいものを説明するだけで完全なダッシュボードを生成できます: - -```typescript -const response = await client.ai.dashboards.generate({ - userPrompt: 'Show me sales by region with a trend over time', - datasourceId: 'my-datasource' -}); -``` - -AI はデータ ソース スキーマを分析し、適切な表示形式を自動的に作成します。 +3種類の分析により、データからインテリジェントなインサイトを生成します: -### ダッシュボードの編集 +- **サマリー**: データが示す内容の簡潔な説明を取得します +- **分析**: トレンド、パターン、異常値の詳細な解釈を受け取ります +- **予測**: 過去のデータに基づいて将来の値を予測します -自然言語を使用して既存のダッシュボードを変更します: - -- **コンテンツの編集**: 表示形式を追加、削除、または変更します -- **フィルターの編集**: 表示形式レベルまたはグローバル フィルターを調整します -- **ダッシュボードの説明**: AI によって生成されたダッシュボード コンテンツの説明を取得します +すべてのインサイトは、ChatGPT のようなユーザーエクスペリエンスを実現するために、リアルタイムでストリーミングできます。 ### 会話型 AI チャット -ユーザーによる以下の操作を実行できるチャット インターフェイスを構築します: +ユーザーが以下のことを行えるチャットインターフェースを構築します: -- 自然言語でデータに関する質問をします -- 即座にダッシュボードと表示形式の結果を取得します -- フォローアップ質問のために会話コンテキストを維持します -- リアルタイムでレスポンスをストリーミングします +- 自然言語でデータに関する質問をする +- 会話を通じてダッシュボードを生成・変更する +- フォローアップの質問のために会話コンテキストを維持する +- レスポンスをリアルタイムでストリーミングする ### 柔軟な API パターン -ユースケースに適したパターンを選択します: +ユースケースに合ったパターンを選択できます: -**Await パターン** - シンプルで分かりやすい: +**Await パターン** - シンプルで直感的: ```typescript const result = await client.ai.insights.get({ dashboardId: 'sales-dashboard', @@ -74,51 +48,48 @@ const result = await client.ai.insights.get({ console.log(result.explanation); ``` -**Streaming パターン** - リアルタイム更新: +**ストリーミングパターン** - リアルタイム更新: ```typescript -const result = await client.ai.insights.get( - { - dashboardId: 'sales-dashboard', - insightType: InsightType.Summary - }, - { - onTextChunk: (chunk) => { - // 到着したテキストを表示 - console.log(chunk); - }, - onComplete: (message, result) => { - console.log('Complete!'); - } - }, - { streamExplanation: true } -); +const stream = await client.ai.insights.get({ + dashboardId: 'sales-dashboard', + insightType: InsightType.Summary, + stream: true, +}); + +stream.on('text', (content) => { + // Display text as it arrives + console.log(content); +}); + +const result = await stream.finalResponse(); +console.log('Complete!'); ``` -## アーキテクチャー +## アーキテクチャ -Reveal SDK AI は 2 つの主要コンポーネントで構成されています: +Reveal SDK AI は2つの主要コンポーネントで構成されています: ### クライアント SDK (TypeScript/JavaScript) -クライアント SDK は Web アプリケーションで実行され、以下を提供します: +クライアント SDK はウェブアプリケーション内で動作し、以下を提供します: -- シンプルな初期化と構成 +- シンプルな初期化と設定 - すべての AI 操作に対する型安全な API -- Server-Sent Events (SSE) による組み込みストリーミング サポート -- リクエストのキャンセルとエラー処理 +- Server-Sent Events (SSE) による組み込みストリーミングサポート +- リクエストのキャンセルとエラーハンドリング ### サーバー SDK (ASP.NET Core) -サーバー SDK は以下を処理します: +サーバー SDK は以下を処理します: -- LLM プロバイダーとの統合 (OpenAI、Anthropic、Google など) -- データ ソース メタデータの生成とキャッシュ -- インテント ベースの LLM ルーティング +- LLM プロバイダーの統合 (OpenAI、Anthropic、Google など) +- データソースメタデータの生成とキャッシング +- インテントベースの LLM ルーティング - 会話型 AI のコンテキスト管理 - セキュリティと認証 -## ベータ版の状態 +## ベータ版について -Reveal SDK AI は現在ベータ版です。コア機能は安定しており開発の準備ができていますが、ユーザーのフィードバックに基づいて API が進化する可能性があります。ぜひお試しいただき、体験を共有してください。 +Reveal SDK AI は現在ベータ版です。コア機能は安定しており開発に使用できますが、ユーザーのフィードバックに基づいて API が変更される可能性があります。ぜひお試しいただき、ご感想をお聞かせください。 -インテリジェントな分析エクスペリエンスを一緒に構築しましょう! +一緒にインテリジェントなアナリティクス体験を構築しましょう! diff --git a/i18n/ja/docusaurus-plugin-content-docs/current/ai/sdk-chat.md b/i18n/ja/docusaurus-plugin-content-docs/current/ai/sdk-chat.md new file mode 100644 index 00000000..cf344d02 --- /dev/null +++ b/i18n/ja/docusaurus-plugin-content-docs/current/ai/sdk-chat.md @@ -0,0 +1,113 @@ +--- +sidebar_label: チャット +--- + + +# チャット + +`client.ai.chat.sendMessage()` メソッドは、会話型アナリティクスを実現します。ユーザーが見たいものや理解したいことを自然言語で記述すると、AI がインサイト、説明、またはダッシュボードの生成・変更で応答します。 + +## 基本的な使い方 + +```typescript +import { RevealSdkClient } from '@revealbi/api'; + +const client = RevealSdkClient.getInstance(); + +// Send a message and get the complete response +const response = await client.ai.chat.sendMessage({ + message: 'Show me sales trends for the last quarter', + datasourceId: 'my-datasource', +}); + +console.log(response.explanation); +// "I've analyzed your sales data for Q4 2024..." + +if (response.dashboard) { + // Load the generated dashboard + loadDashboard(response.dashboard); +} +``` + +## 会話の管理 + +AI はサーバー側で会話履歴を保持しており、文脈に沿ったフォローアップの質問が可能です。履歴をクリアして最初からやり直すことができます。 + +```typescript +// Reset the conversation context +await client.ai.chat.resetContext(); + +console.log('Conversation history cleared'); +``` + +以下の場合に使用します: +- 新しいトピックを開始するとき +- データソースを切り替えるとき +- ユーザーが明示的に「最初からやり直す」ことをリクエストしたとき + +## ダッシュボードコンテキスト + +編集や分析のために既存のダッシュボードを提供します。 + +```typescript +// Edit an existing dashboard +const response = await client.ai.chat.sendMessage({ + message: 'Add a date filter to this dashboard', + datasourceId: 'my-datasource', + dashboard: existingDashboardJson, // Provide current dashboard JSON +}); + +if (response.dashboard) { + // Load the modified dashboard + loadDashboard(response.dashboard); +} +``` + +**RVDashboard オブジェクトの使用:** + +```typescript +// From RevealView +const currentDashboard = revealView.dashboard; + +const response = await client.ai.chat.sendMessage({ + message: 'Explain what this dashboard shows', + datasourceId: 'my-datasource', + dashboard: currentDashboard, // Accepts RVDashboard object +}); + +console.log(response.explanation); +``` + +## ストリーミング + +任意のリクエストに `stream: true` を追加すると、レスポンスをリアルタイムで受信できます。利用パターンと例については、[ストリーミングレスポンス](./sdk-streaming.md) を参照してください。 + +--- + +## リクエストパラメーター + +すべてのパラメーターは単一のリクエストオブジェクトで渡します。 + +| パラメーター | 型 | 必須 | 説明 | +|-----------|------|----------|-------------| +| `message` | `string` | はい | ユーザーの自然言語メッセージまたはリクエスト | +| `datasourceId` | `string` | いいえ | コンテキスト用のデータソース識別子 | +| `dashboard` | `string \| RVDashboard` | いいえ | 編集・分析用のダッシュボード JSON または RVDashboard オブジェクト | +| `visualizationId` | `string` | いいえ | ビジュアライゼーション固有のコンテキスト用のビジュアライゼーション ID | +| `intent` | `string` | いいえ | 自由形式の LLM クエリ用のインテント | +| `updateChatState` | `boolean` | いいえ | このクエリの後にチャットの状態を更新するかどうか | +| `model` | `string` | いいえ | 使用する特定の LLM モデルの名前 | +| `signal` | `AbortSignal` | いいえ | リクエストをキャンセルするための AbortSignal | +| `stream` | `boolean` | いいえ | ストリーミングモードを有効にする(デフォルト: `false`) | + +## レスポンスの型 + +```typescript +interface ChatResponse { + explanation?: string; // AI-generated explanation + dashboard?: string; // Generated/modified dashboard JSON + error?: string; // Error message if request failed +} +``` + +`explanation` フィールドには AI の自然言語レスポンスが含まれます。`dashboard` フィールドはダッシュボードが生成または変更された場合に値が設定されます。 diff --git a/i18n/ja/docusaurus-plugin-content-docs/current/ai/sdk-error-handling.md b/i18n/ja/docusaurus-plugin-content-docs/current/ai/sdk-error-handling.md new file mode 100644 index 00000000..31c31133 --- /dev/null +++ b/i18n/ja/docusaurus-plugin-content-docs/current/ai/sdk-error-handling.md @@ -0,0 +1,83 @@ +--- +sidebar_label: エラーハンドリング +--- + + +# エラーハンドリング + +このトピックでは、Reveal SDK AI クライアントを使用する際のエラー処理方法について説明します。 + +## エラーハンドリング + +### 非ストリーミング + +リクエストを try/catch ブロックで囲みます。 + +```typescript +try { + const insight = await client.ai.insights.get({ + dashboardId: 'sales-dashboard', + type: 'summary', + }); + displayInsight(insight.explanation); +} catch (error) { + console.error('Request failed:', error); + showErrorMessage(error.message); +} +``` + +チャットにも同じパターンが適用されます。 + +```typescript +try { + const response = await client.ai.chat.sendMessage({ + message: 'Show me sales trends', + datasourceId: 'my-datasource', + }); + displayResponse(response.explanation); + + if (response.dashboard) { + loadDashboard(response.dashboard); + } +} catch (error) { + console.error('Chat request failed:', error); + showErrorMessage(error.message); +} +``` + +### ストリーミング + +ストリームの `error` イベントをリッスンします。 + +```typescript +const stream = await client.ai.insights.get({ + dashboardId: 'sales-dashboard', + type: 'summary', + stream: true, +}); + +stream.on('text', (content) => appendToUI(content)); +stream.on('error', (error, details) => { + console.error('Stream error:', error); + showErrorMessage(error); +}); + +await stream.finalResponse(); +``` + +`for-await` パターンでもエラーを処理できます。 + +```typescript +const stream = await client.ai.insights.get({ + dashboardId: 'sales-dashboard', + type: 'summary', + stream: true, +}); + +for await (const event of stream) { + switch (event.type) { + case 'text': appendToUI(event.content); break; + case 'error': showErrorMessage(event.error); break; + } +} +``` diff --git a/i18n/ja/docusaurus-plugin-content-docs/current/ai/sdk-insights.md b/i18n/ja/docusaurus-plugin-content-docs/current/ai/sdk-insights.md new file mode 100644 index 00000000..1926b099 --- /dev/null +++ b/i18n/ja/docusaurus-plugin-content-docs/current/ai/sdk-insights.md @@ -0,0 +1,107 @@ +--- +sidebar_label: インサイト +--- + + +# インサイト + +`client.ai.insights.get()` メソッドは、ダッシュボードやビジュアライゼーションから AI を活用したサマリー、分析、予測を生成します。 + +## 基本的な使い方 + +```typescript +import { RevealSdkClient } from '@revealbi/api'; + +const client = RevealSdkClient.getInstance(); + +// Get a summary for an entire dashboard +const insight = await client.ai.insights.get({ + dashboardId: 'sales-dashboard', + type: 'summary', +}); + +console.log(insight.explanation); +// "Sales revenue reached $2.4M in Q4 2024..." +``` + +## インサイトタイプ + +`type` パラメーターを指定して、分析の種類を制御します: + +```typescript +// Summary - concise overview of key metrics +const summary = await client.ai.insights.get({ + dashboardId: 'sales-dashboard', + type: 'summary', +}); + +// Analysis - detailed interpretation of trends and patterns +const analysis = await client.ai.insights.get({ + dashboardId: 'sales-dashboard', + type: 'analysis', +}); + +// Forecast - predictions based on historical data +const forecast = await client.ai.insights.get({ + dashboardId: 'sales-dashboard', + type: 'forecast', + forecastPeriods: 12, // Forecast 12 periods ahead (default: 6) +}); +``` + +## ダッシュボードオブジェクトの使用 + +ダッシュボード ID の代わりに、ダッシュボードオブジェクトを直接渡すこともできます: + +```typescript +// Using RVDashboard object from RevealView +const insight = await client.ai.insights.get({ + dashboard: revealView.dashboard, // RVDashboard object + type: 'analysis', +}); +``` + +## ビジュアライゼーションレベルのインサイト + +ビジュアライゼーション ID を指定して、特定のビジュアライゼーションを分析します: + +```typescript +const insight = await client.ai.insights.get({ + dashboardId: 'sales-dashboard', + visualizationId: 'sales-by-region-chart', // Specific visualization + type: 'summary', +}); +``` + +## ストリーミング + +任意のリクエストに `stream: true` を追加すると、リアルタイムでレスポンスを受信できます。利用パターンと例については、[ストリーミングレスポンス](./sdk-streaming.md)を参照してください。 + +--- + +## リクエストパラメーター + +すべてのパラメーターは単一のリクエストオブジェクトで渡します: + +| パラメーター | 型 | 必須 | 説明 | +|-----------|------|----------|-------------| +| `dashboard` | `string \| RVDashboard` | * | RevealView からのダッシュボードオブジェクトまたは JSON 文字列 | +| `dashboardId` | `string` | * | ダッシュボード識別子 | +| `visualizationId` | `string` | いいえ | 分析対象のビジュアライゼーション ID | +| `type` | `InsightType` | はい | タイプ: `'summary'`、`'analysis'`、`'forecast'` | +| `forecastPeriods` | `number` | いいえ | 予測する期間数(デフォルト: 6) | +| `model` | `string` | いいえ | 使用する特定の LLM モデルの名前 | +| `signal` | `AbortSignal` | いいえ | リクエストをキャンセルするための AbortSignal | +| `stream` | `boolean` | いいえ | ストリーミングモードを有効にする(デフォルト: `false`) | + +\* `dashboard` または `dashboardId` のいずれかを指定する必要があります + +## レスポンスタイプ + +```typescript +interface InsightResponse { + explanation: string; // Complete AI-generated explanation +} +``` + +`explanation` フィールドには、非ストリーミングモードでもストリーミングモードでも、完全なインサイトテキストが含まれます。 diff --git a/i18n/ja/docusaurus-plugin-content-docs/current/ai/sdk-overview.md b/i18n/ja/docusaurus-plugin-content-docs/current/ai/sdk-overview.md new file mode 100644 index 00000000..a9eea992 --- /dev/null +++ b/i18n/ja/docusaurus-plugin-content-docs/current/ai/sdk-overview.md @@ -0,0 +1,101 @@ +--- +sidebar_label: 概要 +--- + + +# SDK の使い方 + +Reveal SDK AI クライアントは、Web アプリケーションに AI 機能を提供する TypeScript/JavaScript ライブラリです。**インサイト**(データ分析の生成)と**チャット**(対話型アナリティクス)の2つの主要な API を公開しており、どちらも単一のクライアントインスタンスからアクセスできます。 + +## 初期化 + +AI 機能を使用する前に、サーバー URL を指定してクライアントを初期化します: + +```typescript +import { RevealSdkClient } from '@revealbi/api'; + +RevealSdkClient.initialize({ + hostUrl: 'https://your-server.com' +}); +``` + +UMD/CDN を使用する場合: + +```typescript +rv.RevealSdkClient.initialize({ + hostUrl: 'https://your-server.com' +}); +``` + +:::info + +クライアント SDK を使用するには、[AI サーバー SDK](/ai/install-server-sdk) がインストールされ、実行されている必要があります。すべての AI リクエストは、設定された LLM プロバイダーによってサーバーサイドで処理されます。 + +::: + +## クライアントインスタンスの取得 + +初期化後、アプリケーション内のどこからでも共有クライアントインスタンスを取得できます: + +```typescript +const client = RevealSdkClient.getInstance(); +``` + +## API サーフェス + +クライアントは `client.ai` 名前空間を通じて AI 機能を公開します: + +### インサイト + +ダッシュボードやビジュアライゼーションからサマリー、分析、予測を生成します: + +```typescript +const insight = await client.ai.insights.get({ + dashboardId: 'sales-dashboard', + type: 'summary', +}); + +console.log(insight.explanation); +``` + +詳しくは[インサイト](./sdk-insights.md)をご覧ください。 + +### チャット + +ユーザーが自然言語でデータと対話できる会話型インターフェースを構築します: + +```typescript +const response = await client.ai.chat.sendMessage({ + message: 'Show me sales by region for Q4', + datasourceId: 'my-datasource', +}); + +console.log(response.explanation); +``` + +詳しくは[チャット](./sdk-chat.md)をご覧ください。 + +## ストリーミングと非ストリーミング + +両方の API で2つのレスポンスモードがサポートされています: + +- **非ストリーミング**(デフォルト): 完全なレスポンスを待ちます。シンプルで分かりやすい方式です。 +- **ストリーミング**: テキストが生成されるとリアルタイムで受信し、ChatGPT のような体験を提供します。 + +ストリーミングを有効にするには、任意のリクエストに `stream: true` を追加します: + +```typescript +const stream = await client.ai.insights.get({ + dashboardId: 'sales-dashboard', + type: 'summary', + stream: true, +}); + +stream.on('text', (content) => { + console.log(content); // Text arrives in chunks +}); + +const result = await stream.finalResponse(); +``` + +詳しくは[ストリーミングレスポンス](./sdk-streaming.md)をご覧ください。 diff --git a/i18n/ja/docusaurus-plugin-content-docs/current/ai/sdk-streaming.md b/i18n/ja/docusaurus-plugin-content-docs/current/ai/sdk-streaming.md new file mode 100644 index 00000000..ae9e2ebc --- /dev/null +++ b/i18n/ja/docusaurus-plugin-content-docs/current/ai/sdk-streaming.md @@ -0,0 +1,101 @@ +--- +sidebar_label: ストリーミングレスポンス +--- + + +# ストリーミングレスポンス + +[インサイト](./sdk-insights.md) と [チャット](./sdk-chat.md) の両方の API はストリーミングモードをサポートしており、生成されたレスポンスをリアルタイムで配信します。これにより、ユーザーは完全なレスポンスを待つのではなく、テキストが徐々に表示される ChatGPT のような体験が得られます。 + +任意のリクエストに `stream: true` を追加することでストリーミングを有効にできます。ストリーミングが有効な場合、メソッドは直接のレスポンスの代わりに `AIStream` オブジェクトを返します。 + +## 利用パターン + +`AIStream` はイベントを利用する 3 つの方法をサポートしています。ユースケースに合ったパターンを選択してください。 + +### パターン 1: for-await(フルコントロール) + +すべてのイベントを反復処理して、各イベントタイプを最大限に制御します。 + +```typescript +const stream = await client.ai.insights.get({ + dashboardId: 'sales-dashboard', + type: 'summary', + stream: true, +}); + +for await (const event of stream) { + switch (event.type) { + case 'progress': console.log('Status:', event.message); break; + case 'text': document.getElementById('output').textContent += event.content; break; + case 'error': console.error('Error:', event.error); break; + } +} +``` + +### パターン 2: イベントリスナー(シンプルな UI 連携) + +特定のイベントタイプのハンドラーを登録します。 + +```typescript +const stream = await client.ai.chat.sendMessage({ + message: 'Show me sales by region', + datasourceId: 'my-datasource', + stream: true, +}); + +stream.on('progress', (message) => console.log('Status:', message)); +stream.on('text', (content) => { + document.getElementById('output').textContent += content; +}); +stream.on('error', (error) => console.error('Error:', error)); + +const result = await stream.finalResponse(); +console.log('Complete:', result.explanation); +``` + +### パターン 3: ストリームからの集約結果 + +通信上はストリーミングを使用しつつ、完全なレスポンスを待ちます。 + +```typescript +const stream = await client.ai.insights.get({ + dashboardId: 'sales-dashboard', + type: 'summary', + stream: true, +}); + +// Wait for completion, returns InsightResponse +const result = await stream.finalResponse(); +console.log(result.explanation); +``` + +これは、個々のイベントを処理せずに、サーバー側のストリーミングのメリット(長時間実行リクエストのタイムアウト回避など)を活用したい場合に便利です。 + +--- + +## AIStream リファレンス + +`stream: true` の場合、戻り値の型は `AIStream` になります。ここで `T` はレスポンスの型(`InsightResponse` または `ChatResponse`)です。 + +| メソッド / パターン | 説明 | +|---------|-------------| +| `for await (const event of stream)` | イベントが到着するたびに反復処理する | +| `.on(event, handler)` | イベント固有のリスナーを登録する | +| `.finalResponse()` | 完全なレスポンスで解決される Promise を返す | +| `.abort()` | ストリームをキャンセルする | + +## ストリームイベント + +```typescript +type AIStreamEvent = + | { type: 'progress'; message: string } + | { type: 'text'; content: string } + | { type: 'error'; error: string; details?: unknown }; +``` + +| イベントタイプ | 説明 | +|------------|-------------| +| `progress` | 生成中のステータスメッセージ(例: "Analyzing dashboard data..."、"Creating a new dashboard") | +| `text` | 生成されたレスポンスのテキストフラグメント | +| `error` | 生成が失敗した場合のエラー情報 | diff --git a/i18n/ja/docusaurus-plugin-content-docs/current/ai/system-requirements.md b/i18n/ja/docusaurus-plugin-content-docs/current/ai/system-requirements.md index 5bfb362f..c4f951d8 100644 --- a/i18n/ja/docusaurus-plugin-content-docs/current/ai/system-requirements.md +++ b/i18n/ja/docusaurus-plugin-content-docs/current/ai/system-requirements.md @@ -2,62 +2,58 @@ sidebar_label: システム要件 --- -import BetaWarning from './_beta-message.md' - - # システム要件 -Reveal SDK AI 機能を使用するには、次の前提条件が必要です: +Reveal SDK AI 機能を使用するには、以下の前提条件が必要です: ## クライアント SDK の要件 -### Web ブラウザー +### ウェブブラウザー -Reveal SDK AI クライアントは、以下をサポートする最新の Web ブラウザーで動作します: +Reveal SDK AI クライアントは、以下をサポートするモダンなウェブブラウザーで動作します: - ES2020 JavaScript 機能 - Async/Await - Fetch API - Server-Sent Events (SSE) -**サポートされているブラウザー:** +**サポートされているブラウザー:** - Chrome/Edge 90+ - Firefox 88+ - Safari 14+ -### JavaScript フレームワーク (オプション) +### JavaScript フレームワーク(オプション) -クライアント SDK は素の JavaScript で動作しますが、以下とシームレスに統合されます: +クライアント SDK はバニラ JavaScript でも動作しますが、以下のフレームワークとシームレスに統合できます: - Angular 15+ - React 18+ - Vue 3+ -- または任意の最新の JavaScript フレームワーク +- またはその他のモダンな JavaScript フレームワーク ## サーバー SDK の要件 ### ASP.NET Core -- ASP.NET 8.0 またはそれ以降 +- ASP.NET 8.0 以上 -## Reveal SDK 基本の要件 +## Reveal SDK の基本要件 -Reveal SDK AI は基本の Reveal SDK を拡張するため、標準の Reveal SDK 要件も満たす必要があります: +Reveal SDK AI はベースの Reveal SDK を拡張するものであるため、標準的な Reveal SDK の要件も満たす必要があります: - 有効な Reveal SDK ライセンス - Reveal SDK Web (JavaScript) パッケージ -- Reveal.Sdk.AspNetCore パッケージ (互換性のあるバージョン) +- Reveal.Sdk.AspNetCore パッケージ(互換性のあるバージョン) ### TypeScript サポート -- TypeScript 5.0+ (完全な型安全性のため) +- TypeScript 5.0+(完全な型安全性を実現するため) - SDK は TypeScript で記述されており、完全な型定義を提供します -## 次の手順 - -環境がこれらの要件を満たしていることを確認したら: +## 次のステップ -1. [サーバー SDK のインストール](install-server-sdk.md) - バックエンド コンポーネントをセットアップします -2. [クライアント SDK のインストール](install-client-sdk.md) - アプリケーションに JavaScript パッケージを追加します +お使いの環境がこれらの要件を満たしていることを確認したら: +1. [サーバー SDK のインストール](install-server-sdk.md) - バックエンドコンポーネントをセットアップします +2. [クライアント SDK のインストール](install-client-sdk.md) - JavaScript パッケージをアプリケーションに追加します diff --git a/sidebars.ts b/sidebars.ts index 63e3e6b6..c9c87278 100644 --- a/sidebars.ts +++ b/sidebars.ts @@ -252,11 +252,7 @@ const sidebars: SidebarsConfig = { { type: "doc", label: "Install Client SDK", id: "ai/install-client-sdk" }, ] }, - { - type: "category", label: "Getting Started", key: "ai-getting-started-tutorials", items: [ - { type: "doc", label: "HTML/JavaScript", id: "ai/getting-started-html" }, - ] - }, + { type: "doc", label: "Getting Started - HTML/JS", id: "ai/getting-started-html" }, ] }, @@ -266,11 +262,11 @@ const sidebars: SidebarsConfig = { // type: "category", label: "Providers", collapsed: false, collapsible: false, className: "sidebar__header", items: [ // { type: "doc", label: "Overview", id: "ai/providers-overview" }, // { type: "doc", label: "OpenAI", id: "ai/providers-openai" }, + // { type: "doc", label: "Azure OpenAI", id: "ai/providers-azure-openai" }, // { type: "doc", label: "Anthropic", id: "ai/providers-anthropic" }, // { type: "doc", label: "Google Gemini", id: "ai/providers-google-gemini" }, - // { type: "doc", label: "Using Custom Endpoints", id: "ai/providers-custom-endpoints" }, + // { type: "doc", label: "Custom Endpoints", id: "ai/providers-custom-endpoints" }, // { type: "doc", label: "Building a Custom Provider", id: "ai/providers-building-custom" }, - // { type: "doc", label: "Multi-Intent Routing", id: "ai/providers-multi-intent-routing" }, // ] // }, @@ -283,32 +279,33 @@ const sidebars: SidebarsConfig = { ] }, - /* -------------------- Features -------------------- */ + /* -------------------- Using the SDK -------------------- */ { - type: "category", label: "Features", collapsed: false, collapsible: false, className: "sidebar__header", items: [ - { type: "doc", label: "Insights", id: "ai/insights" }, - { type: "doc", label: "Chat", id: "ai/chat" }, + type: "category", label: "Using the SDK", collapsed: false, collapsible: false, className: "sidebar__header", items: [ + { type: "doc", label: "Overview", key: "ai-sdk-overview", id: "ai/sdk-overview" }, + { type: "doc", label: "Insights", id: "ai/sdk-insights" }, + { type: "doc", label: "Chat", id: "ai/sdk-chat" }, + { type: "doc", label: "Streaming Responses", id: "ai/sdk-streaming" }, + { type: "doc", label: "Error Handling", id: "ai/sdk-error-handling" }, ] }, - /* -------------------- Using the Client SDK -------------------- */ - // Uncomment when Client SDK docs are added: - // { - // type: "category", label: "Using the Client SDK", collapsed: false, collapsible: false, className: "sidebar__header", items: [ - // { type: "doc", label: "Overview", id: "ai/client-sdk-overview" }, - // { type: "doc", label: "Streaming Responses", id: "ai/client-sdk-streaming" }, - // { type: "doc", label: "Error Handling & Cancellation", id: "ai/client-sdk-error-handling" }, - // ] - // }, + /* -------------------- API Reference -------------------- */ + { + type: "category", label: "API Reference", collapsed: false, collapsible: false, className: "sidebar__header", items: [ + { type: "doc", label: "Insights Endpoint", id: "ai/insights" }, + { type: "doc", label: "Chat Endpoint", id: "ai/chat" }, + ] + }, - /* -------------------- Using the REST API -------------------- */ - // Uncomment when REST API docs are added: - // { - // type: "category", label: "Using the REST API", collapsed: false, collapsible: false, className: "sidebar__header", items: [ - // { type: "doc", label: "API Endpoints", id: "ai/rest-api-endpoints" }, - // { type: "doc", label: "Server-Sent Events", id: "ai/rest-api-sse" }, - // ] - // }, + /* -------------------- Guides -------------------- */ + { + type: "category", label: "Guides", collapsed: false, collapsible: false, className: "sidebar__header", items: [ + { type: "doc", label: "Insights with Context Menus", id: "ai/guide-insights-context-menus" }, + { type: "doc", label: "Building a Chat Interface", id: "ai/guide-chat-interface" }, + { type: "doc", label: "Streaming Markdown Display", id: "ai/guide-streaming-display" }, + ] + }, /* -------------------- Release Information -------------------- */ // Uncomment when release docs are added: diff --git a/src/components/AiSpotlight/index.tsx b/src/components/AiSpotlight/index.tsx index d810a429..a94a8fad 100644 --- a/src/components/AiSpotlight/index.tsx +++ b/src/components/AiSpotlight/index.tsx @@ -1,5 +1,6 @@ import React from 'react'; import Translate from '@docusaurus/Translate'; +import Link from '@docusaurus/Link'; import CodeBlock from '@theme/CodeBlock'; import styles from './styles.module.css'; @@ -39,9 +40,9 @@ export default function AiSpotlight(): JSX.Element { Conversational Chat - + Start building with AI → - + diff --git a/src/components/HomepageFeatures/index.tsx b/src/components/HomepageFeatures/index.tsx index 5da10513..b71107de 100644 --- a/src/components/HomepageFeatures/index.tsx +++ b/src/components/HomepageFeatures/index.tsx @@ -1,6 +1,7 @@ import React from 'react'; import clsx from 'clsx'; import Translate from '@docusaurus/Translate'; +import Link from '@docusaurus/Link'; import styles from './styles.module.css'; const DeveloperSvg = require('@site/static/img/developer.svg').default; @@ -44,7 +45,7 @@ function QuickLinkList({ links }: { links: QuickLink[] }) { {links.map((link, idx) => ( › - {link.label} + {link.label} ))} @@ -95,7 +96,6 @@ export default function HomepageFeatures(): JSX.Element { AI SDK - BETA Intelligent Analytics diff --git a/src/components/HomepageFeatures/styles.module.css b/src/components/HomepageFeatures/styles.module.css index 537e53ab..e78f5acf 100644 --- a/src/components/HomepageFeatures/styles.module.css +++ b/src/components/HomepageFeatures/styles.module.css @@ -64,18 +64,6 @@ font-weight: 500; } -.betaBadge { - display: inline-block; - background: var(--ifm-color-primary); - color: #fff; - border-radius: 4px; - padding: 1px 8px; - font-size: 11px; - font-weight: 700; - text-transform: uppercase; - letter-spacing: 0.5px; -} - .cardDescription { color: var(--ifm-font-color-secondary); line-height: 1.6; diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 5ad857f1..385b789d 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -3,6 +3,7 @@ import clsx from 'clsx'; import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; import Layout from '@theme/Layout'; import Translate from '@docusaurus/Translate'; +import Link from '@docusaurus/Link'; import HomepageFeatures from '@site/src/components/HomepageFeatures'; import AiSpotlight from '@site/src/components/AiSpotlight'; import FrameworkPicker from '@site/src/components/FrameworkPicker'; @@ -23,12 +24,12 @@ function HomepageHeader() { - + Get Started - - + + Explore AI SDK - +
- Right-click on the dashboard or a visualization to generate AI insights. - Try "Summary", "Analysis", or "Forecast". -
Intelligent Analytics diff --git a/src/components/HomepageFeatures/styles.module.css b/src/components/HomepageFeatures/styles.module.css index 537e53ab..e78f5acf 100644 --- a/src/components/HomepageFeatures/styles.module.css +++ b/src/components/HomepageFeatures/styles.module.css @@ -64,18 +64,6 @@ font-weight: 500; } -.betaBadge { - display: inline-block; - background: var(--ifm-color-primary); - color: #fff; - border-radius: 4px; - padding: 1px 8px; - font-size: 11px; - font-weight: 700; - text-transform: uppercase; - letter-spacing: 0.5px; -} - .cardDescription { color: var(--ifm-font-color-secondary); line-height: 1.6; diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 5ad857f1..385b789d 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -3,6 +3,7 @@ import clsx from 'clsx'; import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; import Layout from '@theme/Layout'; import Translate from '@docusaurus/Translate'; +import Link from '@docusaurus/Link'; import HomepageFeatures from '@site/src/components/HomepageFeatures'; import AiSpotlight from '@site/src/components/AiSpotlight'; import FrameworkPicker from '@site/src/components/FrameworkPicker'; @@ -23,12 +24,12 @@ function HomepageHeader() {