mirror of https://github.com/buster-so/buster.git
flag chat step clean
This commit is contained in:
parent
b699b9f2c9
commit
eb68b4edff
|
@ -1,10 +1,10 @@
|
||||||
import type { CoreMessage } from 'ai';
|
import type { ModelMessage } from 'ai';
|
||||||
import { describe, expect, it } from 'vitest';
|
import { describe, expect, it } from 'vitest';
|
||||||
import { flagChatStepExecution } from './flag-chat-step';
|
import { flagChatStepExecution } from './flag-chat-step';
|
||||||
|
|
||||||
describe('flag-chat-step integration', () => {
|
describe('flag-chat-step integration', () => {
|
||||||
it('should analyze conversation history and return flag-chat results', async () => {
|
it('should analyze conversation history and return flag-chat results', async () => {
|
||||||
const mockConversationHistory: CoreMessage[] = [
|
const mockConversationHistory: ModelMessage[] = [
|
||||||
{
|
{
|
||||||
content:
|
content:
|
||||||
'How many stock Mountain-500 series bikes were sold online to NA customers using a ColonialVoice card?',
|
'How many stock Mountain-500 series bikes were sold online to NA customers using a ColonialVoice card?',
|
||||||
|
@ -22,7 +22,7 @@ describe('flag-chat-step integration', () => {
|
||||||
{
|
{
|
||||||
content: [
|
content: [
|
||||||
{
|
{
|
||||||
args: {
|
input: {
|
||||||
isRevision: false,
|
isRevision: false,
|
||||||
needsMoreThoughts: false,
|
needsMoreThoughts: false,
|
||||||
nextThoughtNeeded: true,
|
nextThoughtNeeded: true,
|
||||||
|
@ -41,9 +41,12 @@ describe('flag-chat-step integration', () => {
|
||||||
{
|
{
|
||||||
content: [
|
content: [
|
||||||
{
|
{
|
||||||
result: {
|
output: {
|
||||||
|
type: 'json' as const,
|
||||||
|
value: {
|
||||||
success: true,
|
success: true,
|
||||||
},
|
},
|
||||||
|
},
|
||||||
toolCallId: 'toolu_01De2VQ9M2mhHxf1rNvxSkf1',
|
toolCallId: 'toolu_01De2VQ9M2mhHxf1rNvxSkf1',
|
||||||
toolName: 'sequentialThinking',
|
toolName: 'sequentialThinking',
|
||||||
type: 'tool-result',
|
type: 'tool-result',
|
||||||
|
@ -54,7 +57,7 @@ describe('flag-chat-step integration', () => {
|
||||||
{
|
{
|
||||||
content: [
|
content: [
|
||||||
{
|
{
|
||||||
args: {
|
input: {
|
||||||
statements: [
|
statements: [
|
||||||
"SELECT DISTINCT p.name FROM postgres.ont_ont.product p WHERE p.name ILIKE '%Mountain-500%' LIMIT 25",
|
"SELECT DISTINCT p.name FROM postgres.ont_ont.product p WHERE p.name ILIKE '%Mountain-500%' LIMIT 25",
|
||||||
"SELECT DISTINCT p.name FROM postgres.ont_ont.product p WHERE p.name ILIKE '%Mountain%' AND p.name ILIKE '%500%' LIMIT 25",
|
"SELECT DISTINCT p.name FROM postgres.ont_ont.product p WHERE p.name ILIKE '%Mountain%' AND p.name ILIKE '%500%' LIMIT 25",
|
||||||
|
@ -73,7 +76,9 @@ describe('flag-chat-step integration', () => {
|
||||||
{
|
{
|
||||||
content: [
|
content: [
|
||||||
{
|
{
|
||||||
result: {
|
output: {
|
||||||
|
type: 'json' as const,
|
||||||
|
value: {
|
||||||
results: [
|
results: [
|
||||||
{
|
{
|
||||||
results: [
|
results: [
|
||||||
|
@ -134,6 +139,7 @@ describe('flag-chat-step integration', () => {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
},
|
||||||
toolCallId: 'toolu_01Ufu6nZQvYAXaQr2XZHKptL',
|
toolCallId: 'toolu_01Ufu6nZQvYAXaQr2XZHKptL',
|
||||||
toolName: 'executeSql',
|
toolName: 'executeSql',
|
||||||
type: 'tool-result',
|
type: 'tool-result',
|
||||||
|
@ -144,7 +150,7 @@ describe('flag-chat-step integration', () => {
|
||||||
{
|
{
|
||||||
content: [
|
content: [
|
||||||
{
|
{
|
||||||
args: {
|
input: {
|
||||||
isRevision: false,
|
isRevision: false,
|
||||||
needsMoreThoughts: false,
|
needsMoreThoughts: false,
|
||||||
nextThoughtNeeded: true,
|
nextThoughtNeeded: true,
|
||||||
|
@ -163,9 +169,12 @@ describe('flag-chat-step integration', () => {
|
||||||
{
|
{
|
||||||
content: [
|
content: [
|
||||||
{
|
{
|
||||||
result: {
|
output: {
|
||||||
|
type: 'json' as const,
|
||||||
|
value: {
|
||||||
success: true,
|
success: true,
|
||||||
},
|
},
|
||||||
|
},
|
||||||
toolCallId: 'toolu_02KKXA1KUXcCAHjA2jAjfSXE',
|
toolCallId: 'toolu_02KKXA1KUXcCAHjA2jAjfSXE',
|
||||||
toolName: 'sequentialThinking',
|
toolName: 'sequentialThinking',
|
||||||
type: 'tool-result',
|
type: 'tool-result',
|
||||||
|
@ -176,7 +185,7 @@ describe('flag-chat-step integration', () => {
|
||||||
{
|
{
|
||||||
content: [
|
content: [
|
||||||
{
|
{
|
||||||
args: {
|
input: {
|
||||||
isRevision: false,
|
isRevision: false,
|
||||||
needsMoreThoughts: false,
|
needsMoreThoughts: false,
|
||||||
nextThoughtNeeded: false,
|
nextThoughtNeeded: false,
|
||||||
|
@ -195,9 +204,12 @@ describe('flag-chat-step integration', () => {
|
||||||
{
|
{
|
||||||
content: [
|
content: [
|
||||||
{
|
{
|
||||||
result: {
|
output: {
|
||||||
|
type: 'json' as const,
|
||||||
|
value: {
|
||||||
success: true,
|
success: true,
|
||||||
},
|
},
|
||||||
|
},
|
||||||
toolCallId: 'toolu_03QyPGts4d3WdGmFmrd5urVT',
|
toolCallId: 'toolu_03QyPGts4d3WdGmFmrd5urVT',
|
||||||
toolName: 'sequentialThinking',
|
toolName: 'sequentialThinking',
|
||||||
type: 'tool-result',
|
type: 'tool-result',
|
||||||
|
@ -208,7 +220,7 @@ describe('flag-chat-step integration', () => {
|
||||||
{
|
{
|
||||||
content: [
|
content: [
|
||||||
{
|
{
|
||||||
args: {},
|
input: {},
|
||||||
toolCallId: 'toolu_04T6RXZpViewbAVZWYD5YxRd',
|
toolCallId: 'toolu_04T6RXZpViewbAVZWYD5YxRd',
|
||||||
toolName: 'submitThoughts',
|
toolName: 'submitThoughts',
|
||||||
type: 'tool-call',
|
type: 'tool-call',
|
||||||
|
@ -219,7 +231,10 @@ describe('flag-chat-step integration', () => {
|
||||||
{
|
{
|
||||||
content: [
|
content: [
|
||||||
{
|
{
|
||||||
result: {},
|
output: {
|
||||||
|
type: 'json' as const,
|
||||||
|
value: {},
|
||||||
|
},
|
||||||
toolCallId: 'toolu_04T6RXZpViewbAVZWYD5YxRd',
|
toolCallId: 'toolu_04T6RXZpViewbAVZWYD5YxRd',
|
||||||
toolName: 'submitThoughts',
|
toolName: 'submitThoughts',
|
||||||
type: 'tool-result',
|
type: 'tool-result',
|
||||||
|
@ -230,7 +245,7 @@ describe('flag-chat-step integration', () => {
|
||||||
{
|
{
|
||||||
content: [
|
content: [
|
||||||
{
|
{
|
||||||
args: {
|
input: {
|
||||||
files: [
|
files: [
|
||||||
{
|
{
|
||||||
name: 'Mountain-500 Online Sales to NA Customers with ColonialVoice Card',
|
name: 'Mountain-500 Online Sales to NA Customers with ColonialVoice Card',
|
||||||
|
@ -249,7 +264,9 @@ describe('flag-chat-step integration', () => {
|
||||||
{
|
{
|
||||||
content: [
|
content: [
|
||||||
{
|
{
|
||||||
result: {
|
output: {
|
||||||
|
type: 'json' as const,
|
||||||
|
value: {
|
||||||
duration: 674,
|
duration: 674,
|
||||||
failed_files: [],
|
failed_files: [],
|
||||||
files: [
|
files: [
|
||||||
|
@ -270,6 +287,7 @@ describe('flag-chat-step integration', () => {
|
||||||
],
|
],
|
||||||
message: 'Successfully created 1 metric files.',
|
message: 'Successfully created 1 metric files.',
|
||||||
},
|
},
|
||||||
|
},
|
||||||
toolCallId: 'toolu_05JTGAQ7Pz8gT3SnRaUZttdF',
|
toolCallId: 'toolu_05JTGAQ7Pz8gT3SnRaUZttdF',
|
||||||
toolName: 'createMetrics',
|
toolName: 'createMetrics',
|
||||||
type: 'tool-result',
|
type: 'tool-result',
|
||||||
|
@ -280,7 +298,7 @@ describe('flag-chat-step integration', () => {
|
||||||
{
|
{
|
||||||
content: [
|
content: [
|
||||||
{
|
{
|
||||||
args: {
|
input: {
|
||||||
final_response:
|
final_response:
|
||||||
"I found the answer to your specific question about Mountain-500 series bikes sold online to North American customers using ColonialVoice cards.\n\n**Result: 47 Mountain-500 series bikes were sold under these exact conditions.**\n\nHere's how I identified and filtered the data based on your requirements:\n\n- **Mountain-500 series bikes**: Found 10 different Mountain-500 variants in the database (5 black and 5 silver in various sizes: 40, 42, 44, 48, 52)\n- **Stock bikes**: Filtered for finished goods ready for sale (using the `finishedgoodsflag`)\n- **Online sales**: Used the online order flag to identify web-based purchases\n- **NA customers**: Included customers from United States, Canada, and Mexico\n- **ColonialVoice card**: Filtered specifically for this credit card type (which exists in the database alongside Vista, SuperiorCard, and Distinguish)\n\nThe analysis shows that despite the very specific filtering criteria, there was still a meaningful volume of 47 bikes sold through this particular channel combination. This suggests that ColonialVoice cardholders in North America represent an active customer segment for the Mountain-500 product line in online sales.",
|
"I found the answer to your specific question about Mountain-500 series bikes sold online to North American customers using ColonialVoice cards.\n\n**Result: 47 Mountain-500 series bikes were sold under these exact conditions.**\n\nHere's how I identified and filtered the data based on your requirements:\n\n- **Mountain-500 series bikes**: Found 10 different Mountain-500 variants in the database (5 black and 5 silver in various sizes: 40, 42, 44, 48, 52)\n- **Stock bikes**: Filtered for finished goods ready for sale (using the `finishedgoodsflag`)\n- **Online sales**: Used the online order flag to identify web-based purchases\n- **NA customers**: Included customers from United States, Canada, and Mexico\n- **ColonialVoice card**: Filtered specifically for this credit card type (which exists in the database alongside Vista, SuperiorCard, and Distinguish)\n\nThe analysis shows that despite the very specific filtering criteria, there was still a meaningful volume of 47 bikes sold through this particular channel combination. This suggests that ColonialVoice cardholders in North America represent an active customer segment for the Mountain-500 product line in online sales.",
|
||||||
},
|
},
|
||||||
|
@ -294,9 +312,12 @@ describe('flag-chat-step integration', () => {
|
||||||
{
|
{
|
||||||
content: [
|
content: [
|
||||||
{
|
{
|
||||||
result: {
|
output: {
|
||||||
|
type: 'json' as const,
|
||||||
|
value: {
|
||||||
success: true,
|
success: true,
|
||||||
},
|
},
|
||||||
|
},
|
||||||
toolCallId: 'toolu_06WAfvCoQtpBoNdmNi17LKCe',
|
toolCallId: 'toolu_06WAfvCoQtpBoNdmNi17LKCe',
|
||||||
toolName: 'doneTool',
|
toolName: 'doneTool',
|
||||||
type: 'tool-result',
|
type: 'tool-result',
|
||||||
|
|
Loading…
Reference in New Issue