-
Notifications
You must be signed in to change notification settings - Fork 1.4k
feat(wren-ui): Enhance save as view for follow-up questions #2004
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
WalkthroughThe changes introduce a Changes
Sequence DiagramsequenceDiagram
participant AnswerResult
participant SaveAsViewModal
participant PromptThreadStore
participant ModelResolver
participant GraphQL
AnswerResult->>AnswerResult: compute rephrasedQuestion<br/>(based on isOpeningQuestion)
AnswerResult->>SaveAsViewModal: open with payload<br/>{rephrasedQuestion}
SaveAsViewModal->>SaveAsViewModal: merge payload into<br/>form submission
SaveAsViewModal->>PromptThreadStore: onSubmit({...payload, ...values})
PromptThreadStore->>ModelResolver: mutation createView with<br/>rephrasedQuestion
ModelResolver->>GraphQL: use rephrasedQuestion<br/>instead of response.question
GraphQL-->>ModelResolver: view created
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (7)
🔇 Additional comments (11)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Description
This PR enhances when saving query results as Views. For follow-up questions, we will use the rephrased question (AI-rewritten question).
Implementation
The implementation uses client-side decision-making, where the frontend determines whether it's an opening question and passes the corresponding question text (original or rephrased) to the backend via GraphQL mutation.
Improve Question Handling Logic When Creating Views
Changes
Core Changes:
rephrasedQuestionparameter toCreateViewInputto allow frontend to explicitly specify the question text to savecreateViewresolver to use the passedrephrasedQuestioninstead of directly usingresponse.questionFrontend Logic Optimization:
isOpeningQuestionprop toAnswerResultcomponent to determine if it's an opening questionSaveAsViewModalto receive and pass through therephrasedQuestionparameterTechnical Details
Modified Files:
wren-ui/src/apollo/server/schema.ts- GraphQL schema definitionwren-ui/src/apollo/server/resolvers/modelResolver.ts- Resolver implementationwren-ui/src/apollo/client/graphql/__types__.ts- TypeScript type definitionswren-ui/src/components/pages/home/promptThread/AnswerResult.tsx- Main logic implementationwren-ui/src/components/pages/home/promptThread/index.tsx- Props passingwren-ui/src/components/pages/home/promptThread/store.tsx- Store type definitionswren-ui/src/components/modals/SaveAsViewModal.tsx- Modal component updateScreenshots or Recordings
Opening Question (First thread response) -> (save as view with question)
Follow-up Question WITH rephrased Question -> (save as view with rephrased question)
Testing
Recommended test scenarios:
Summary by CodeRabbit