-
Notifications
You must be signed in to change notification settings - Fork 12
feat: data copilot improvements #726
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Parent:
feat: data copilot text to sql
epipav
merged 7 commits into
feature/data-copilot-text-to-sql
from
feature/data-copilot-ask-clarification-route
Oct 9, 2025
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
346c4c9
fix: compact question->routing tests, prompt improvements
epipav 6992159
feat: clarification questions by router agent
epipav c98ea36
feat: auditor agent and router agent ask_clarification mode
epipav 2a830a7
feat(chat): quality improvements
epipav 5cfddc9
feat: step logging agent details
epipav 2c027ab
fix: types and linting
epipav 16ec34f
fix: add gitlab and gerrit to code platforms
epipav File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
database/migrations/V1759392166__addAskClarificationRouterResponseType.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| -- Drop the existing check constraint | ||
| ALTER TABLE chat_responses DROP CONSTRAINT chat_responses_router_response_check; | ||
|
|
||
| -- Add the new check constraint with 'ask_clarification' | ||
| ALTER TABLE chat_responses ADD CONSTRAINT chat_responses_router_response_check | ||
| CHECK (router_response IN ('pipes', 'create_query', 'stop', 'ask_clarification')); | ||
|
|
||
| -- Add clarification_question column to store the clarification question | ||
| ALTER TABLE chat_responses ADD COLUMN IF NOT EXISTS clarification_question TEXT; |
27 changes: 27 additions & 0 deletions
27
database/migrations/V1759927411__createChatResponseAgentStepsTable.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| -- Create enum for agent types | ||
| CREATE TYPE agent_type AS ENUM ('ROUTER', 'PIPE', 'TEXT_TO_SQL', 'AUDITOR', 'CHART', 'EXECUTE_INSTRUCTIONS'); | ||
|
|
||
| -- Create table to track individual agent execution steps | ||
| CREATE TABLE IF NOT EXISTS chat_response_agent_steps ( | ||
| id UUID PRIMARY KEY DEFAULT gen_random_uuid(), | ||
| chat_response_id UUID NOT NULL, | ||
| created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, | ||
| model TEXT, | ||
| agent agent_type NOT NULL, | ||
| response JSONB, | ||
| input_tokens INTEGER DEFAULT 0, | ||
| output_tokens INTEGER DEFAULT 0, | ||
| response_time_seconds NUMERIC NOT NULL DEFAULT 0, | ||
| instructions TEXT, | ||
| error_message TEXT, | ||
|
|
||
| CONSTRAINT fk_chat_response | ||
| FOREIGN KEY (chat_response_id) | ||
| REFERENCES chat_responses(id) | ||
| ON DELETE CASCADE | ||
| ); | ||
|
|
||
| -- Create indexes for efficient querying | ||
| CREATE INDEX idx_agent_steps_chat_response_id ON chat_response_agent_steps(chat_response_id); | ||
| CREATE INDEX idx_agent_steps_created_at ON chat_response_agent_steps(created_at DESC); | ||
| CREATE INDEX idx_agent_steps_agent_type ON chat_response_agent_steps(agent); |
18 changes: 18 additions & 0 deletions
18
database/migrations/V1759927412__makeChatResponsesNullable.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| -- Make router fields nullable to allow early creation of chat_responses | ||
| ALTER TABLE chat_responses ALTER COLUMN router_response DROP NOT NULL; | ||
| ALTER TABLE chat_responses ALTER COLUMN router_reason DROP NOT NULL; | ||
|
|
||
| -- Drop existing constraints | ||
| ALTER TABLE chat_responses DROP CONSTRAINT IF EXISTS chat_responses_router_response_check; | ||
| ALTER TABLE chat_responses DROP CONSTRAINT IF EXISTS check_pipe_instructions; | ||
|
|
||
| -- Add new constraint that allows NULL or valid enum values | ||
| ALTER TABLE chat_responses ADD CONSTRAINT chat_responses_router_response_check | ||
| CHECK (router_response IS NULL OR router_response IN ('pipes', 'create_query', 'stop', 'ask_clarification')); | ||
|
|
||
| -- Recreate pipe_instructions check with NULL handling | ||
| ALTER TABLE chat_responses ADD CONSTRAINT check_pipe_instructions CHECK ( | ||
| router_response IS NULL OR | ||
| (router_response = 'pipes' AND pipe_instructions IS NOT NULL) OR | ||
| (router_response != 'pipes' AND pipe_instructions IS NULL) | ||
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 0 additions & 60 deletions
60
frontend/app/components/shared/modules/copilot/store/test.json
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The condition is complex and hard to read. Consider extracting the status checks into a constant array or helper function for better maintainability.