Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

refactor: remove SQLService.AICompletion in favor of AIService.Chat (#21070)

Danny Xuec2a2a22807c
diff --git a/backend/api/mcp/gen/openapi.yaml b/backend/api/mcp/gen/openapi.yaml
index d4c2ee0fa2..756cc2d2a1 100644
--- a/backend/api/mcp/gen/openapi.yaml
+++ b/backend/api/mcp/gen/openapi.yaml
@@ -5603,44 +5603,6 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/bytebase.v1.PreviewTaskRunRollbackResponse'
- /bytebase.v1.SQLService/AICompletion:
- post:
- tags:
- - bytebase.v1.SQLService
- summary: AICompletion
- description: |-
- Provides AI-powered SQL completion and generation.
- Permissions required: None (authenticated users only, requires AI to be enabled)
- operationId: bytebase.v1.SQLService.AICompletion
- parameters:
- - name: Connect-Protocol-Version
- in: header
- required: true
- schema:
- $ref: '#/components/schemas/connect-protocol-version'
- - name: Connect-Timeout-Ms
- in: header
- schema:
- $ref: '#/components/schemas/connect-timeout-header'
- requestBody:
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/bytebase.v1.AICompletionRequest'
- required: true
- responses:
- default:
- description: Error
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/connect.error'
- "200":
- description: Success
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/bytebase.v1.AICompletionResponse'
/bytebase.v1.SQLService/AdminExecute: {}
/bytebase.v1.SQLService/Export:
post:
@@ -7967,67 +7929,6 @@ components:
title: AIChatUsage
additionalProperties: false
description: Token usage for a single AI provider call.
- bytebase.v1.AICompletionRequest:
- type: object
- properties:
- messages:
- type: array
- items:
- $ref: '#/components/schemas/bytebase.v1.AICompletionRequest.Message'
- title: messages
- title: AICompletionRequest
- additionalProperties: false
- bytebase.v1.AICompletionRequest.Message:
- type: object
- properties:
- role:
- type: string
- title: role
- content:
- type: string
- title: content
- title: Message
- additionalProperties: false
- bytebase.v1.AICompletionResponse:
- type: object
- properties:
- candidates:
- type: array
- items:
- $ref: '#/components/schemas/bytebase.v1.AICompletionResponse.Candidate'
- title: candidates
- description: |-
- candidates is used for results with multiple choices and candidates. Used
- for OpenAI and Gemini.
- title: AICompletionResponse
- additionalProperties: false
- bytebase.v1.AICompletionResponse.Candidate:
- type: object
- properties:
- content:
- title: content
- $ref: '#/components/schemas/bytebase.v1.AICompletionResponse.Candidate.Content'
- title: Candidate
- additionalProperties: false
- bytebase.v1.AICompletionResponse.Candidate.Content:
- type: object
- properties:
- parts:
- type: array
- items:
- $ref: '#/components/schemas/bytebase.v1.AICompletionResponse.Candidate.Content.Part'
- title: parts
- description: parts is used for a result content with multiple parts.
- title: Content
- additionalProperties: false
- bytebase.v1.AICompletionResponse.Candidate.Content.Part:
- type: object
- properties:
- text:
- type: string
- title: text
- title: Part
- additionalProperties: false
bytebase.v1.AISetting:
type: object
properties:
diff --git a/backend/api/v1/ai_service.go b/backend/api/v1/ai_service.go
index 866576edc2..5a6049979c 100644
--- a/backend/api/v1/ai_service.go
+++ b/backend/api/v1/ai_service.go
@@ -43,13 +43,23 @@ func (s *AIService) Chat(ctx context.Context, req *connect.Request[v1pb.AIChatRe
return nil, connect.NewError(connect.CodeFailedPrecondition, errors.New("AI is not enabled"))
}
+ resp, err := chatWithProvider(ctx, aiSetting, req.Msg)
+ if err != nil {
+ return nil, err
+ }
+ return connect.NewResponse(resp), nil
+}
+
+// chatWithProvider dispatches a chat request to the configured AI provider.
+// It is shared by the Chat RPC and backend-internal callers such as AI-powered release linting.
+func chatWithProvider(ctx context.Context, aiSetting *storepb.AISetting, request *v1pb.AIChatRequest) (*v1pb.AIChatResponse, error) {
switch aiSetting.Provider {
case storepb.AISetting_OPEN_AI, storepb.AISetting_AZURE_OPENAI:
- return s.chatOpenAI(ctx, aiSetting, req.Msg)
+ return chatOpenAI(ctx, aiSetting, request)
case storepb.AISetting_GEMINI:
- return s.chatGemini(ctx, aiSetting, req.Msg)
+ return chatGemini(ctx, aiSetting, request)
case storepb.AISetting_CLAUDE:
- return s.chatClaude(ctx, aiSetting, req.Msg)
+ return chatClaude(ctx, aiSetting, request)
default:
return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("unsupported AI provider %s", aiSetting.Provider))
}
@@ -201,7 +211,7 @@ func extractGeminiThoughtSignatureFromOpenAIToolCall(raw json.RawMessage) string
return providerFields.ExtraContent.Google.ThoughtSignature
}
-func (*AIService) chatOpenAI(ctx context.Context, aiSetting *storepb.AISetting, request *v1pb.AIChatRequest) (*connect.Response[v1pb.AIChatResponse], error) {
+func chatOpenAI(ctx context.Context, aiSetting *storepb.AISetting, request *v1pb.AIChatRequest) (*v1pb.AIChatResponse, error) {
payload := chatOpenAIRequest{
Model: aiSetting.Model,
}
@@ -307,7 +317,7 @@ func (*AIService) chatOpenAI(ctx context.Context, aiSetting *storepb.AISetting,
result.ToolCalls = append(result.ToolCalls, toolCall)
}
}
- return connect.NewResponse(result), nil
+ return result, nil
}
// Claude chat types with tool-calling support.
@@ -351,7 +361,7 @@ type chatClaudeResponse struct {
Usage *chatClaudeUsage `json:"usage,omitempty"`
}
-func (*AIService) chatClaude(ctx context.Context, aiSetting *storepb.AISetting, request *v1pb.AIChatRequest) (*connect.Response[v1pb.AIChatResponse], error) {
+func chatClaude(ctx context.Context, aiSetting *storepb.AISetting, request *v1pb.AIChatRequest) (*v1pb.AIChatResponse, error) {
payload := chatClaudeRequest{
Model: aiSetting.Model,
MaxTokens: 4096,
@@ -472,7 +482,7 @@ func (*AIService) chatClaude(ctx context.Context, aiSetting *storepb.AISetting,
if textContent != "" {
result.Content = &textContent
}
- return connect.NewResponse(result), nil
+ return result, nil
}
// Gemini chat types with tool-calling support.
@@ -537,7 +547,7 @@ func newGeminiToolCallID(name string) string {
return fmt.Sprintf("call_%s_%s", name, uuid.NewString())
}
-func (*AIService) chatGemini(ctx context.Context, aiSetting *storepb.AISetting, request *v1pb.AIChatRequest) (*connect.Response[v1pb.AIChatResponse], error) {
+func chatGemini(ctx context.Context, aiSetting *storepb.AISetting, request *v1pb.AIChatRequest) (*v1pb.AIChatResponse, error) {
payload := chatGeminiRequest{}
for _, m := range request.Messages {
@@ -677,7 +687,7 @@ func (*AIService) chatGemini(ctx context.Context, aiSetting *storepb.AISetting,
result.Content = &textContent
}
}
- return connect.NewResponse(result), nil
+ return result, nil
}
func newAIChatUsage(totalTokens int32) *v1pb.AIChatUsage {
diff --git a/backend/api/v1/ai_service_test.go b/backend/api/v1/ai_service_test.go
index ba1854f4e2..25f289a4b2 100644
--- a/backend/api/v1/ai_service_test.go
+++ b/backend/api/v1/ai_service_test.go
@@ -159,7 +159,7 @@ func TestChatGeminiGeneratesUniqueToolCallIDs(t *testing.T) {
}))
defer server.Close()
- resp, err := (&AIService{}).chatGemini(
+ resp, err := chatGemini(
context.Background(),
&storepb.AISetting{
Endpoint: server.URL,
@@ -169,6 +169,6 @@ func TestChatGeminiGeneratesUniqueToolCallIDs(t *testing.T) {
&v1pb.AIChatRequest{},
)
require.NoError(t, err)
- require.Len(t, resp.Msg.ToolCalls, 2)
- require.NotEqual(t, resp.Msg.ToolCalls[0].Id, resp.Msg.ToolCalls[1].Id)
+ require.Len(t, resp.ToolCalls, 2)
+ require.NotEqual(t, resp.ToolCalls[0].Id, resp.ToolCalls[1].Id)
}
diff --git a/backend/api/v1/release_service_ai_lint.go b/backend/api/v1/release_service_ai_lint.go
index 3193154ca9..beb8a69b15 100644
--- a/backend/api/v1/release_service_ai_lint.go
+++ b/backend/api/v1/release_service_ai_lint.go
@@ -5,11 +5,11 @@ import (
"encoding/json"
"fmt"
"log/slog"
+ "strings"
"github.com/pkg/errors"
"github.com/bytebase/bytebase/backend/common"
- storepb "github.com/bytebase/bytebase/backend/generated-go/store"
v1pb "github.com/bytebase/bytebase/backend/generated-go/v1"
)
@@ -53,58 +53,23 @@ func (s *ReleaseService) runAIPoweredLintBatch(ctx context.Context, files []file
prompt := buildBatchLintPrompt(files, customRules)
slog.Debug("AI batch prompt built", "promptLength", len(prompt))
- // Call AI using the existing AICompletion infrastructure
- request := &v1pb.AICompletionRequest{
- Messages: []*v1pb.AICompletionRequest_Message{
+ // Call AI through the shared chat provider dispatch.
+ request := &v1pb.AIChatRequest{
+ Messages: []*v1pb.AIChatMessage{
{
- Role: "user",
- Content: prompt,
+ Role: v1pb.AIChatMessageRole_AI_CHAT_MESSAGE_ROLE_USER,
+ Content: &prompt,
},
},
}
- var responseText string
- switch aiSetting.Provider {
- case storepb.AISetting_OPEN_AI, storepb.AISetting_AZURE_OPENAI:
- slog.Info("Calling OpenAI for batch schema linting", "endpoint", aiSetting.Endpoint, "filesCount", len(files))
- resp, err := callOpenAI(ctx, aiSetting, request)
- if err != nil {
- slog.Error("OpenAI call failed", "error", err)
- return nil, errors.Wrap(err, "OpenAI API call failed")
- }
- slog.Info("OpenAI call successful", "candidatesCount", len(resp.Msg.Candidates))
- if len(resp.Msg.Candidates) > 0 && len(resp.Msg.Candidates[0].Content.Parts) > 0 {
- responseText = resp.Msg.Candidates[0].Content.Parts[0].Text
- slog.Debug("OpenAI response received", "responseLength", len(responseText))
- }
- case storepb.AISetting_GEMINI:
- slog.Info("Calling Gemini for batch schema linting", "endpoint", aiSetting.Endpoint, "filesCount", len(files))
- resp, err := callGemini(ctx, aiSetting, request)
- if err != nil {
- slog.Error("Gemini call failed", "error", err)
- return nil, errors.Wrap(err, "Gemini API call failed")
- }
- slog.Info("Gemini call successful", "candidatesCount", len(resp.Msg.Candidates))
- if len(resp.Msg.Candidates) > 0 && len(resp.Msg.Candidates[0].Content.Parts) > 0 {
- responseText = resp.Msg.Candidates[0].Content.Parts[0].Text
- slog.Debug("Gemini response received", "responseLength", len(responseText))
- }
- case storepb.AISetting_CLAUDE:
- slog.Info("Calling Claude for batch schema linting", "endpoint", aiSetting.Endpoint, "filesCount", len(files))
- resp, err := callClaude(ctx, aiSetting, request)
- if err != nil {
- slog.Error("Claude call failed", "error", err)
- return nil, errors.Wrap(err, "Claude API call failed")
- }
- slog.Info("Claude call successful", "candidatesCount", len(resp.Msg.Candidates))
- if len(resp.Msg.Candidates) > 0 && len(resp.Msg.Candidates[0].Content.Parts) > 0 {
- responseText = resp.Msg.Candidates[0].Content.Parts[0].Text
- slog.Debug("Claude response received", "responseLength", len(responseText))
- }
- default:
- slog.Error("Unsupported AI provider", "provider", aiSetting.Provider)
- return nil, errors.Errorf("unsupported AI provider %s", aiSetting.Provider)
+ slog.Info("Calling AI provider for batch schema linting", "provider", aiSetting.Provider, "endpoint", aiSetting.Endpoint, "filesCount", len(files))
+ resp, err := chatWithProvider(ctx, aiSetting, request)
+ if err != nil {
+ slog.Error("AI call failed", "provider", aiSetting.Provider, "error", err)
+ return nil, errors.Wrapf(err, "%s API call failed", aiSetting.Provider)
}
+ responseText := resp.GetContent()
if responseText == "" {
slog.Warn("AI returned empty response")
@@ -162,10 +127,24 @@ Only return the JSON array, no other text.`
return prompt
}
+// stripCodeFence removes a wrapping Markdown code fence (```lang ... ```) if present.
+func stripCodeFence(text string) string {
+ text = strings.TrimSpace(text)
+ if strings.HasPrefix(text, "```") {
+ if idx := strings.Index(text, "\n"); idx != -1 {
+ text = text[idx+1:]
+ } else {
+ text = strings.TrimPrefix(text, "```")
+ }
+ }
+ text = strings.TrimSuffix(strings.TrimSpace(text), "```")
+ return strings.TrimSpace(text)
+}
+
// parseBatchAILintResponse parses the batch AI response text into a map of file -> Advice messages.
func parseBatchAILintResponse(responseText string, files []fileSchema) (map[string][]*v1pb.Advice, error) {
var results []aiLintResult
- if err := json.Unmarshal([]byte(responseText), &results); err != nil {
+ if err := json.Unmarshal([]byte(stripCodeFence(responseText)), &results); err != nil {
return nil, errors.Wrap(err, "failed to parse AI lint response")
}
diff --git a/backend/api/v1/sql_service_ai.go b/backend/api/v1/sql_service_ai.go
deleted file mode 100644
index e7fd3c6aa3..0000000000
--- a/backend/api/v1/sql_service_ai.go
+++ /dev/null
@@ -1,379 +0,0 @@
-package v1
-
-import (
- "bytes"
- "context"
- "encoding/json"
- "fmt"
- "io"
- "net/http"
- "net/url"
- "strings"
-
- "connectrpc.com/connect"
-
- "github.com/pkg/errors"
-
- "github.com/bytebase/bytebase/backend/common"
- storepb "github.com/bytebase/bytebase/backend/generated-go/store"
- v1pb "github.com/bytebase/bytebase/backend/generated-go/v1"
-)
-
-// openAIRequest represents the payload for OpenAI API requests.
-type openAIRequest struct {
- Model string `json:"model"`
- Messages []openAIMessage `json:"messages"`
-}
-
-type openAIMessage struct {
- Role string `json:"role"`
- Content string `json:"content"`
-}
-
-// openAIResponse represents the response from OpenAI API.
-type openAIResponse struct {
- Choices []struct {
- Message struct {
- Role string `json:"role"`
- Content string `json:"content"`
- } `json:"message"`
- } `json:"choices"`
-}
-
-// geminiRequest represents the payload for Gemini API requests.
-type geminiRequest struct {
- Contents []geminiContent `json:"contents"`
- GenerationConfig geminiGenerationConfig `json:"generationConfig"`
-}
-
-type geminiContent struct {
- Parts []geminiPart `json:"parts"`
- Role string `json:"role"`
-}
-
-type geminiPart struct {
- Text string `json:"text"`
-}
-
-type geminiGenerationConfig struct {
- Temperature float64 `json:"temperature"`
- TopP float64 `json:"topP"`
- TopK int `json:"topK"`
- MaxOutputTokens int `json:"maxOutputTokens"`
- StopSequences []string `json:"stopSequences,omitempty"`
-}
-
-// geminiResponse represents the response from Gemini API.
-type geminiResponse struct {
- Candidates []struct {
- Content struct {
- Parts []struct {
- Text string `json:"text"`
- } `json:"parts"`
- } `json:"content"`
- } `json:"candidates"`
-}
-
-// claudeRequest represents the payload for Claude API requests.
-type claudeRequest struct {
- Model string `json:"model"`
- Messages []claudeMessage `json:"messages"`
- MaxTokens int `json:"max_tokens"`
- Temperature float64 `json:"temperature"`
- TopP float64 `json:"top_p"`
- TopK int `json:"top_k"`
-}
-
-type claudeMessage struct {
- Role string `json:"role"`
- Content string `json:"content"`
-}
-
-// claudeResponse represents the response from Claude API.
-type claudeResponse struct {
- Content []struct {
- Type string `json:"type"`
- Text string `json:"text"`
- } `json:"content"`
-}
-
-// AICompletion is the mixer for AI completion.
-func (s *SQLService) AICompletion(ctx context.Context, req *connect.Request[v1pb.AICompletionRequest]) (*connect.Response[v1pb.AICompletionResponse], error) {
- request := req.Msg
- aiSetting, err := s.store.GetAISetting(ctx, common.GetWorkspaceIDFromContext(ctx))
- if err != nil {
- return nil, err
- }
- if !aiSetting.Enabled {
- return nil, connect.NewError(connect.CodeFailedPrecondition, errors.New("AI is not enabled"))
- }
-
- switch aiSetting.Provider {
- case storepb.AISetting_OPEN_AI, storepb.AISetting_AZURE_OPENAI:
- return callOpenAI(ctx, aiSetting, request)
- case storepb.AISetting_GEMINI:
- return callGemini(ctx, aiSetting, request)
- case storepb.AISetting_CLAUDE:
- return callClaude(ctx, aiSetting, request)
- default:
- return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("unsupported AI provider %s", aiSetting.Provider))
- }
-}
-
-func callOpenAI(ctx context.Context, aiSetting *storepb.AISetting, request *v1pb.AICompletionRequest) (*connect.Response[v1pb.AICompletionResponse], error) {
- payload := buildOpenAICompletionRequest(aiSetting.Model, request)
- payloadBytes, err := json.Marshal(payload)
- if err != nil {
- return nil, errors.Errorf("failed to marshal OpenAI request payload: %s", err)
- }
-
- httpReq, err := http.NewRequestWithContext(ctx, "POST", aiSetting.Endpoint, bytes.NewBuffer(payloadBytes))
- if err != nil {
- return nil, errors.Errorf("failed to create HTTP request: %s", err)
- }
-
- httpReq.Header.Set("Content-Type", "application/json")
- if aiSetting.Provider == storepb.AISetting_AZURE_OPENAI {
- httpReq.Header.Set("api-key", aiSetting.ApiKey)
- } else {
- httpReq.Header.Set("Authorization", fmt.Sprintf("Bearer %s", aiSetting.ApiKey))
- }
-
- client := &http.Client{}
- httpResp, err := client.Do(httpReq)
- if err != nil {
- return nil, errors.Errorf("failed to send HTTP request: %s", err)
- }
- defer httpResp.Body.Close()
-
- // Read and parse the response
- body, err := io.ReadAll(httpResp.Body)
- if err != nil {
- return nil, errors.Errorf("failed to read response body: %s", err)
- }
-
- if httpResp.StatusCode != http.StatusOK {
- return nil, errors.Errorf("OpenAI API returned status %d: %s", httpResp.StatusCode, string(body))
- }
-
- var openAIResponse openAIResponse
- if err := json.Unmarshal(body, &openAIResponse); err != nil {
- return nil, errors.Errorf("failed to unmarshal OpenAI response: %s", err)
- }
-
- resp := &v1pb.AICompletionResponse{}
- for _, choice := range openAIResponse.Choices {
- resp.Candidates = append(resp.Candidates, &v1pb.AICompletionResponse_Candidate{
- Content: &v1pb.AICompletionResponse_Candidate_Content{
- Parts: []*v1pb.AICompletionResponse_Candidate_Content_Part{
- {
- Text: choice.Message.Content,
- },
- },
- },
- })
- }
- return connect.NewResponse(resp), nil
-}
-
-func buildOpenAICompletionRequest(model string, request *v1pb.AICompletionRequest) openAIRequest {
- payload := openAIRequest{
- Model: model,
- }
- for _, m := range request.Messages {
- payload.Messages = append(payload.Messages, openAIMessage{
- Role: m.Role,
- Content: m.Content,
- })
- }
- return payload
-}
-
-// Gemini API docs: https://ai.google.dev/gemini-api/docs
-func callGemini(ctx context.Context, aiSetting *storepb.AISetting, request *v1pb.AICompletionRequest) (*connect.Response[v1pb.AICompletionResponse], error) {
- // Convert messages to Gemini format
- var contents []geminiContent
- for _, m := range request.Messages {
- if m.Content == "" {
- continue
- }
- // Gemini uses "user" and "model" as roles
- role := m.Role
- if role != "user" {
- role = "model"
- }
- contents = append(contents, geminiContent{
- Role: role,
- Parts: []geminiPart{
- {Text: m.Content},
- },
- })
- }
-
- payload := geminiRequest{
- Contents: contents,
- GenerationConfig: geminiGenerationConfig{
- Temperature: 0.7,
- TopP: 0.95,
- TopK: 40,
- MaxOutputTokens: 2048,
- },
- }
-
- payloadBytes, err := json.Marshal(payload)
- if err != nil {
- return nil, errors.Errorf("failed to marshal Gemini request payload: %s", err)
- }
-
- // Gemini API endpoint format: https://generativelanguage.googleapis.com/v1beta/models/{model}:generateContent
- requestURL, err := url.JoinPath(aiSetting.Endpoint, "models", aiSetting.Model+":generateContent")
- if err != nil {
- return nil, errors.Wrap(err, "failed to build Gemini request URL")
- }
-
- httpReq, err := http.NewRequestWithContext(ctx, "POST", requestURL, bytes.NewBuffer(payloadBytes))
- if err != nil {
- return nil, errors.Errorf("failed to create HTTP request: %s", err)
- }
-
- httpReq.Header.Set("Content-Type", "application/json")
- httpReq.Header.Set("x-goog-api-key", aiSetting.ApiKey)
-
- client := &http.Client{}
- httpResp, err := client.Do(httpReq)
- if err != nil {
- return nil, errors.Errorf("failed to send HTTP request: %s", err)
- }
- defer httpResp.Body.Close()
-
- body, err := io.ReadAll(httpResp.Body)
- if err != nil {
- return nil, errors.Errorf("failed to read response body: %s", err)
- }
-
- if httpResp.StatusCode != http.StatusOK {
- return nil, errors.Errorf("Gemini API returned status %d: %s", httpResp.StatusCode, string(body))
- }
-
- var geminiResp geminiResponse
- if err := json.Unmarshal(body, &geminiResp); err != nil {
- return nil, errors.Errorf("failed to unmarshal Gemini response: %s", err)
- }
-
- resp := &v1pb.AICompletionResponse{}
- for _, candidate := range geminiResp.Candidates {
- var sb strings.Builder
- for _, part := range candidate.Content.Parts {
- sb.WriteString(part.Text)
- }
- textContent := sb.String()
-
- // Strip code block markers (```language or ```)
- if strings.HasPrefix(textContent, "```") {
- // Find the end of the first line (after ```language)
- firstNewline := strings.Index(textContent, "\n")
- if firstNewline != -1 {
- textContent = textContent[firstNewline+1:]
- } else {
- textContent = strings.TrimPrefix(textContent, "```")
- }
- }
- textContent = strings.TrimSuffix(textContent, "```")
- textContent = strings.TrimSpace(textContent)
-
- resp.Candidates = append(resp.Candidates, &v1pb.AICompletionResponse_Candidate{
- Content: &v1pb.AICompletionResponse_Candidate_Content{
- Parts: []*v1pb.AICompletionResponse_Candidate_Content_Part{
- {
- Text: textContent,
- },
- },
- },
- })
- }
- return connect.NewResponse(resp), nil
-}
-
-// Claude API docs: https://docs.anthropic.com/en/api/getting-started
-func callClaude(ctx context.Context, aiSetting *storepb.AISetting, request *v1pb.AICompletionRequest) (*connect.Response[v1pb.AICompletionResponse], error) {
- // Convert messages to Claude format
- var messages []claudeMessage
- for _, m := range request.Messages {
- messages = append(messages, claudeMessage{
- Role: m.Role,
- Content: m.Content,
- })
- }
-
- payload := claudeRequest{
- Model: aiSetting.Model,
- Messages: messages,
- MaxTokens: 4096,
- Temperature: 0.7,
- TopP: 0.95,
- TopK: 0,
- }
-
- payloadBytes, err := json.Marshal(payload)
- if err != nil {
- return nil, errors.Errorf("failed to marshal Claude request payload: %s", err)
- }
-
- httpReq, err := http.NewRequestWithContext(ctx, "POST", aiSetting.Endpoint, bytes.NewBuffer(payloadBytes))
- if err != nil {
- return nil, errors.Errorf("failed to create HTTP request: %s", err)
- }
-
- httpReq.Header.Set("Content-Type", "application/json")
- httpReq.Header.Set("x-api-key", aiSetting.ApiKey)
- // Claude API requires anthropic-version header
- if aiSetting.Version != "" {
- httpReq.Header.Set("anthropic-version", aiSetting.Version)
- } else {
- httpReq.Header.Set("anthropic-version", "2023-06-01")
- }
-
- client := &http.Client{}
- httpResp, err := client.Do(httpReq)
- if err != nil {
- return nil, errors.Errorf("failed to send HTTP request: %s", err)
- }
- defer httpResp.Body.Close()
-
- body, err := io.ReadAll(httpResp.Body)
- if err != nil {
- return nil, errors.Errorf("failed to read response body: %s", err)
- }
-
- if httpResp.StatusCode != http.StatusOK {
- return nil, errors.Errorf("Claude API returned status %d: %s", httpResp.StatusCode, string(body))
- }
-
- var claudeResp claudeResponse
- if err := json.Unmarshal(body, &claudeResp); err != nil {
- return nil, errors.Errorf("failed to unmarshal Claude response: %s", err)
- }
-
- resp := &v1pb.AICompletionResponse{}
- var sb strings.Builder
- for _, content := range claudeResp.Content {
- if content.Type == "text" {
- sb.WriteString(content.Text)
- }
- }
-
- textContent := sb.String()
- if textContent != "" {
- resp.Candidates = append(resp.Candidates, &v1pb.AICompletionResponse_Candidate{
- Content: &v1pb.AICompletionResponse_Candidate_Content{
- Parts: []*v1pb.AICompletionResponse_Candidate_Content_Part{
- {
- Text: textContent,
- },
- },
- },
- })
- }
-
- return connect.NewResponse(resp), nil
-}
diff --git a/backend/generated-go/v1/sql_service.pb.go b/backend/generated-go/v1/sql_service.pb.go
index 85b6cf1a58..1e4acabac4 100644
--- a/backend/generated-go/v1/sql_service.pb.go
+++ b/backend/generated-go/v1/sql_service.pb.go
@@ -1590,96 +1590,6 @@ func (x *ExportResponse) GetAppliedAccessGrant() string {
return ""
}
-type AICompletionRequest struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- Messages []*AICompletionRequest_Message `protobuf:"bytes,1,rep,name=messages,proto3" json:"messages,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *AICompletionRequest) Reset() {
- *x = AICompletionRequest{}
- mi := &file_v1_sql_service_proto_msgTypes[12]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *AICompletionRequest) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*AICompletionRequest) ProtoMessage() {}
-
-func (x *AICompletionRequest) ProtoReflect() protoreflect.Message {
- mi := &file_v1_sql_service_proto_msgTypes[12]
- if x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use AICompletionRequest.ProtoReflect.Descriptor instead.
-func (*AICompletionRequest) Descriptor() ([]byte, []int) {
- return file_v1_sql_service_proto_rawDescGZIP(), []int{12}
-}
-
-func (x *AICompletionRequest) GetMessages() []*AICompletionRequest_Message {
- if x != nil {
- return x.Messages
- }
- return nil
-}
-
-type AICompletionResponse struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- // candidates is used for results with multiple choices and candidates. Used
- // for OpenAI and Gemini.
- Candidates []*AICompletionResponse_Candidate `protobuf:"bytes,1,rep,name=candidates,proto3" json:"candidates,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *AICompletionResponse) Reset() {
- *x = AICompletionResponse{}
- mi := &file_v1_sql_service_proto_msgTypes[13]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *AICompletionResponse) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*AICompletionResponse) ProtoMessage() {}
-
-func (x *AICompletionResponse) ProtoReflect() protoreflect.Message {
- mi := &file_v1_sql_service_proto_msgTypes[13]
- if x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use AICompletionResponse.ProtoReflect.Descriptor instead.
-func (*AICompletionResponse) Descriptor() ([]byte, []int) {
- return file_v1_sql_service_proto_rawDescGZIP(), []int{13}
-}
-
-func (x *AICompletionResponse) GetCandidates() []*AICompletionResponse_Candidate {
- if x != nil {
- return x.Candidates
- }
- return nil
-}
-
// refer https://www.postgresql.org/docs/11/protocol-error-fields.html
// for field description.
type QueryResult_PostgresError struct {
@@ -1707,7 +1617,7 @@ type QueryResult_PostgresError struct {
func (x *QueryResult_PostgresError) Reset() {
*x = QueryResult_PostgresError{}
- mi := &file_v1_sql_service_proto_msgTypes[14]
+ mi := &file_v1_sql_service_proto_msgTypes[12]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1719,7 +1629,7 @@ func (x *QueryResult_PostgresError) String() string {
func (*QueryResult_PostgresError) ProtoMessage() {}
func (x *QueryResult_PostgresError) ProtoReflect() protoreflect.Message {
- mi := &file_v1_sql_service_proto_msgTypes[14]
+ mi := &file_v1_sql_service_proto_msgTypes[12]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1865,7 +1775,7 @@ type QueryResult_SyntaxError struct {
func (x *QueryResult_SyntaxError) Reset() {
*x = QueryResult_SyntaxError{}
- mi := &file_v1_sql_service_proto_msgTypes[15]
+ mi := &file_v1_sql_service_proto_msgTypes[13]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1877,7 +1787,7 @@ func (x *QueryResult_SyntaxError) String() string {
func (*QueryResult_SyntaxError) ProtoMessage() {}
func (x *QueryResult_SyntaxError) ProtoReflect() protoreflect.Message {
- mi := &file_v1_sql_service_proto_msgTypes[15]
+ mi := &file_v1_sql_service_proto_msgTypes[13]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1912,7 +1822,7 @@ type QueryResult_CommandError struct {
func (x *QueryResult_CommandError) Reset() {
*x = QueryResult_CommandError{}
- mi := &file_v1_sql_service_proto_msgTypes[16]
+ mi := &file_v1_sql_service_proto_msgTypes[14]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1924,7 +1834,7 @@ func (x *QueryResult_CommandError) String() string {
func (*QueryResult_CommandError) ProtoMessage() {}
func (x *QueryResult_CommandError) ProtoReflect() protoreflect.Message {
- mi := &file_v1_sql_service_proto_msgTypes[16]
+ mi := &file_v1_sql_service_proto_msgTypes[14]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1957,7 +1867,7 @@ type QueryResult_Message struct {
func (x *QueryResult_Message) Reset() {
*x = QueryResult_Message{}
- mi := &file_v1_sql_service_proto_msgTypes[17]
+ mi := &file_v1_sql_service_proto_msgTypes[15]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1969,7 +1879,7 @@ func (x *QueryResult_Message) String() string {
func (*QueryResult_Message) ProtoMessage() {}
func (x *QueryResult_Message) ProtoReflect() protoreflect.Message {
- mi := &file_v1_sql_service_proto_msgTypes[17]
+ mi := &file_v1_sql_service_proto_msgTypes[15]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2010,7 +1920,7 @@ type RowValue_Timestamp struct {
func (x *RowValue_Timestamp) Reset() {
*x = RowValue_Timestamp{}
- mi := &file_v1_sql_service_proto_msgTypes[18]
+ mi := &file_v1_sql_service_proto_msgTypes[16]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2022,7 +1932,7 @@ func (x *RowValue_Timestamp) String() string {
func (*RowValue_Timestamp) ProtoMessage() {}
func (x *RowValue_Timestamp) ProtoReflect() protoreflect.Message {
- mi := &file_v1_sql_service_proto_msgTypes[18]
+ mi := &file_v1_sql_service_proto_msgTypes[16]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2071,7 +1981,7 @@ type RowValue_TimestampTZ struct {
func (x *RowValue_TimestampTZ) Reset() {
*x = RowValue_TimestampTZ{}
- mi := &file_v1_sql_service_proto_msgTypes[19]
+ mi := &file_v1_sql_service_proto_msgTypes[17]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2083,7 +1993,7 @@ func (x *RowValue_TimestampTZ) String() string {
func (*RowValue_TimestampTZ) ProtoMessage() {}
func (x *RowValue_TimestampTZ) ProtoReflect() protoreflect.Message {
- mi := &file_v1_sql_service_proto_msgTypes[19]
+ mi := &file_v1_sql_service_proto_msgTypes[17]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2127,191 +2037,6 @@ func (x *RowValue_TimestampTZ) GetAccuracy() int32 {
return 0
}
-type AICompletionRequest_Message struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- Role string `protobuf:"bytes,1,opt,name=role,proto3" json:"role,omitempty"`
- Content string `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *AICompletionRequest_Message) Reset() {
- *x = AICompletionRequest_Message{}
- mi := &file_v1_sql_service_proto_msgTypes[20]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *AICompletionRequest_Message) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*AICompletionRequest_Message) ProtoMessage() {}
-
-func (x *AICompletionRequest_Message) ProtoReflect() protoreflect.Message {
- mi := &file_v1_sql_service_proto_msgTypes[20]
- if x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use AICompletionRequest_Message.ProtoReflect.Descriptor instead.
-func (*AICompletionRequest_Message) Descriptor() ([]byte, []int) {
- return file_v1_sql_service_proto_rawDescGZIP(), []int{12, 0}
-}
-
-func (x *AICompletionRequest_Message) GetRole() string {
- if x != nil {
- return x.Role
- }
- return ""
-}
-
-func (x *AICompletionRequest_Message) GetContent() string {
- if x != nil {
- return x.Content
- }
- return ""
-}
-
-type AICompletionResponse_Candidate struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- Content *AICompletionResponse_Candidate_Content `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *AICompletionResponse_Candidate) Reset() {
- *x = AICompletionResponse_Candidate{}
- mi := &file_v1_sql_service_proto_msgTypes[21]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *AICompletionResponse_Candidate) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*AICompletionResponse_Candidate) ProtoMessage() {}
-
-func (x *AICompletionResponse_Candidate) ProtoReflect() protoreflect.Message {
- mi := &file_v1_sql_service_proto_msgTypes[21]
- if x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use AICompletionResponse_Candidate.ProtoReflect.Descriptor instead.
-func (*AICompletionResponse_Candidate) Descriptor() ([]byte, []int) {
- return file_v1_sql_service_proto_rawDescGZIP(), []int{13, 0}
-}
-
-func (x *AICompletionResponse_Candidate) GetContent() *AICompletionResponse_Candidate_Content {
- if x != nil {
- return x.Content
- }
- return nil
-}
-
-type AICompletionResponse_Candidate_Content struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- // parts is used for a result content with multiple parts.
- Parts []*AICompletionResponse_Candidate_Content_Part `protobuf:"bytes,1,rep,name=parts,proto3" json:"parts,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *AICompletionResponse_Candidate_Content) Reset() {
- *x = AICompletionResponse_Candidate_Content{}
- mi := &file_v1_sql_service_proto_msgTypes[22]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *AICompletionResponse_Candidate_Content) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*AICompletionResponse_Candidate_Content) ProtoMessage() {}
-
-func (x *AICompletionResponse_Candidate_Content) ProtoReflect() protoreflect.Message {
- mi := &file_v1_sql_service_proto_msgTypes[22]
- if x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use AICompletionResponse_Candidate_Content.ProtoReflect.Descriptor instead.
-func (*AICompletionResponse_Candidate_Content) Descriptor() ([]byte, []int) {
- return file_v1_sql_service_proto_rawDescGZIP(), []int{13, 0, 0}
-}
-
-func (x *AICompletionResponse_Candidate_Content) GetParts() []*AICompletionResponse_Candidate_Content_Part {
- if x != nil {
- return x.Parts
- }
- return nil
-}
-
-type AICompletionResponse_Candidate_Content_Part struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- Text string `protobuf:"bytes,1,opt,name=text,proto3" json:"text,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *AICompletionResponse_Candidate_Content_Part) Reset() {
- *x = AICompletionResponse_Candidate_Content_Part{}
- mi := &file_v1_sql_service_proto_msgTypes[23]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *AICompletionResponse_Candidate_Content_Part) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*AICompletionResponse_Candidate_Content_Part) ProtoMessage() {}
-
-func (x *AICompletionResponse_Candidate_Content_Part) ProtoReflect() protoreflect.Message {
- mi := &file_v1_sql_service_proto_msgTypes[23]
- if x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use AICompletionResponse_Candidate_Content_Part.ProtoReflect.Descriptor instead.
-func (*AICompletionResponse_Candidate_Content_Part) Descriptor() ([]byte, []int) {
- return file_v1_sql_service_proto_rawDescGZIP(), []int{13, 0, 0, 0}
-}
-
-func (x *AICompletionResponse_Candidate_Content_Part) GetText() string {
- if x != nil {
- return x.Text
- }
- return ""
-}
-
var File_v1_sql_service_proto protoreflect.FileDescriptor
const file_v1_sql_service_proto_rawDesc = "" +
@@ -2488,22 +2213,7 @@ const file_v1_sql_service_proto_rawDesc = "" +
"\a_schema\"\\\n" +
"\x0eExportResponse\x12\x18\n" +
"\acontent\x18\x01 \x01(\fR\acontent\x120\n" +
- "\x14applied_access_grant\x18\x02 \x01(\tR\x12appliedAccessGrant\"\x94\x01\n" +
- "\x13AICompletionRequest\x12D\n" +
- "\bmessages\x18\x01 \x03(\v2(.bytebase.v1.AICompletionRequest.MessageR\bmessages\x1a7\n" +
- "\aMessage\x12\x12\n" +
- "\x04role\x18\x01 \x01(\tR\x04role\x12\x18\n" +
- "\acontent\x18\x02 \x01(\tR\acontent\"\xb7\x02\n" +
- "\x14AICompletionResponse\x12K\n" +
- "\n" +
- "candidates\x18\x01 \x03(\v2+.bytebase.v1.AICompletionResponse.CandidateR\n" +
- "candidates\x1a\xd1\x01\n" +
- "\tCandidate\x12M\n" +
- "\acontent\x18\x01 \x01(\v23.bytebase.v1.AICompletionResponse.Candidate.ContentR\acontent\x1au\n" +
- "\aContent\x12N\n" +
- "\x05parts\x18\x01 \x03(\v28.bytebase.v1.AICompletionResponse.Candidate.Content.PartR\x05parts\x1a\x1a\n" +
- "\x04Part\x12\x12\n" +
- "\x04text\x18\x01 \x01(\tR\x04text2\x88\b\n" +
+ "\x14applied_access_grant\x18\x02 \x01(\tR\x12appliedAccessGrant2\x8e\a\n" +
"\n" +
"SQLService\x12\x8f\x01\n" +
"\x05Query\x12\x19.bytebase.v1.QueryRequest\x1a\x1a.bytebase.v1.QueryResponse\"O\x8a\xea0\x10bb.databases.get\x90\xea0\x01\x98\xea0\x01\x82\xd3\xe4\x93\x02-:\x01*\"(/v1/{name=instances/*/databases/*}:query\x12\x89\x01\n" +
@@ -2511,8 +2221,7 @@ const file_v1_sql_service_proto_rawDesc = "" +
"\x14SearchQueryHistories\x12(.bytebase.v1.SearchQueryHistoriesRequest\x1a).bytebase.v1.SearchQueryHistoriesResponse\"\a\x90\xea0\x02\x88\x02\x01\x12\x88\x01\n" +
"\x12ListQueryHistories\x12&.bytebase.v1.ListQueryHistoriesRequest\x1a'.bytebase.v1.ListQueryHistoriesResponse\"!\x8a\xea0\x16bb.queryHistories.list\x90\xea0\x01\x88\x02\x01\x12Z\n" +
"\x0fGetQueryHistory\x12#.bytebase.v1.GetQueryHistoryRequest\x1a\x19.bytebase.v1.QueryHistory\"\a\x90\xea0\x02\x88\x02\x01\x12\x84\x02\n" +
- "\x06Export\x12\x1a.bytebase.v1.ExportRequest\x1a\x1b.bytebase.v1.ExportResponse\"\xc0\x01\x8a\xea0\x10bb.databases.get\x90\xea0\x01\x98\xea0\x01\x82\xd3\xe4\x93\x02\x9d\x01:\x01*Z1:\x01*\",/v1/{name=projects/*/plans/*/rollout}:exportZ::\x01*\"5/v1/{name=projects/*/plans/*/rollout/stages/*}:export\")/v1/{name=instances/*/databases/*}:export\x12x\n" +
- "\fAICompletion\x12 .bytebase.v1.AICompletionRequest\x1a!.bytebase.v1.AICompletionResponse\"#\x90\xea0\x02\x82\xd3\xe4\x93\x02\x19:\x01*\"\x14/v1/sql/aiCompletionB\xa5\x01\n" +
+ "\x06Export\x12\x1a.bytebase.v1.ExportRequest\x1a\x1b.bytebase.v1.ExportResponse\"\xc0\x01\x8a\xea0\x10bb.databases.get\x90\xea0\x01\x98\xea0\x01\x82\xd3\xe4\x93\x02\x9d\x01:\x01*Z1:\x01*\",/v1/{name=projects/*/plans/*/rollout}:exportZ::\x01*\"5/v1/{name=projects/*/plans/*/rollout/stages/*}:export\")/v1/{name=instances/*/databases/*}:exportB\xa5\x01\n" +
"\x0fcom.bytebase.v1B\x0fSqlServiceProtoP\x01Z4github.com/bytebase/bytebase/backend/generated-go/v1\xa2\x02\x03BXX\xaa\x02\vBytebase.V1\xca\x02\vBytebase\\V1\xe2\x02\x17Bytebase\\V1\\GPBMetadata\xea\x02\fBytebase::V1b\x06proto3"
var (
@@ -2528,51 +2237,45 @@ func file_v1_sql_service_proto_rawDescGZIP() []byte {
}
var file_v1_sql_service_proto_enumTypes = make([]protoimpl.EnumInfo, 6)
-var file_v1_sql_service_proto_msgTypes = make([]protoimpl.MessageInfo, 24)
+var file_v1_sql_service_proto_msgTypes = make([]protoimpl.MessageInfo, 18)
var file_v1_sql_service_proto_goTypes = []any{
- (QueryOption_RedisRunCommandsOn)(0), // 0: bytebase.v1.QueryOption.RedisRunCommandsOn
- (QueryOption_MSSQLExplainFormat)(0), // 1: bytebase.v1.QueryOption.MSSQLExplainFormat
- (QueryResult_CommandError_Type)(0), // 2: bytebase.v1.QueryResult.CommandError.Type
- (QueryResult_Message_Level)(0), // 3: bytebase.v1.QueryResult.Message.Level
- (Advice_Level)(0), // 4: bytebase.v1.Advice.Level
- (Advice_RuleType)(0), // 5: bytebase.v1.Advice.RuleType
- (*AdminExecuteRequest)(nil), // 6: bytebase.v1.AdminExecuteRequest
- (*AdminExecuteResponse)(nil), // 7: bytebase.v1.AdminExecuteResponse
- (*QueryRequest)(nil), // 8: bytebase.v1.QueryRequest
- (*QueryResponse)(nil), // 9: bytebase.v1.QueryResponse
- (*QueryOption)(nil), // 10: bytebase.v1.QueryOption
- (*QueryResult)(nil), // 11: bytebase.v1.QueryResult
- (*MaskingReason)(nil), // 12: bytebase.v1.MaskingReason
- (*QueryRow)(nil), // 13: bytebase.v1.QueryRow
- (*RowValue)(nil), // 14: bytebase.v1.RowValue
- (*Advice)(nil), // 15: bytebase.v1.Advice
- (*ExportRequest)(nil), // 16: bytebase.v1.ExportRequest
- (*ExportResponse)(nil), // 17: bytebase.v1.ExportResponse
- (*AICompletionRequest)(nil), // 18: bytebase.v1.AICompletionRequest
- (*AICompletionResponse)(nil), // 19: bytebase.v1.AICompletionResponse
- (*QueryResult_PostgresError)(nil), // 20: bytebase.v1.QueryResult.PostgresError
- (*QueryResult_SyntaxError)(nil), // 21: bytebase.v1.QueryResult.SyntaxError
- (*QueryResult_CommandError)(nil), // 22: bytebase.v1.QueryResult.CommandError
- (*QueryResult_Message)(nil), // 23: bytebase.v1.QueryResult.Message
- (*RowValue_Timestamp)(nil), // 24: bytebase.v1.RowValue.Timestamp
- (*RowValue_TimestampTZ)(nil), // 25: bytebase.v1.RowValue.TimestampTZ
- (*AICompletionRequest_Message)(nil), // 26: bytebase.v1.AICompletionRequest.Message
- (*AICompletionResponse_Candidate)(nil), // 27: bytebase.v1.AICompletionResponse.Candidate
- (*AICompletionResponse_Candidate_Content)(nil), // 28: bytebase.v1.AICompletionResponse.Candidate.Content
- (*AICompletionResponse_Candidate_Content_Part)(nil), // 29: bytebase.v1.AICompletionResponse.Candidate.Content.Part
- (*durationpb.Duration)(nil), // 30: google.protobuf.Duration
- (*PermissionDeniedDetail)(nil), // 31: bytebase.v1.PermissionDeniedDetail
- (structpb.NullValue)(0), // 32: google.protobuf.NullValue
- (*structpb.Value)(nil), // 33: google.protobuf.Value
- (*Position)(nil), // 34: bytebase.v1.Position
- (ExportFormat)(0), // 35: bytebase.v1.ExportFormat
- (*timestamppb.Timestamp)(nil), // 36: google.protobuf.Timestamp
- (*SearchQueryHistoriesRequest)(nil), // 37: bytebase.v1.SearchQueryHistoriesRequest
- (*ListQueryHistoriesRequest)(nil), // 38: bytebase.v1.ListQueryHistoriesRequest
- (*GetQueryHistoryRequest)(nil), // 39: bytebase.v1.GetQueryHistoryRequest
- (*SearchQueryHistoriesResponse)(nil), // 40: bytebase.v1.SearchQueryHistoriesResponse
- (*ListQueryHistoriesResponse)(nil), // 41: bytebase.v1.ListQueryHistoriesResponse
- (*QueryHistory)(nil), // 42: bytebase.v1.QueryHistory
+ (QueryOption_RedisRunCommandsOn)(0), // 0: bytebase.v1.QueryOption.RedisRunCommandsOn
+ (QueryOption_MSSQLExplainFormat)(0), // 1: bytebase.v1.QueryOption.MSSQLExplainFormat
+ (QueryResult_CommandError_Type)(0), // 2: bytebase.v1.QueryResult.CommandError.Type
+ (QueryResult_Message_Level)(0), // 3: bytebase.v1.QueryResult.Message.Level
+ (Advice_Level)(0), // 4: bytebase.v1.Advice.Level
+ (Advice_RuleType)(0), // 5: bytebase.v1.Advice.RuleType
+ (*AdminExecuteRequest)(nil), // 6: bytebase.v1.AdminExecuteRequest
+ (*AdminExecuteResponse)(nil), // 7: bytebase.v1.AdminExecuteResponse
+ (*QueryRequest)(nil), // 8: bytebase.v1.QueryRequest
+ (*QueryResponse)(nil), // 9: bytebase.v1.QueryResponse
+ (*QueryOption)(nil), // 10: bytebase.v1.QueryOption
+ (*QueryResult)(nil), // 11: bytebase.v1.QueryResult
+ (*MaskingReason)(nil), // 12: bytebase.v1.MaskingReason
+ (*QueryRow)(nil), // 13: bytebase.v1.QueryRow
+ (*RowValue)(nil), // 14: bytebase.v1.RowValue
+ (*Advice)(nil), // 15: bytebase.v1.Advice
+ (*ExportRequest)(nil), // 16: bytebase.v1.ExportRequest
+ (*ExportResponse)(nil), // 17: bytebase.v1.ExportResponse
+ (*QueryResult_PostgresError)(nil), // 18: bytebase.v1.QueryResult.PostgresError
+ (*QueryResult_SyntaxError)(nil), // 19: bytebase.v1.QueryResult.SyntaxError
+ (*QueryResult_CommandError)(nil), // 20: bytebase.v1.QueryResult.CommandError
+ (*QueryResult_Message)(nil), // 21: bytebase.v1.QueryResult.Message
+ (*RowValue_Timestamp)(nil), // 22: bytebase.v1.RowValue.Timestamp
+ (*RowValue_TimestampTZ)(nil), // 23: bytebase.v1.RowValue.TimestampTZ
+ (*durationpb.Duration)(nil), // 24: google.protobuf.Duration
+ (*PermissionDeniedDetail)(nil), // 25: bytebase.v1.PermissionDeniedDetail
+ (structpb.NullValue)(0), // 26: google.protobuf.NullValue
+ (*structpb.Value)(nil), // 27: google.protobuf.Value
+ (*Position)(nil), // 28: bytebase.v1.Position
+ (ExportFormat)(0), // 29: bytebase.v1.ExportFormat
+ (*timestamppb.Timestamp)(nil), // 30: google.protobuf.Timestamp
+ (*SearchQueryHistoriesRequest)(nil), // 31: bytebase.v1.SearchQueryHistoriesRequest
+ (*ListQueryHistoriesRequest)(nil), // 32: bytebase.v1.ListQueryHistoriesRequest
+ (*GetQueryHistoryRequest)(nil), // 33: bytebase.v1.GetQueryHistoryRequest
+ (*SearchQueryHistoriesResponse)(nil), // 34: bytebase.v1.SearchQueryHistoriesResponse
+ (*ListQueryHistoriesResponse)(nil), // 35: bytebase.v1.ListQueryHistoriesResponse
+ (*QueryHistory)(nil), // 36: bytebase.v1.QueryHistory
}
var file_v1_sql_service_proto_depIdxs = []int32{
11, // 0: bytebase.v1.AdminExecuteResponse.results:type_name -> bytebase.v1.QueryResult
@@ -2581,51 +2284,45 @@ var file_v1_sql_service_proto_depIdxs = []int32{
0, // 3: bytebase.v1.QueryOption.redis_run_commands_on:type_name -> bytebase.v1.QueryOption.RedisRunCommandsOn
1, // 4: bytebase.v1.QueryOption.mssql_explain_format:type_name -> bytebase.v1.QueryOption.MSSQLExplainFormat
13, // 5: bytebase.v1.QueryResult.rows:type_name -> bytebase.v1.QueryRow
- 30, // 6: bytebase.v1.QueryResult.latency:type_name -> google.protobuf.Duration
- 20, // 7: bytebase.v1.QueryResult.postgres_error:type_name -> bytebase.v1.QueryResult.PostgresError
- 21, // 8: bytebase.v1.QueryResult.syntax_error:type_name -> bytebase.v1.QueryResult.SyntaxError
- 31, // 9: bytebase.v1.QueryResult.permission_denied:type_name -> bytebase.v1.PermissionDeniedDetail
- 22, // 10: bytebase.v1.QueryResult.command_error:type_name -> bytebase.v1.QueryResult.CommandError
- 23, // 11: bytebase.v1.QueryResult.messages:type_name -> bytebase.v1.QueryResult.Message
+ 24, // 6: bytebase.v1.QueryResult.latency:type_name -> google.protobuf.Duration
+ 18, // 7: bytebase.v1.QueryResult.postgres_error:type_name -> bytebase.v1.QueryResult.PostgresError
+ 19, // 8: bytebase.v1.QueryResult.syntax_error:type_name -> bytebase.v1.QueryResult.SyntaxError
+ 25, // 9: bytebase.v1.QueryResult.permission_denied:type_name -> bytebase.v1.PermissionDeniedDetail
+ 20, // 10: bytebase.v1.QueryResult.command_error:type_name -> bytebase.v1.QueryResult.CommandError
+ 21, // 11: bytebase.v1.QueryResult.messages:type_name -> bytebase.v1.QueryResult.Message
12, // 12: bytebase.v1.QueryResult.masked:type_name -> bytebase.v1.MaskingReason
14, // 13: bytebase.v1.QueryRow.values:type_name -> bytebase.v1.RowValue
- 32, // 14: bytebase.v1.RowValue.null_value:type_name -> google.protobuf.NullValue
- 33, // 15: bytebase.v1.RowValue.value_value:type_name -> google.protobuf.Value
- 24, // 16: bytebase.v1.RowValue.timestamp_value:type_name -> bytebase.v1.RowValue.Timestamp
- 25, // 17: bytebase.v1.RowValue.timestamp_tz_value:type_name -> bytebase.v1.RowValue.TimestampTZ
+ 26, // 14: bytebase.v1.RowValue.null_value:type_name -> google.protobuf.NullValue
+ 27, // 15: bytebase.v1.RowValue.value_value:type_name -> google.protobuf.Value
+ 22, // 16: bytebase.v1.RowValue.timestamp_value:type_name -> bytebase.v1.RowValue.Timestamp
+ 23, // 17: bytebase.v1.RowValue.timestamp_tz_value:type_name -> bytebase.v1.RowValue.TimestampTZ
4, // 18: bytebase.v1.Advice.status:type_name -> bytebase.v1.Advice.Level
- 34, // 19: bytebase.v1.Advice.start_position:type_name -> bytebase.v1.Position
- 34, // 20: bytebase.v1.Advice.end_position:type_name -> bytebase.v1.Position
+ 28, // 19: bytebase.v1.Advice.start_position:type_name -> bytebase.v1.Position
+ 28, // 20: bytebase.v1.Advice.end_position:type_name -> bytebase.v1.Position
5, // 21: bytebase.v1.Advice.rule_type:type_name -> bytebase.v1.Advice.RuleType
- 35, // 22: bytebase.v1.ExportRequest.format:type_name -> bytebase.v1.ExportFormat
- 26, // 23: bytebase.v1.AICompletionRequest.messages:type_name -> bytebase.v1.AICompletionRequest.Message
- 27, // 24: bytebase.v1.AICompletionResponse.candidates:type_name -> bytebase.v1.AICompletionResponse.Candidate
- 34, // 25: bytebase.v1.QueryResult.SyntaxError.start_position:type_name -> bytebase.v1.Position
- 2, // 26: bytebase.v1.QueryResult.CommandError.command_type:type_name -> bytebase.v1.QueryResult.CommandError.Type
- 3, // 27: bytebase.v1.QueryResult.Message.level:type_name -> bytebase.v1.QueryResult.Message.Level
- 36, // 28: bytebase.v1.RowValue.Timestamp.google_timestamp:type_name -> google.protobuf.Timestamp
- 36, // 29: bytebase.v1.RowValue.TimestampTZ.google_timestamp:type_name -> google.protobuf.Timestamp
- 28, // 30: bytebase.v1.AICompletionResponse.Candidate.content:type_name -> bytebase.v1.AICompletionResponse.Candidate.Content
- 29, // 31: bytebase.v1.AICompletionResponse.Candidate.Content.parts:type_name -> bytebase.v1.AICompletionResponse.Candidate.Content.Part
- 8, // 32: bytebase.v1.SQLService.Query:input_type -> bytebase.v1.QueryRequest
- 6, // 33: bytebase.v1.SQLService.AdminExecute:input_type -> bytebase.v1.AdminExecuteRequest
- 37, // 34: bytebase.v1.SQLService.SearchQueryHistories:input_type -> bytebase.v1.SearchQueryHistoriesRequest
- 38, // 35: bytebase.v1.SQLService.ListQueryHistories:input_type -> bytebase.v1.ListQueryHistoriesRequest
- 39, // 36: bytebase.v1.SQLService.GetQueryHistory:input_type -> bytebase.v1.GetQueryHistoryRequest
- 16, // 37: bytebase.v1.SQLService.Export:input_type -> bytebase.v1.ExportRequest
- 18, // 38: bytebase.v1.SQLService.AICompletion:input_type -> bytebase.v1.AICompletionRequest
- 9, // 39: bytebase.v1.SQLService.Query:output_type -> bytebase.v1.QueryResponse
- 7, // 40: bytebase.v1.SQLService.AdminExecute:output_type -> bytebase.v1.AdminExecuteResponse
- 40, // 41: bytebase.v1.SQLService.SearchQueryHistories:output_type -> bytebase.v1.SearchQueryHistoriesResponse
- 41, // 42: bytebase.v1.SQLService.ListQueryHistories:output_type -> bytebase.v1.ListQueryHistoriesResponse
- 42, // 43: bytebase.v1.SQLService.GetQueryHistory:output_type -> bytebase.v1.QueryHistory
- 17, // 44: bytebase.v1.SQLService.Export:output_type -> bytebase.v1.ExportResponse
- 19, // 45: bytebase.v1.SQLService.AICompletion:output_type -> bytebase.v1.AICompletionResponse
- 39, // [39:46] is the sub-list for method output_type
- 32, // [32:39] is the sub-list for method input_type
- 32, // [32:32] is the sub-list for extension type_name
- 32, // [32:32] is the sub-list for extension extendee
- 0, // [0:32] is the sub-list for field type_name
+ 29, // 22: bytebase.v1.ExportRequest.format:type_name -> bytebase.v1.ExportFormat
+ 28, // 23: bytebase.v1.QueryResult.SyntaxError.start_position:type_name -> bytebase.v1.Position
+ 2, // 24: bytebase.v1.QueryResult.CommandError.command_type:type_name -> bytebase.v1.QueryResult.CommandError.Type
+ 3, // 25: bytebase.v1.QueryResult.Message.level:type_name -> bytebase.v1.QueryResult.Message.Level
+ 30, // 26: bytebase.v1.RowValue.Timestamp.google_timestamp:type_name -> google.protobuf.Timestamp
+ 30, // 27: bytebase.v1.RowValue.TimestampTZ.google_timestamp:type_name -> google.protobuf.Timestamp
+ 8, // 28: bytebase.v1.SQLService.Query:input_type -> bytebase.v1.QueryRequest
+ 6, // 29: bytebase.v1.SQLService.AdminExecute:input_type -> bytebase.v1.AdminExecuteRequest
+ 31, // 30: bytebase.v1.SQLService.SearchQueryHistories:input_type -> bytebase.v1.SearchQueryHistoriesRequest
+ 32, // 31: bytebase.v1.SQLService.ListQueryHistories:input_type -> bytebase.v1.ListQueryHistoriesRequest
+ 33, // 32: bytebase.v1.SQLService.GetQueryHistory:input_type -> bytebase.v1.GetQueryHistoryRequest
+ 16, // 33: bytebase.v1.SQLService.Export:input_type -> bytebase.v1.ExportRequest
+ 9, // 34: bytebase.v1.SQLService.Query:output_type -> bytebase.v1.QueryResponse
+ 7, // 35: bytebase.v1.SQLService.AdminExecute:output_type -> bytebase.v1.AdminExecuteResponse
+ 34, // 36: bytebase.v1.SQLService.SearchQueryHistories:output_type -> bytebase.v1.SearchQueryHistoriesResponse
+ 35, // 37: bytebase.v1.SQLService.ListQueryHistories:output_type -> bytebase.v1.ListQueryHistoriesResponse
+ 36, // 38: bytebase.v1.SQLService.GetQueryHistory:output_type -> bytebase.v1.QueryHistory
+ 17, // 39: bytebase.v1.SQLService.Export:output_type -> bytebase.v1.ExportResponse
+ 34, // [34:40] is the sub-list for method output_type
+ 28, // [28:34] is the sub-list for method input_type
+ 28, // [28:28] is the sub-list for extension type_name
+ 28, // [28:28] is the sub-list for extension extendee
+ 0, // [0:28] is the sub-list for field type_name
}
func init() { file_v1_sql_service_proto_init() }
@@ -2666,7 +2363,7 @@ func file_v1_sql_service_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_v1_sql_service_proto_rawDesc), len(file_v1_sql_service_proto_rawDesc)),
NumEnums: 6,
- NumMessages: 24,
+ NumMessages: 18,
NumExtensions: 0,
NumServices: 1,
},
diff --git a/backend/generated-go/v1/sql_service.pb.gw.go b/backend/generated-go/v1/sql_service.pb.gw.go
index f0121f0a74..dda2273ce3 100644
--- a/backend/generated-go/v1/sql_service.pb.gw.go
+++ b/backend/generated-go/v1/sql_service.pb.gw.go
@@ -258,33 +258,6 @@ func local_request_SQLService_Export_2(ctx context.Context, marshaler runtime.Ma
return msg, metadata, err
}
-func request_SQLService_AICompletion_0(ctx context.Context, marshaler runtime.Marshaler, client SQLServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var (
- protoReq AICompletionRequest
- metadata runtime.ServerMetadata
- )
- if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- if req.Body != nil {
- _, _ = io.Copy(io.Discard, req.Body)
- }
- msg, err := client.AICompletion(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-}
-
-func local_request_SQLService_AICompletion_0(ctx context.Context, marshaler runtime.Marshaler, server SQLServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var (
- protoReq AICompletionRequest
- metadata runtime.ServerMetadata
- )
- if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- msg, err := server.AICompletion(ctx, &protoReq)
- return msg, metadata, err
-}
-
// RegisterSQLServiceHandlerServer registers the http handlers for service SQLService to "mux".
// UnaryRPC :call SQLServiceServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
@@ -378,26 +351,6 @@ func RegisterSQLServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux,
}
forward_SQLService_Export_2(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
- mux.Handle(http.MethodPost, pattern_SQLService_AICompletion_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(req.Context())
- defer cancel()
- var stream runtime.ServerTransportStream
- ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.SQLService/AICompletion", runtime.WithHTTPPathPattern("/v1/sql/aiCompletion"))
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
- resp, md, err := local_request_SQLService_AICompletion_0(annotatedContext, inboundMarshaler, server, req, pathParams)
- md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
- annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
- if err != nil {
- runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
- return
- }
- forward_SQLService_AICompletion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
- })
return nil
}
@@ -523,23 +476,6 @@ func RegisterSQLServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux,
}
forward_SQLService_Export_2(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
- mux.Handle(http.MethodPost, pattern_SQLService_AICompletion_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(req.Context())
- defer cancel()
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.SQLService/AICompletion", runtime.WithHTTPPathPattern("/v1/sql/aiCompletion"))
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
- resp, md, err := request_SQLService_AICompletion_0(annotatedContext, inboundMarshaler, client, req, pathParams)
- annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
- if err != nil {
- runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
- return
- }
- forward_SQLService_AICompletion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
- })
return nil
}
@@ -549,7 +485,6 @@ var (
pattern_SQLService_Export_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"v1", "instances", "databases", "name"}, "export"))
pattern_SQLService_Export_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 2, 3, 4, 5, 5, 4}, []string{"v1", "projects", "plans", "rollout", "name"}, "export"))
pattern_SQLService_Export_2 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 2, 3, 2, 4, 1, 0, 4, 7, 5, 5}, []string{"v1", "projects", "plans", "rollout", "stages", "name"}, "export"))
- pattern_SQLService_AICompletion_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "sql", "aiCompletion"}, ""))
)
var (
@@ -558,5 +493,4 @@ var (
forward_SQLService_Export_0 = runtime.ForwardResponseMessage
forward_SQLService_Export_1 = runtime.ForwardResponseMessage
forward_SQLService_Export_2 = runtime.ForwardResponseMessage
- forward_SQLService_AICompletion_0 = runtime.ForwardResponseMessage
)
diff --git a/backend/generated-go/v1/sql_service_equal.pb.go b/backend/generated-go/v1/sql_service_equal.pb.go
index 437b28f7f1..9bf05b92c6 100644
--- a/backend/generated-go/v1/sql_service_equal.pb.go
+++ b/backend/generated-go/v1/sql_service_equal.pb.go
@@ -518,99 +518,3 @@ func (x *ExportResponse) Equal(y *ExportResponse) bool {
}
return true
}
-
-func (x *AICompletionRequest_Message) Equal(y *AICompletionRequest_Message) bool {
- if x == y {
- return true
- }
- if x == nil || y == nil {
- return x == nil && y == nil
- }
- if x.Role != y.Role {
- return false
- }
- if x.Content != y.Content {
- return false
- }
- return true
-}
-
-func (x *AICompletionRequest) Equal(y *AICompletionRequest) bool {
- if x == y {
- return true
- }
- if x == nil || y == nil {
- return x == nil && y == nil
- }
- if len(x.Messages) != len(y.Messages) {
- return false
- }
- for i := 0; i < len(x.Messages); i++ {
- if !x.Messages[i].Equal(y.Messages[i]) {
- return false
- }
- }
- return true
-}
-
-func (x *AICompletionResponse_Candidate_Content_Part) Equal(y *AICompletionResponse_Candidate_Content_Part) bool {
- if x == y {
- return true
- }
- if x == nil || y == nil {
- return x == nil && y == nil
- }
- if x.Text != y.Text {
- return false
- }
- return true
-}
-
-func (x *AICompletionResponse_Candidate_Content) Equal(y *AICompletionResponse_Candidate_Content) bool {
- if x == y {
- return true
- }
- if x == nil || y == nil {
- return x == nil && y == nil
- }
- if len(x.Parts) != len(y.Parts) {
- return false
- }
- for i := 0; i < len(x.Parts); i++ {
- if !x.Parts[i].Equal(y.Parts[i]) {
- return false
- }
- }
- return true
-}
-
-func (x *AICompletionResponse_Candidate) Equal(y *AICompletionResponse_Candidate) bool {
- if x == y {
- return true
- }
- if x == nil || y == nil {
- return x == nil && y == nil
- }
- if !x.Content.Equal(y.Content) {
- return false
- }
- return true
-}
-
-func (x *AICompletionResponse) Equal(y *AICompletionResponse) bool {
- if x == y {
- return true
- }
- if x == nil || y == nil {
- return x == nil && y == nil
- }
- if len(x.Candidates) != len(y.Candidates) {
- return false
- }
- for i := 0; i < len(x.Candidates); i++ {
- if !x.Candidates[i].Equal(y.Candidates[i]) {
- return false
- }
- }
- return true
-}
diff --git a/backend/generated-go/v1/sql_service_grpc.pb.go b/backend/generated-go/v1/sql_service_grpc.pb.go
index 6844a9a105..ec70c07e84 100644
--- a/backend/generated-go/v1/sql_service_grpc.pb.go
+++ b/backend/generated-go/v1/sql_service_grpc.pb.go
@@ -25,7 +25,6 @@ const (
SQLService_ListQueryHistories_FullMethodName = "/bytebase.v1.SQLService/ListQueryHistories"
SQLService_GetQueryHistory_FullMethodName = "/bytebase.v1.SQLService/GetQueryHistory"
SQLService_Export_FullMethodName = "/bytebase.v1.SQLService/Export"
- SQLService_AICompletion_FullMethodName = "/bytebase.v1.SQLService/AICompletion"
)
// SQLServiceClient is the client API for SQLService service.
@@ -61,9 +60,6 @@ type SQLServiceClient interface {
// Exports query results to a file format.
// Permissions required: bb.databases.get
Export(ctx context.Context, in *ExportRequest, opts ...grpc.CallOption) (*ExportResponse, error)
- // Provides AI-powered SQL completion and generation.
- // Permissions required: None (authenticated users only, requires AI to be enabled)
- AICompletion(ctx context.Context, in *AICompletionRequest, opts ...grpc.CallOption) (*AICompletionResponse, error)
}
type sQLServiceClient struct {
@@ -140,16 +136,6 @@ func (c *sQLServiceClient) Export(ctx context.Context, in *ExportRequest, opts .
return out, nil
}
-func (c *sQLServiceClient) AICompletion(ctx context.Context, in *AICompletionRequest, opts ...grpc.CallOption) (*AICompletionResponse, error) {
- cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
- out := new(AICompletionResponse)
- err := c.cc.Invoke(ctx, SQLService_AICompletion_FullMethodName, in, out, cOpts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
// SQLServiceServer is the server API for SQLService service.
// All implementations must embed UnimplementedSQLServiceServer
// for forward compatibility.
@@ -183,9 +169,6 @@ type SQLServiceServer interface {
// Exports query results to a file format.
// Permissions required: bb.databases.get
Export(context.Context, *ExportRequest) (*ExportResponse, error)
- // Provides AI-powered SQL completion and generation.
- // Permissions required: None (authenticated users only, requires AI to be enabled)
- AICompletion(context.Context, *AICompletionRequest) (*AICompletionResponse, error)
mustEmbedUnimplementedSQLServiceServer()
}
@@ -214,9 +197,6 @@ func (UnimplementedSQLServiceServer) GetQueryHistory(context.Context, *GetQueryH
func (UnimplementedSQLServiceServer) Export(context.Context, *ExportRequest) (*ExportResponse, error) {
return nil, status.Error(codes.Unimplemented, "method Export not implemented")
}
-func (UnimplementedSQLServiceServer) AICompletion(context.Context, *AICompletionRequest) (*AICompletionResponse, error) {
- return nil, status.Error(codes.Unimplemented, "method AICompletion not implemented")
-}
func (UnimplementedSQLServiceServer) mustEmbedUnimplementedSQLServiceServer() {}
func (UnimplementedSQLServiceServer) testEmbeddedByValue() {}
@@ -335,24 +315,6 @@ func _SQLService_Export_Handler(srv interface{}, ctx context.Context, dec func(i
return interceptor(ctx, in, info, handler)
}
-func _SQLService_AICompletion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(AICompletionRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(SQLServiceServer).AICompletion(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: SQLService_AICompletion_FullMethodName,
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(SQLServiceServer).AICompletion(ctx, req.(*AICompletionRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
// SQLService_ServiceDesc is the grpc.ServiceDesc for SQLService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@@ -380,10 +342,6 @@ var SQLService_ServiceDesc = grpc.ServiceDesc{
MethodName: "Export",
Handler: _SQLService_Export_Handler,
},
- {
- MethodName: "AICompletion",
- Handler: _SQLService_AICompletion_Handler,
- },
},
Streams: []grpc.StreamDesc{
{
diff --git a/backend/generated-go/v1/v1connect/sql_service.connect.go b/backend/generated-go/v1/v1connect/sql_service.connect.go
index f229e1cb8c..cc7fde62a1 100644
--- a/backend/generated-go/v1/v1connect/sql_service.connect.go
+++ b/backend/generated-go/v1/v1connect/sql_service.connect.go
@@ -48,8 +48,6 @@ const (
SQLServiceGetQueryHistoryProcedure = "/bytebase.v1.SQLService/GetQueryHistory"
// SQLServiceExportProcedure is the fully-qualified name of the SQLService's Export RPC.
SQLServiceExportProcedure = "/bytebase.v1.SQLService/Export"
- // SQLServiceAICompletionProcedure is the fully-qualified name of the SQLService's AICompletion RPC.
- SQLServiceAICompletionProcedure = "/bytebase.v1.SQLService/AICompletion"
)
// SQLServiceClient is a client for the bytebase.v1.SQLService service.
@@ -84,9 +82,6 @@ type SQLServiceClient interface {
// Exports query results to a file format.
// Permissions required: bb.databases.get
Export(context.Context, *connect.Request[v1.ExportRequest]) (*connect.Response[v1.ExportResponse], error)
- // Provides AI-powered SQL completion and generation.
- // Permissions required: None (authenticated users only, requires AI to be enabled)
- AICompletion(context.Context, *connect.Request[v1.AICompletionRequest]) (*connect.Response[v1.AICompletionResponse], error)
}
// NewSQLServiceClient constructs a client for the bytebase.v1.SQLService service. By default, it
@@ -136,12 +131,6 @@ func NewSQLServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...
connect.WithSchema(sQLServiceMethods.ByName("Export")),
connect.WithClientOptions(opts...),
),
- aICompletion: connect.NewClient[v1.AICompletionRequest, v1.AICompletionResponse](
- httpClient,
- baseURL+SQLServiceAICompletionProcedure,
- connect.WithSchema(sQLServiceMethods.ByName("AICompletion")),
- connect.WithClientOptions(opts...),
- ),
}
}
@@ -153,7 +142,6 @@ type sQLServiceClient struct {
listQueryHistories *connect.Client[v1.ListQueryHistoriesRequest, v1.ListQueryHistoriesResponse]
getQueryHistory *connect.Client[v1.GetQueryHistoryRequest, v1.QueryHistory]
export *connect.Client[v1.ExportRequest, v1.ExportResponse]
- aICompletion *connect.Client[v1.AICompletionRequest, v1.AICompletionResponse]
}
// Query calls bytebase.v1.SQLService.Query.
@@ -192,11 +180,6 @@ func (c *sQLServiceClient) Export(ctx context.Context, req *connect.Request[v1.E
return c.export.CallUnary(ctx, req)
}
-// AICompletion calls bytebase.v1.SQLService.AICompletion.
-func (c *sQLServiceClient) AICompletion(ctx context.Context, req *connect.Request[v1.AICompletionRequest]) (*connect.Response[v1.AICompletionResponse], error) {
- return c.aICompletion.CallUnary(ctx, req)
-}
-
// SQLServiceHandler is an implementation of the bytebase.v1.SQLService service.
type SQLServiceHandler interface {
// Executes a read-only SQL query against a database.
@@ -229,9 +212,6 @@ type SQLServiceHandler interface {
// Exports query results to a file format.
// Permissions required: bb.databases.get
Export(context.Context, *connect.Request[v1.ExportRequest]) (*connect.Response[v1.ExportResponse], error)
- // Provides AI-powered SQL completion and generation.
- // Permissions required: None (authenticated users only, requires AI to be enabled)
- AICompletion(context.Context, *connect.Request[v1.AICompletionRequest]) (*connect.Response[v1.AICompletionResponse], error)
}
// NewSQLServiceHandler builds an HTTP handler from the service implementation. It returns the path
@@ -277,12 +257,6 @@ func NewSQLServiceHandler(svc SQLServiceHandler, opts ...connect.HandlerOption)
connect.WithSchema(sQLServiceMethods.ByName("Export")),
connect.WithHandlerOptions(opts...),
)
- sQLServiceAICompletionHandler := connect.NewUnaryHandler(
- SQLServiceAICompletionProcedure,
- svc.AICompletion,
- connect.WithSchema(sQLServiceMethods.ByName("AICompletion")),
- connect.WithHandlerOptions(opts...),
- )
return "/bytebase.v1.SQLService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
switch r.URL.Path {
case SQLServiceQueryProcedure:
@@ -297,8 +271,6 @@ func NewSQLServiceHandler(svc SQLServiceHandler, opts ...connect.HandlerOption)
sQLServiceGetQueryHistoryHandler.ServeHTTP(w, r)
case SQLServiceExportProcedure:
sQLServiceExportHandler.ServeHTTP(w, r)
- case SQLServiceAICompletionProcedure:
- sQLServiceAICompletionHandler.ServeHTTP(w, r)
default:
http.NotFound(w, r)
}
@@ -331,7 +303,3 @@ func (UnimplementedSQLServiceHandler) GetQueryHistory(context.Context, *connect.
func (UnimplementedSQLServiceHandler) Export(context.Context, *connect.Request[v1.ExportRequest]) (*connect.Response[v1.ExportResponse], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("bytebase.v1.SQLService.Export is not implemented"))
}
-
-func (UnimplementedSQLServiceHandler) AICompletion(context.Context, *connect.Request[v1.AICompletionRequest]) (*connect.Response[v1.AICompletionResponse], error) {
- return nil, connect.NewError(connect.CodeUnimplemented, errors.New("bytebase.v1.SQLService.AICompletion is not implemented"))
-}
diff --git a/docs/plans/saas/07.api-resource-patterns.md b/docs/plans/saas/07.api-resource-patterns.md
index 64823e897a..7194393c83 100644
--- a/docs/plans/saas/07.api-resource-patterns.md
+++ b/docs/plans/saas/07.api-resource-patterns.md
@@ -161,15 +161,21 @@ Accepts:
- `workspaces/{workspace}` resource
-### SQLService — AICompletion
+### SQLService — Notes
-- Workspace-level utility method (no resource parent)
- The query history RPCs moved to QueryHistoryService (see the
`projects/{project}` parent table); SQLService keeps deprecated delegating
aliases without HTTP bindings until their removal (date TBD)
- DiffMetadata moved to DatabaseService (database-parented, reads the source
schema from the store, gated by bb.databases.diffMetadata); the old
anonymous SQLService method and its REST path are removed
+- AICompletion is removed; all AI chat goes through AIService.Chat
+
+### AIService — Chat
+
+- Workspace-level utility method (no resource parent)
+- CUSTOM auth: authenticated users only, requires the workspace AI setting
+ to be enabled
---
diff --git a/frontend/src/modules/ai/components/ChatPanel.tsx b/frontend/src/modules/ai/components/ChatPanel.tsx
index c77b9cd01b..162b50e87a 100644
--- a/frontend/src/modules/ai/components/ChatPanel.tsx
+++ b/frontend/src/modules/ai/components/ChatPanel.tsx
@@ -1,17 +1,16 @@
import { create as createProto } from "@bufbuild/protobuf";
-import { head } from "lodash-es";
import { Loader2 } from "lucide-react";
import { useCallback, useEffect, useRef, useState } from "react";
-import { sqlServiceClientConnect } from "@/api";
+import { aiServiceClientConnect } from "@/api";
import {
getCurrentSQLEditorTab,
useCurrentSQLEditorTab,
} from "@/modules/sql-editor/store/tab";
import {
- type AICompletionRequest_Message,
- AICompletionRequest_MessageSchema,
- AICompletionRequestSchema,
-} from "@/types/proto-es/v1/sql_service_pb";
+ type AIChatMessage,
+ AIChatMessageRole,
+ AIChatMessageSchema,
+} from "@/types/proto-es/v1/ai_service_pb";
import { nextAnimationFrame } from "@/utils";
import * as promptUtils from "../logic/prompt";
import { useConversationStore } from "../store";
@@ -34,7 +33,7 @@ import { PromptInput } from "./PromptInput";
* prepend the schema declaration so the model has context. Subsequent
* messages use the bare query.
* 2. Push an AI message in `LOADING` state.
- * 3. Call `sqlServiceClientConnect.aICompletion` with the full history.
+ * 3. Call `aiServiceClientConnect.chat` with the full history.
* 4. Update the AI message with the response (DONE) or error (FAILED).
* 5. On FAILED, emit `error` on `aiContextEvents` for the host to
* surface (e.g. toast).
@@ -124,20 +123,20 @@ export function ChatPanel() {
conversation_id: conversation.id,
status: "LOADING",
});
- const messages: AICompletionRequest_Message[] =
- conversation.messageList.map((message) =>
- createProto(AICompletionRequest_MessageSchema, {
- role: message.author === "USER" ? "user" : "assistant",
+ const messages: AIChatMessage[] = conversation.messageList.map(
+ (message) =>
+ createProto(AIChatMessageSchema, {
+ role:
+ message.author === "USER"
+ ? AIChatMessageRole.AI_CHAT_MESSAGE_ROLE_USER
+ : AIChatMessageRole.AI_CHAT_MESSAGE_ROLE_ASSISTANT,
content: message.prompt,
})
- );
+ );
setLoading(true);
try {
- const request = createProto(AICompletionRequestSchema, { messages });
- const response = await sqlServiceClientConnect.aICompletion(request);
- const text = head(
- head(response.candidates)?.content?.parts
- )?.text?.trim();
+ const response = await aiServiceClientConnect.chat({ messages });
+ const text = response.content?.trim();
console.debug("[AI Assistant] answer:", text);
if (text) {
answer.content = text;
diff --git a/frontend/src/modules/ai/components/context.tsx b/frontend/src/modules/ai/components/context.tsx
index 7bd93dd75f..8cffe1fcf8 100644
--- a/frontend/src/modules/ai/components/context.tsx
+++ b/frontend/src/modules/ai/components/context.tsx
@@ -59,7 +59,7 @@ export type ReactAIContext = {
/**
* One-shot trigger written by the `send-chat` event handler — the
* downstream `ChatPanel` effect reads this and dispatches the actual
- * AICompletion request, then clears it via `setPendingSendChat(undefined)`.
+ * AI chat request, then clears it via `setPendingSendChat(undefined)`.
* Same pattern as the Vue `pendingSendChat` ref.
*/
pendingSendChat: { content: string } | undefined;
diff --git a/frontend/src/modules/ai/components/useDynamicSuggestions.ts b/frontend/src/modules/ai/components/useDynamicSuggestions.ts
index 504366597e..8cfc607f38 100644
--- a/frontend/src/modules/ai/components/useDynamicSuggestions.ts
+++ b/frontend/src/modules/ai/components/useDynamicSuggestions.ts
@@ -2,15 +2,15 @@ import { create as createProto } from "@bufbuild/protobuf";
import { createContextValues } from "@connectrpc/connect";
import { head, uniq, values } from "lodash-es";
import { useMemo, useSyncExternalStore } from "react";
-import { sqlServiceClientConnect } from "@/api";
+import { aiServiceClientConnect } from "@/api";
import { silentContextKey } from "@/api/context-key";
+import {
+ type AIChatMessage,
+ AIChatMessageRole,
+ AIChatMessageSchema,
+} from "@/types/proto-es/v1/ai_service_pb";
import type { Engine } from "@/types/proto-es/v1/common_pb";
import type { DatabaseMetadata } from "@/types/proto-es/v1/database_service_pb";
-import {
- type AICompletionRequest_Message,
- AICompletionRequest_MessageSchema,
- AICompletionRequestSchema,
-} from "@/types/proto-es/v1/sql_service_pb";
import { storageKeyAiSuggestions } from "@/utils";
import { hashCode } from "@/utils/string";
import * as promptUtils from "../logic/prompt";
@@ -91,16 +91,32 @@ function patchEntry(metadata: string, patch: Partial<Entry>) {
emit();
}
-async function requestAI(messages: AICompletionRequest_Message[]) {
+// The model may wrap its JSON reply in a Markdown code fence; strip it before
+// parsing.
+function stripCodeFence(text: string): string {
+ let result = text.trim();
+ if (result.startsWith("```")) {
+ const firstNewline = result.indexOf("\n");
+ result =
+ firstNewline === -1 ? result.slice(3) : result.slice(firstNewline + 1);
+ }
+ if (result.endsWith("```")) {
+ result = result.slice(0, -3);
+ }
+ return result.trim();
+}
+
+async function requestAI(messages: AIChatMessage[]) {
await new Promise((resolve) => setTimeout(resolve, 1000));
try {
- const request = createProto(AICompletionRequestSchema, { messages });
- // Silent mode avoids error notifications for AI completion failures.
- const response = await sqlServiceClientConnect.aICompletion(request, {
- contextValues: createContextValues().set(silentContextKey, true),
- });
- const text =
- head(head(response.candidates)?.content?.parts)?.text?.trim() ?? "";
+ // Silent mode avoids error notifications for AI chat failures.
+ const response = await aiServiceClientConnect.chat(
+ { messages },
+ {
+ contextValues: createContextValues().set(silentContextKey, true),
+ }
+ );
+ const text = stripCodeFence(response.content ?? "");
const card = JSON.parse(text) as Record<string, string>;
return values(card ?? {});
} catch {
@@ -116,13 +132,13 @@ async function fetchSuggestions(metadata: string): Promise<string[]> {
metadata,
new Set([...entry.used.values(), ...entry.suggestions])
);
- const messages: AICompletionRequest_Message[] = [
- createProto(AICompletionRequest_MessageSchema, {
- role: "system",
+ const messages: AIChatMessage[] = [
+ createProto(AIChatMessageSchema, {
+ role: AIChatMessageRole.AI_CHAT_MESSAGE_ROLE_SYSTEM,
content: command,
}),
- createProto(AICompletionRequest_MessageSchema, {
- role: "user",
+ createProto(AIChatMessageSchema, {
+ role: AIChatMessageRole.AI_CHAT_MESSAGE_ROLE_USER,
content: prompt,
}),
];
diff --git a/frontend/src/types/proto-es/v1/sql_service_pb.d.ts b/frontend/src/types/proto-es/v1/sql_service_pb.d.ts
index 88f1e7472c..a4d7329b00 100644
--- a/frontend/src/types/proto-es/v1/sql_service_pb.d.ts
+++ b/frontend/src/types/proto-es/v1/sql_service_pb.d.ts
@@ -1098,112 +1098,6 @@ export declare type ExportResponse = Message<"bytebase.v1.ExportResponse"> & {
*/
export declare const ExportResponseSchema: GenMessage<ExportResponse>;
-/**
- * @generated from message bytebase.v1.AICompletionRequest
- */
-export declare type AICompletionRequest = Message<"bytebase.v1.AICompletionRequest"> & {
- /**
- * @generated from field: repeated bytebase.v1.AICompletionRequest.Message messages = 1;
- */
- messages: AICompletionRequest_Message[];
-};
-
-/**
- * Describes the message bytebase.v1.AICompletionRequest.
- * Use `create(AICompletionRequestSchema)` to create a new message.
- */
-export declare const AICompletionRequestSchema: GenMessage<AICompletionRequest>;
-
-/**
- * @generated from message bytebase.v1.AICompletionRequest.Message
- */
-export declare type AICompletionRequest_Message = Message<"bytebase.v1.AICompletionRequest.Message"> & {
- /**
- * @generated from field: string role = 1;
- */
- role: string;
-
- /**
- * @generated from field: string content = 2;
- */
- content: string;
-};
-
-/**
- * Describes the message bytebase.v1.AICompletionRequest.Message.
- * Use `create(AICompletionRequest_MessageSchema)` to create a new message.
- */
-export declare const AICompletionRequest_MessageSchema: GenMessage<AICompletionRequest_Message>;
-
-/**
- * @generated from message bytebase.v1.AICompletionResponse
- */
-export declare type AICompletionResponse = Message<"bytebase.v1.AICompletionResponse"> & {
- /**
- * candidates is used for results with multiple choices and candidates. Used
- * for OpenAI and Gemini.
- *
- * @generated from field: repeated bytebase.v1.AICompletionResponse.Candidate candidates = 1;
- */
- candidates: AICompletionResponse_Candidate[];
-};
-
-/**
- * Describes the message bytebase.v1.AICompletionResponse.
- * Use `create(AICompletionResponseSchema)` to create a new message.
- */
-export declare const AICompletionResponseSchema: GenMessage<AICompletionResponse>;
-
-/**
- * @generated from message bytebase.v1.AICompletionResponse.Candidate
- */
-export declare type AICompletionResponse_Candidate = Message<"bytebase.v1.AICompletionResponse.Candidate"> & {
- /**
- * @generated from field: bytebase.v1.AICompletionResponse.Candidate.Content content = 1;
- */
- content?: AICompletionResponse_Candidate_Content | undefined;
-};
-
-/**
- * Describes the message bytebase.v1.AICompletionResponse.Candidate.
- * Use `create(AICompletionResponse_CandidateSchema)` to create a new message.
- */
-export declare const AICompletionResponse_CandidateSchema: GenMessage<AICompletionResponse_Candidate>;
-
-/**
- * @generated from message bytebase.v1.AICompletionResponse.Candidate.Content
- */
-export declare type AICompletionResponse_Candidate_Content = Message<"bytebase.v1.AICompletionResponse.Candidate.Content"> & {
- /**
- * parts is used for a result content with multiple parts.
- *
- * @generated from field: repeated bytebase.v1.AICompletionResponse.Candidate.Content.Part parts = 1;
- */
- parts: AICompletionResponse_Candidate_Content_Part[];
-};
-
-/**
- * Describes the message bytebase.v1.AICompletionResponse.Candidate.Content.
- * Use `create(AICompletionResponse_Candidate_ContentSchema)` to create a new message.
- */
-export declare const AICompletionResponse_Candidate_ContentSchema: GenMessage<AICompletionResponse_Candidate_Content>;
-
-/**
- * @generated from message bytebase.v1.AICompletionResponse.Candidate.Content.Part
- */
-export declare type AICompletionResponse_Candidate_Content_Part = Message<"bytebase.v1.AICompletionResponse.Candidate.Content.Part"> & {
- /**
- * @generated from field: string text = 1;
- */
- text: string;
-};
-
-/**
- * Describes the message bytebase.v1.AICompletionResponse.Candidate.Content.Part.
- * Use `create(AICompletionResponse_Candidate_Content_PartSchema)` to create a new message.
- */
-export declare const AICompletionResponse_Candidate_Content_PartSchema: GenMessage<AICompletionResponse_Candidate_Content_Part>;
-
/**
* SQLService executes SQL queries and manages query operations.
*
@@ -1285,16 +1179,5 @@ export declare const SQLService: GenService<{
input: typeof ExportRequestSchema;
output: typeof ExportResponseSchema;
},
- /**
- * Provides AI-powered SQL completion and generation.
- * Permissions required: None (authenticated users only, requires AI to be enabled)
- *
- * @generated from rpc bytebase.v1.SQLService.AICompletion
- */
- aICompletion: {
- methodKind: "unary";
- input: typeof AICompletionRequestSchema;
- output: typeof AICompletionResponseSchema;
- },
}>;
diff --git a/frontend/src/types/proto-es/v1/sql_service_pb.js b/frontend/src/types/proto-es/v1/sql_service_pb.js
index 09e16e30d3..f17681b801 100644
--- a/frontend/src/types/proto-es/v1/sql_service_pb.js
+++ b/frontend/src/types/proto-es/v1/sql_service_pb.js
@@ -15,7 +15,7 @@ import { file_v1_query_history_service } from "./query_history_service_pb";
* Describes the file v1/sql_service.proto.
*/
export const file_v1_sql_service = /*@__PURE__*/
- fileDesc("ChR2MS9zcWxfc2VydmljZS5wcm90bxILYnl0ZWJhc2UudjEiqgEKE0FkbWluRXhlY3V0ZVJlcXVlc3QSKwoEbmFtZRgBIAEoCUId4EEC+kEXChVieXRlYmFzZS5jb20vRGF0YWJhc2USEQoJc3RhdGVtZW50GAIgASgJEg0KBWxpbWl0GAMgASgFEhMKBnNjaGVtYRgEIAEoCUgAiA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EoQCCgZFeHBvcnQSGi5ieXRlYmFzZS52MS5FeHBvcnRSZXF1ZXN0GhsuYnl0ZWJhc2UudjEuRXhwb3J0UmVzcG9uc2UiwAGK6jAQYmIuZGF0YWJhc2VzLmdldJDqMAGY6jABgtPkkwKdAToBKloxOgEqIiwvdjEve25hbWU9cHJvamVjdHMvKi9wbGFucy8qL3JvbGxvdXR9OmV4cG9ydFo6OgEqIjUvdjEve25hbWU9cHJvamVjdHMvKi9wbGFucy8qL3JvbGxvdXQvc3RhZ2VzLyp9OmV4cG9ydCIpL3YxL3tuYW1lPWluc3RhbmNlcy8qL2RhdGFiYXNlcy8qfTpleHBvcnQSeAoMQUlDb21wbGV0aW9uEiAuYnl0ZWJhc2UudjEuQUlDb21wbGV0aW9uUmVxdWVzdBohLmJ5dGViYXNlLnYxLkFJQ29tcGxldGlvblJlc3BvbnNlIiOQ6jACgtPkkwIZOgEqIhQvdjEvc3FsL2FpQ29tcGxldGlvbkKlAQoPY29tLmJ5dGViYXNlLnYxQg9TcWxTZXJ2aWNlUHJvdG9QAVo0Z2l0aHViLmNvbS9ieXRlYmFzZS9ieXRlYmFzZS9iYWNrZW5kL2dlbmVyYXRlZC1nby92MaICA0JYWKoCC0J5dGViYXNlLlYxygILQnl0ZWJhc2VcVjHiAhdCeXRlYmFzZVxWMVxHUEJNZXRhZGF0YeoCDEJ5dGViYXNlOjpWMWIGcHJvdG8z", [file_google_api_annotations, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_duration, file_google_protobuf_struct, file_google_protobuf_timestamp, file_v1_annotation, file_v1_common, file_v1_query_history_service]);
+ fileDesc("ChR2MS9zcWxfc2VydmljZS5wcm90bxILYnl0ZWJhc2UudjEiqgEKE0FkbWluRXhlY3V0ZVJlcXVlc3QSKwoEbmFtZRgBIAEoCUId4EEC+kEXChVieXRlYmFzZS5jb20vRGF0YWJhc2USEQoJc3RhdGVtZW50GAIgASgJEg0KBWxpbWl0GAMgASgFEhMKBnNjaGVtYRgEIAEo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Qnl0ZWJhc2VcVjFcR1BCTWV0YWRhdGHqAgxCeXRlYmFzZTo6VjFiBnByb3RvMw", [file_google_api_annotations, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_duration, file_google_protobuf_struct, file_google_protobuf_timestamp, file_v1_annotation, file_v1_common, file_v1_query_history_service]);
/**
* Describes the message bytebase.v1.AdminExecuteRequest.
@@ -219,48 +219,6 @@ export const ExportRequestSchema = /*@__PURE__*/
export const ExportResponseSchema = /*@__PURE__*/
messageDesc(file_v1_sql_service, 11);
-/**
- * Describes the message bytebase.v1.AICompletionRequest.
- * Use `create(AICompletionRequestSchema)` to create a new message.
- */
-export const AICompletionRequestSchema = /*@__PURE__*/
- messageDesc(file_v1_sql_service, 12);
-
-/**
- * Describes the message bytebase.v1.AICompletionRequest.Message.
- * Use `create(AICompletionRequest_MessageSchema)` to create a new message.
- */
-export const AICompletionRequest_MessageSchema = /*@__PURE__*/
- messageDesc(file_v1_sql_service, 12, 0);
-
-/**
- * Describes the message bytebase.v1.AICompletionResponse.
- * Use `create(AICompletionResponseSchema)` to create a new message.
- */
-export const AICompletionResponseSchema = /*@__PURE__*/
- messageDesc(file_v1_sql_service, 13);
-
-/**
- * Describes the message bytebase.v1.AICompletionResponse.Candidate.
- * Use `create(AICompletionResponse_CandidateSchema)` to create a new message.
- */
-export const AICompletionResponse_CandidateSchema = /*@__PURE__*/
- messageDesc(file_v1_sql_service, 13, 0);
-
-/**
- * Describes the message bytebase.v1.AICompletionResponse.Candidate.Content.
- * Use `create(AICompletionResponse_Candidate_ContentSchema)` to create a new message.
- */
-export const AICompletionResponse_Candidate_ContentSchema = /*@__PURE__*/
- messageDesc(file_v1_sql_service, 13, 0, 0);
-
-/**
- * Describes the message bytebase.v1.AICompletionResponse.Candidate.Content.Part.
- * Use `create(AICompletionResponse_Candidate_Content_PartSchema)` to create a new message.
- */
-export const AICompletionResponse_Candidate_Content_PartSchema = /*@__PURE__*/
- messageDesc(file_v1_sql_service, 13, 0, 0, 0);
-
/**
* SQLService executes SQL queries and manages query operations.
*
diff --git a/proto/gen/grpc-doc/openapi.yaml b/proto/gen/grpc-doc/openapi.yaml
index 6eeef2aef4..c1c77e21be 100644
--- a/proto/gen/grpc-doc/openapi.yaml
+++ b/proto/gen/grpc-doc/openapi.yaml
@@ -13696,28 +13696,6 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/bytebase.v1.Setting'
- /v1/sql/aiCompletion:
- post:
- tags:
- - SQLService
- summary: AICompletion
- description: |-
- Provides AI-powered SQL completion and generation.
- Permissions required: None (authenticated users only, requires AI to be enabled)
- operationId: SQLService_AICompletion
- requestBody:
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/bytebase.v1.AICompletionRequest'
- required: true
- responses:
- "200":
- description: Success
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/bytebase.v1.AICompletionResponse'
/v1/subscription:
get:
tags:
@@ -15923,67 +15901,6 @@ components:
title: AIChatUsage
additionalProperties: false
description: Token usage for a single AI provider call.
- bytebase.v1.AICompletionRequest:
- type: object
- properties:
- messages:
- type: array
- items:
- $ref: '#/components/schemas/bytebase.v1.AICompletionRequest.Message'
- title: messages
- title: AICompletionRequest
- additionalProperties: false
- bytebase.v1.AICompletionRequest.Message:
- type: object
- properties:
- role:
- type: string
- title: role
- content:
- type: string
- title: content
- title: Message
- additionalProperties: false
- bytebase.v1.AICompletionResponse:
- type: object
- properties:
- candidates:
- type: array
- items:
- $ref: '#/components/schemas/bytebase.v1.AICompletionResponse.Candidate'
- title: candidates
- description: |-
- candidates is used for results with multiple choices and candidates. Used
- for OpenAI and Gemini.
- title: AICompletionResponse
- additionalProperties: false
- bytebase.v1.AICompletionResponse.Candidate:
- type: object
- properties:
- content:
- title: content
- $ref: '#/components/schemas/bytebase.v1.AICompletionResponse.Candidate.Content'
- title: Candidate
- additionalProperties: false
- bytebase.v1.AICompletionResponse.Candidate.Content:
- type: object
- properties:
- parts:
- type: array
- items:
- $ref: '#/components/schemas/bytebase.v1.AICompletionResponse.Candidate.Content.Part'
- title: parts
- description: parts is used for a result content with multiple parts.
- title: Content
- additionalProperties: false
- bytebase.v1.AICompletionResponse.Candidate.Content.Part:
- type: object
- properties:
- text:
- type: string
- title: text
- title: Part
- additionalProperties: false
bytebase.v1.AISetting:
type: object
properties:
diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.md
index 937248726b..37b35771fd 100644
--- a/proto/gen/grpc-doc/v1/README.md
+++ b/proto/gen/grpc-doc/v1/README.md
@@ -109,12 +109,6 @@
- [QueryHistoryService](#bytebase-v1-QueryHistoryService)
- [v1/sql_service.proto](#v1_sql_service-proto)
- - [AICompletionRequest](#bytebase-v1-AICompletionRequest)
- - [AICompletionRequest.Message](#bytebase-v1-AICompletionRequest-Message)
- - [AICompletionResponse](#bytebase-v1-AICompletionResponse)
- - [AICompletionResponse.Candidate](#bytebase-v1-AICompletionResponse-Candidate)
- - [AICompletionResponse.Candidate.Content](#bytebase-v1-AICompletionResponse-Candidate-Content)
- - [AICompletionResponse.Candidate.Content.Part](#bytebase-v1-AICompletionResponse-Candidate-Content-Part)
- [AdminExecuteRequest](#bytebase-v1-AdminExecuteRequest)
- [AdminExecuteResponse](#bytebase-v1-AdminExecuteResponse)
- [Advice](#bytebase-v1-Advice)
@@ -2344,97 +2338,6 @@ QueryHistoryService manages query history records of SQL Editor queries and expo
-<a name="bytebase-v1-AICompletionRequest"></a>
-
-### AICompletionRequest
-
-
-
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| messages | [AICompletionRequest.Message](#bytebase-v1-AICompletionRequest-Message) | repeated | |
-
-
-
-
-
-
-<a name="bytebase-v1-AICompletionRequest-Message"></a>
-
-### AICompletionRequest.Message
-
-
-
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| role | [string](#string) | | |
-| content | [string](#string) | | |
-
-
-
-
-
-
-<a name="bytebase-v1-AICompletionResponse"></a>
-
-### AICompletionResponse
-
-
-
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| candidates | [AICompletionResponse.Candidate](#bytebase-v1-AICompletionResponse-Candidate) | repeated | candidates is used for results with multiple choices and candidates. Used for OpenAI and Gemini. |
-
-
-
-
-
-
-<a name="bytebase-v1-AICompletionResponse-Candidate"></a>
-
-### AICompletionResponse.Candidate
-
-
-
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| content | [AICompletionResponse.Candidate.Content](#bytebase-v1-AICompletionResponse-Candidate-Content) | | |
-
-
-
-
-
-
-<a name="bytebase-v1-AICompletionResponse-Candidate-Content"></a>
-
-### AICompletionResponse.Candidate.Content
-
-
-
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| parts | [AICompletionResponse.Candidate.Content.Part](#bytebase-v1-AICompletionResponse-Candidate-Content-Part) | repeated | parts is used for a result content with multiple parts. |
-
-
-
-
-
-
-<a name="bytebase-v1-AICompletionResponse-Candidate-Content-Part"></a>
-
-### AICompletionResponse.Candidate.Content.Part
-
-
-
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| text | [string](#string) | | |
-
-
-
-
-
-
<a name="bytebase-v1-AdminExecuteRequest"></a>
### AdminExecuteRequest
@@ -2888,7 +2791,6 @@ SQLService executes SQL queries and manages query operations.
| ListQueryHistories | [ListQueryHistoriesRequest](#bytebase-v1-ListQueryHistoriesRequest) | [ListQueryHistoriesResponse](#bytebase-v1-ListQueryHistoriesResponse) | Deprecated: use QueryHistoryService.ListQueryHistories instead. Delegating alias kept for upgrade transition; will be removed in a future release. No HTTP binding: the REST route is served by QueryHistoryService. Permissions required: bb.queryHistories.list |
| GetQueryHistory | [GetQueryHistoryRequest](#bytebase-v1-GetQueryHistoryRequest) | [QueryHistory](#bytebase-v1-QueryHistory) | Deprecated: use QueryHistoryService.GetQueryHistory instead. Delegating alias kept for upgrade transition; will be removed in a future release. No HTTP binding: the REST route is served by QueryHistoryService. Permissions required: None (only returns the caller&#39;s own query history) |
| Export | [ExportRequest](#bytebase-v1-ExportRequest) | [ExportResponse](#bytebase-v1-ExportResponse) | Exports query results to a file format. Permissions required: bb.databases.get |
-| AICompletion | [AICompletionRequest](#bytebase-v1-AICompletionRequest) | [AICompletionResponse](#bytebase-v1-AICompletionResponse) | Provides AI-powered SQL completion and generation. Permissions required: None (authenticated users only, requires AI to be enabled) |
diff --git a/proto/gen/grpc-doc/v1/index.html b/proto/gen/grpc-doc/v1/index.html
index bc7b15ac1f..684d1f5356 100644
--- a/proto/gen/grpc-doc/v1/index.html
+++ b/proto/gen/grpc-doc/v1/index.html
@@ -581,30 +581,6 @@
<a href="#v1%2fsql_service.proto">v1/sql_service.proto</a>
<ul>
- <li>
- <a href="#bytebase.v1.AICompletionRequest"><span class="badge">M</span>AICompletionRequest</a>
- </li>
-
- <li>
- <a href="#bytebase.v1.AICompletionRequest.Message"><span class="badge">M</span>AICompletionRequest.Message</a>
- </li>
-
- <li>
- <a href="#bytebase.v1.AICompletionResponse"><span class="badge">M</span>AICompletionResponse</a>
- </li>
-
- <li>
- <a href="#bytebase.v1.AICompletionResponse.Candidate"><span class="badge">M</span>AICompletionResponse.Candidate</a>
- </li>
-
- <li>
- <a href="#bytebase.v1.AICompletionResponse.Candidate.Content"><span class="badge">M</span>AICompletionResponse.Candidate.Content</a>
- </li>
-
- <li>
- <a href="#bytebase.v1.AICompletionResponse.Candidate.Content.Part"><span class="badge">M</span>AICompletionResponse.Candidate.Content.Part</a>
- </li>
-
<li>
<a href="#bytebase.v1.AdminExecuteRequest"><span class="badge">M</span>AdminExecuteRequest</a>
</li>
@@ -7346,158 +7322,6 @@ Permissions required: None (only returns the caller&#39;s own query history)</p>
<p></p>
- <h3 id="bytebase.v1.AICompletionRequest">AICompletionRequest</h3>
- <p></p>
-
-
- <table class="field-table">
- <thead>
- <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
- </thead>
- <tbody>
-
- <tr>
- <td>messages</td>
- <td><a href="#bytebase.v1.AICompletionRequest.Message">AICompletionRequest.Message</a></td>
- <td>repeated</td>
- <td><p> </p></td>
- </tr>
-
- </tbody>
- </table>
-
-
-
-
-
- <h3 id="bytebase.v1.AICompletionRequest.Message">AICompletionRequest.Message</h3>
- <p></p>
-
-
- <table class="field-table">
- <thead>
- <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
- </thead>
- <tbody>
-
- <tr>
- <td>role</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p> </p></td>
- </tr>
-
- <tr>
- <td>content</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p> </p></td>
- </tr>
-
- </tbody>
- </table>
-
-
-
-
-
- <h3 id="bytebase.v1.AICompletionResponse">AICompletionResponse</h3>
- <p></p>
-
-
- <table class="field-table">
- <thead>
- <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
- </thead>
- <tbody>
-
- <tr>
- <td>candidates</td>
- <td><a href="#bytebase.v1.AICompletionResponse.Candidate">AICompletionResponse.Candidate</a></td>
- <td>repeated</td>
- <td><p>candidates is used for results with multiple choices and candidates. Used
-for OpenAI and Gemini. </p></td>
- </tr>
-
- </tbody>
- </table>
-
-
-
-
-
- <h3 id="bytebase.v1.AICompletionResponse.Candidate">AICompletionResponse.Candidate</h3>
- <p></p>
-
-
- <table class="field-table">
- <thead>
- <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
- </thead>
- <tbody>
-
- <tr>
- <td>content</td>
- <td><a href="#bytebase.v1.AICompletionResponse.Candidate.Content">AICompletionResponse.Candidate.Content</a></td>
- <td></td>
- <td><p> </p></td>
- </tr>
-
- </tbody>
- </table>
-
-
-
-
-
- <h3 id="bytebase.v1.AICompletionResponse.Candidate.Content">AICompletionResponse.Candidate.Content</h3>
- <p></p>
-
-
- <table class="field-table">
- <thead>
- <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
- </thead>
- <tbody>
-
- <tr>
- <td>parts</td>
- <td><a href="#bytebase.v1.AICompletionResponse.Candidate.Content.Part">AICompletionResponse.Candidate.Content.Part</a></td>
- <td>repeated</td>
- <td><p>parts is used for a result content with multiple parts. </p></td>
- </tr>
-
- </tbody>
- </table>
-
-
-
-
-
- <h3 id="bytebase.v1.AICompletionResponse.Candidate.Content.Part">AICompletionResponse.Candidate.Content.Part</h3>
- <p></p>
-
-
- <table class="field-table">
- <thead>
- <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
- </thead>
- <tbody>
-
- <tr>
- <td>text</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p> </p></td>
- </tr>
-
- </tbody>
- </table>
-
-
-
-
-
<h3 id="bytebase.v1.AdminExecuteRequest">AdminExecuteRequest</h3>
<p></p>
@@ -8792,14 +8616,6 @@ Permissions required: None (only returns the caller&#39;s own query history)</p>
Permissions required: bb.databases.get</p></td>
</tr>
- <tr>
- <td>AICompletion</td>
- <td><a href="#bytebase.v1.AICompletionRequest">AICompletionRequest</a></td>
- <td><a href="#bytebase.v1.AICompletionResponse">AICompletionResponse</a></td>
- <td><p>Provides AI-powered SQL completion and generation.
-Permissions required: None (authenticated users only, requires AI to be enabled)</p></td>
- </tr>
-
</tbody>
</table>
@@ -8893,16 +8709,6 @@ Permissions required: None (authenticated users only, requires AI to be enabled)
</tr>
-
-
- <tr>
- <td>AICompletion</td>
- <td>POST</td>
- <td>/v1/sql/aiCompletion</td>
- <td>*</td>
- </tr>
-
-
</tbody>
</table>
diff --git a/proto/v1/v1/sql_service.proto b/proto/v1/v1/sql_service.proto
index 7b9314b9a1..4502b89817 100644
--- a/proto/v1/v1/sql_service.proto
+++ b/proto/v1/v1/sql_service.proto
@@ -86,16 +86,6 @@ service SQLService {
option (bytebase.v1.auth_method) = IAM;
option (bytebase.v1.audit) = true;
}
-
- // Provides AI-powered SQL completion and generation.
- // Permissions required: None (authenticated users only, requires AI to be enabled)
- rpc AICompletion(AICompletionRequest) returns (AICompletionResponse) {
- option (google.api.http) = {
- post: "/v1/sql/aiCompletion"
- body: "*"
- };
- option (bytebase.v1.auth_method) = CUSTOM;
- }
}
message AdminExecuteRequest {
@@ -459,27 +449,3 @@ message ExportResponse {
// Empty when the user was authorized through normal ACL rather than a grant.
string applied_access_grant = 2;
}
-
-message AICompletionRequest {
- message Message {
- string role = 1;
- string content = 2;
- }
- repeated Message messages = 1;
-}
-
-message AICompletionResponse {
- message Candidate {
- message Content {
- message Part {
- string text = 1;
- }
- // parts is used for a result content with multiple parts.
- repeated Part parts = 1;
- }
- Content content = 1;
- }
- // candidates is used for results with multiple choices and candidates. Used
- // for OpenAI and Gemini.
- repeated Candidate candidates = 1;
-}