diff --git a/wren-ui/src/apollo/server/data/sample.ts b/wren-ui/src/apollo/server/data/sample.ts index c056b5dc3..32f425ae1 100644 --- a/wren-ui/src/apollo/server/data/sample.ts +++ b/wren-ui/src/apollo/server/data/sample.ts @@ -13,11 +13,15 @@ export interface SampleDatasetRelationship { toColumnName: string; type: RelationType; } +export interface SuggestedQuestion { + question: string; + label: string; +} export interface SampleDataset { name: string; // SampleDatasetName tables: SampleDatasetTable[]; - questions?: string[]; + questions?: SuggestedQuestion[]; relations?: SampleDatasetRelationship[]; } @@ -59,9 +63,19 @@ export const sampleDatasets: Record = { }, ], questions: [ - 'What are the top 5 selling albums in the US', - 'What is the total revenue generated from each genre', - 'Which customers have made purchases of tracks from albums in each genre', + { + question: 'What are the top 5 selling albums in the US', + label: 'Ranking ', + }, + { + question: 'What is the total revenue generated from each genre', + label: 'Aggregation', + }, + { + question: + 'Which customers have made purchases of tracks from albums in each genre', + label: 'General', + }, ], relations: [ { @@ -144,9 +158,21 @@ export const sampleDatasets: Record = { }, ], questions: [ - 'What are the top 3 value for orders placed by customers in each city', - 'What is the average score of reviews submitted for orders placed by customers in each city', - 'What is the total value of payments made by customers from each state', + { + question: + 'What are the top 3 value for orders placed by customers in each city', + label: 'Ranking', + }, + { + question: + 'What is the average score of reviews submitted for orders placed by customers in each city', + label: 'Aggregation', + }, + { + question: + 'What is the total value of payments made by customers from each state', + label: 'Aggregation', + }, ], relations: [ { @@ -213,9 +239,21 @@ export const sampleDatasets: Record = { }, ], questions: [ - 'How many three-pointers were made by each player in each game', - 'What is the differences in turnover rates between teams with high and low average scores', - 'Which teams had the highest average points scored per game throughout the season', + { + question: + 'How many three-pointers were made by each player in each game', + label: 'Aggregation', + }, + { + question: + 'What is the differences in turnover rates between teams with high and low average scores', + label: 'Comparison', + }, + { + question: + 'Which teams had the highest average points scored per game throughout the season', + label: 'Ranking', + }, ], relations: [ { diff --git a/wren-ui/src/apollo/server/resolvers.ts b/wren-ui/src/apollo/server/resolvers.ts index 9e0652300..55332f50c 100644 --- a/wren-ui/src/apollo/server/resolvers.ts +++ b/wren-ui/src/apollo/server/resolvers.ts @@ -22,7 +22,7 @@ const resolvers = { // Ask askingTask: askingResolver.getAskingTask, - askQuestions: askingResolver.getAskQuestions, + suggestedQuestions: askingResolver.getSuggestedQuestions, // Thread thread: askingResolver.getThread, diff --git a/wren-ui/src/apollo/server/resolvers/askingResolver.ts b/wren-ui/src/apollo/server/resolvers/askingResolver.ts index c46725a64..25ad0d5f6 100644 --- a/wren-ui/src/apollo/server/resolvers/askingResolver.ts +++ b/wren-ui/src/apollo/server/resolvers/askingResolver.ts @@ -50,10 +50,10 @@ export class AskingResolver { this.listThreads = this.listThreads.bind(this); this.createThreadResponse = this.createThreadResponse.bind(this); this.getResponse = this.getResponse.bind(this); - this.getAskQuestions = this.getAskQuestions.bind(this); + this.getSuggestedQuestions = this.getSuggestedQuestions.bind(this); } - public async getAskQuestions( + public async getSuggestedQuestions( _root: any, _args: any, ctx: IContext, diff --git a/wren-ui/src/apollo/server/schema.ts b/wren-ui/src/apollo/server/schema.ts index baade439f..ab0ad8393 100644 --- a/wren-ui/src/apollo/server/schema.ts +++ b/wren-ui/src/apollo/server/schema.ts @@ -390,10 +390,13 @@ export const typeDefs = gql` summary: String! responses: [ThreadResponse!]! } - + type SuggestedQuestion { + question: String! + label: String! + } # Ask Questions Responses - type AskQuestionResponse { - questions: [String]! + type SuggestedQuestionResponse { + questions: [SuggestedQuestion]! } # Query and Mutation @@ -411,7 +414,7 @@ export const typeDefs = gql` # Ask askingTask(taskId: String!): AskingTask! - askQuestions: AskQuestionResponse! + suggestedQuestions: SuggestedQuestionResponse! threads: [Thread!]! thread(threadId: Int!): DetailedThread! threadResponse(responseId: Int!): ThreadResponse!