Skip to content

feat: add stream condition to the model association#1498

Merged
looplj merged 1 commit into
unstablefrom
dev-tmp
Apr 26, 2026
Merged

feat: add stream condition to the model association#1498
looplj merged 1 commit into
unstablefrom
dev-tmp

Conversation

@looplj

@looplj looplj commented Apr 26, 2026

Copy link
Copy Markdown
Owner

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new stream condition for model associations, allowing users to filter associations based on whether a request is streaming or not. The changes span the frontend association dialog, including new validation logic and localized strings, and the backend validation and evaluation engines. Feedback focuses on improving translation consistency for the new field, handling operator aliases in the UI to prevent data loss, and ensuring the backend validation logic includes all supported operators for consistency.

],
},
{
value: 'stream',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The stream field label is hardcoded as 'Stream' in the whenFilterFields definition. However, the translation logic in AssociationRow (around line 1260) currently only explicitly handles the prompt_tokens field. This will prevent the stream label from being translated in other languages (e.g., Chinese). Consider refactoring the logic in AssociationRow to use a generic translation key based on the field value.

}

if (!promptTokensOperators.includes(condition.operator as PromptTokensOperator)) {
if (!isValidConditionOperator(condition.field, condition.operator)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The isValidConditionOperator check is strict and only allows operators defined in whenFilterFields (like eq, ne). However, the backend supports various aliases (e.g., ==, !=, <). If a condition is saved with one of these aliases via the API, it will be filtered out by normalizeWhenCondition and disappear from the UI. Consider mapping these aliases to their canonical names before validation.


func validateStreamLeaf(condition objects.Condition) error {
switch condition.Operator {
case "eq", "ne", "=", "==", "!=":

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The validateStreamLeaf function is missing the <> operator, which is supported by the condition evaluator in internal/objects/condition.go. Adding it ensures consistency between validation and evaluation logic.

Suggested change
case "eq", "ne", "=", "==", "!=":
case "eq", "ne", "=", "==", "!=", "<>":

devin-ai-integration[bot]

This comment was marked as resolved.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@looplj looplj merged commit 31497b5 into unstable Apr 26, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant