-
Notifications
You must be signed in to change notification settings - Fork 1.4k
feat(wren-ui): use intent reasoning instead of hard code string for misleading query #1217
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
Conversation
WalkthroughThis pull request introduces an Changes
Possibly related PRs
Suggested reviewers
Poem
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
wren-ui/src/apollo/server/resolvers/askingResolver.ts (1)
Line range hint
1-228: Architecture implementation is clean and well-structured.The implementation of intent reasoning follows a clean architecture pattern:
- GraphQL schema defines the contract
- Server-side adaptor handles the transformation from snake_case to camelCase
- Resolver properly propagates the field
- Client-side types ensure type safety
The changes are minimal, focused, and maintain consistency across all layers of the application.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (9)
wren-ui/src/apollo/client/graphql/__types__.ts(1 hunks)wren-ui/src/apollo/client/graphql/home.generated.ts(2 hunks)wren-ui/src/apollo/client/graphql/home.ts(1 hunks)wren-ui/src/apollo/server/adaptors/wrenAIAdaptor.ts(2 hunks)wren-ui/src/apollo/server/models/adaptor.ts(1 hunks)wren-ui/src/apollo/server/resolvers/askingResolver.ts(2 hunks)wren-ui/src/apollo/server/schema.ts(1 hunks)wren-ui/src/components/pages/home/prompt/Result.tsx(2 hunks)wren-ui/src/components/pages/home/prompt/index.tsx(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Analyze (javascript-typescript)
- GitHub Check: Analyze (go)
🔇 Additional comments (13)
wren-ui/src/apollo/server/models/adaptor.ts (1)
122-124: LGTM! The type extension is well-defined.The optional
intentReasoningfield is properly typed and maintains backward compatibility.wren-ui/src/components/pages/home/prompt/index.tsx (1)
108-108: LGTM! The memoized result is properly handled.Good use of optional chaining and fallback to empty string for the
intentReasoningfield.wren-ui/src/apollo/client/graphql/home.ts (1)
131-131: LGTM! The GraphQL query is properly extended.The
intentReasoningfield is correctly added to theASKING_TASKquery structure.wren-ui/src/components/pages/home/prompt/Result.tsx (2)
43-43: LGTM! The Props interface is properly extended.The
intentReasoningfield is correctly typed as string in the Props interface.
121-123: LGTM! The error description fallback chain is well-implemented.Good implementation of the fallback chain:
- First tries
config.description- Then falls back to
data.intentReasoning- Finally falls back to error message
wren-ui/src/apollo/server/resolvers/askingResolver.ts (2)
47-47: LGTM! The interface change is well-structured.The optional
intentReasoningfield is appropriately typed and aligns with the PR's objective of supporting AI-generated intent reasoning.
228-228: LGTM! Clean implementation of intent reasoning.The field is correctly mapped from the AI service response to the resolver's return object.
wren-ui/src/apollo/server/adaptors/wrenAIAdaptor.ts (2)
510-510: LGTM! Proper extraction of the intent reasoning field.The snake_case
intent_reasoningfield is correctly destructured from the AI service response.
523-523: LGTM! Consistent field transformation.The snake_case
intent_reasoningis properly transformed to camelCaseintentReasoningin the return object, maintaining consistency with the codebase's naming conventions.wren-ui/src/apollo/server/schema.ts (1)
586-586: LGTM! GraphQL schema properly extended.The
intentReasoningfield is correctly defined as a nullable String type in the AskingTask type, matching the TypeScript interface.wren-ui/src/apollo/client/graphql/__types__.ts (1)
30-30: LGTM! Client-side type definition is consistent.The
intentReasoningfield is properly typed asMaybe<Scalars['String']>, maintaining type safety and consistency with the GraphQL schema.wren-ui/src/apollo/client/graphql/home.generated.ts (2)
28-28: LGTM! Type definition properly extended.The
intentReasoningfield is correctly added to theAskingTaskQuerytype with proper TypeScript optional and nullable type modifiers.
321-321: LGTM! GraphQL query field properly added.The
intentReasoningfield is correctly added to theaskingTaskquery selection set, aligning with the type definition.
Description
AI API
↓ example response
{ "status": "finished", "rephrased_question": "What is the current number of people sleeping at 2025-01-23 15:07:29?", "intent_reasoning": "The question about 'people sleeping' is unrelated to the database schema.", "type": "MISLEADING_QUERY", "response": null, "error": null }UI screenshots
Summary by CodeRabbit
New Features
intentReasoningfield to provide additional context about task intent across multiple system componentsImprovements