Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion wren-ui/src/apollo/server/adaptors/wrenAIAdaptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ export class WrenAIAdaptor implements IWrenAIAdaptor {
}

private transformAskResult(body: any): AskResult {
const { type, intent_reasoning } = body;
const { type, intent_reasoning, invalid_sql } = body;
const { status, error } = this.transformStatusAndError(body);
const candidates = (body?.response || []).map((candidate: any) => ({
type: candidate?.type?.toUpperCase() as AskCandidateType,
Expand All @@ -521,6 +521,7 @@ export class WrenAIAdaptor implements IWrenAIAdaptor {
error,
response: candidates,
intentReasoning: intent_reasoning,
invalidSql: invalid_sql,
};
}

Expand Down
2 changes: 2 additions & 0 deletions wren-ui/src/apollo/server/models/adaptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ export interface AskResponse<R, S> {
status: S;
response: R | null;
error: WrenAIError | null;
invalid_sql?: string;
}

export interface AskDetailInput {
Expand All @@ -122,6 +123,7 @@ export type AskResult = AskResponse<
AskResultStatus
> & {
intentReasoning?: string;
invalidSql?: string;
};

export enum RecommendationQuestionStatus {
Expand Down
7 changes: 4 additions & 3 deletions wren-ui/src/apollo/server/resolvers/askingResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export interface AskingTask {
}>;
error: WrenAIError | null;
intentReasoning?: string;
invalidSql?: string;
}

// DetailedThread is a type that represents a detailed thread, which is a thread with responses.
Expand Down Expand Up @@ -205,7 +206,6 @@ export class AskingResolver {
false,
);
}

// construct candidates from response
const candidates = await Promise.all(
(askResult.response || []).map(async (response) => {
Expand All @@ -219,14 +219,15 @@ export class AskingResolver {
};
}),
);

return {
const res = {
type: askResult.type,
status: askResult.status,
error: askResult.error,
candidates,
intentReasoning: askResult.intentReasoning,
invalidSql: askResult.invalid_sql,
};
return res;
}

public async createThread(
Expand Down
1 change: 1 addition & 0 deletions wren-ui/src/apollo/server/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,7 @@ export const typeDefs = gql`
error: Error
candidates: [ResultCandidate!]!
intentReasoning: String
invalidSql: String
}

input InstantRecommendedQuestionsInput {
Expand Down