fix(wren-ai-service): fix global instructions indexing issue#1480
fix(wren-ai-service): fix global instructions indexing issue#1480
Conversation
WalkthroughThe changes update how instruction objects are processed. In the indexing pipeline, a print statement now logs the Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant InstructionsService
participant InstructionsConverter
participant Pipeline
Client->>InstructionsService: Send request with instructions data
InstructionsService->>InstructionsService: Parse request and loop through instructions
alt Instruction is default
InstructionsService->>InstructionsService: Create Instruction (empty question)
else Instruction is non-default
InstructionsService->>InstructionsService: Iterate each question, create Instruction
end
InstructionsService->>InstructionsConverter: Pass instructions for conversion
InstructionsConverter->>Console: Log instructions parameter
InstructionsConverter->>InstructionsConverter: Build addition dictionary
alt Instruction is default
InstructionsConverter->>InstructionsConverter: Set content to default message
else Instruction is non-default
InstructionsConverter->>InstructionsConverter: Set content from instruction.question
end
InstructionsConverter-->>Pipeline: Return Document
Pipeline->>InstructionsService: Continue processing
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (3)
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. 🪧 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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
wren-ai-service/src/pipelines/indexing/instructions.py (1)
36-36: Replace print statement with proper logger call.Using print statements in production code is generally discouraged. Consider replacing this with a proper logging statement using the already defined logger.
- print(f"instructions: {instructions}") + logger.debug(f"instructions: {instructions}")
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
wren-ai-service/src/pipelines/indexing/instructions.py(2 hunks)wren-ai-service/src/web/v1/services/instructions.py(1 hunks)
🧰 Additional context used
🧬 Code Definitions (1)
wren-ai-service/src/web/v1/services/instructions.py (1)
wren-ai-service/src/pipelines/indexing/instructions.py (1)
Instruction(20-25)
⏰ Context from checks skipped due to timeout of 90000ms (4)
- GitHub Check: pytest
- GitHub Check: pytest
- GitHub Check: Analyze (javascript-typescript)
- GitHub Check: Analyze (go)
🔇 Additional comments (2)
wren-ai-service/src/pipelines/indexing/instructions.py (1)
48-50: LGTM! Correctly handles default instructions.This change properly distinguishes between default and non-default instructions when setting the content field. For default instructions, a clear message is used instead of an empty question string, which improves clarity and searchability.
wren-ai-service/src/web/v1/services/instructions.py (1)
77-97: LGTM! Fix correctly handles global instruction indexing.This change properly fixes the global instructions indexing issue by:
- Creating a single instruction object with an empty question for default instructions
- Creating separate instruction objects for each question for non-default instructions
The explicit conditional approach is cleaner and more maintainable than the previous list comprehension, making the distinction between instruction types clear.
Summary by CodeRabbit