-
Notifications
You must be signed in to change notification settings - Fork 3.9k
feat: Add Suggestions tab to the agent rule creation flow #95875
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
Open
samranahm
wants to merge
29
commits into
Expensify:main
Choose a base branch
from
samranahm:95742/agent-rule-suggestions
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+991
−80
Open
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
7fa4d01
Add SuggestedAgentRule type, Onyx key, and agent rule tab constants
samranahm 53af052
Add translations for agent rule Suggestions and Edit tabs
samranahm adc977d
dd useSuggestedAgentRules hook and suggestion icon mapping
samranahm dc63702
Add Suggestions and Edit tabs to the new agent rule flow
samranahm 8a84569
Add tests for suggested agent rules
samranahm a233648
Update API command GET_AGENT_RULE_SUGGESTIONS and corresponding param…
samranahm c3e2bda
impliment review feedback
samranahm cb4cd9b
Add test to disable Next button when selected suggestion is filtered out
samranahm 3f6f74d
Add loading state management for agent rule suggestions
samranahm 04a7dea
fix typo in agent rule suggestion comment
samranahm d44547b
update addRuleTitle key to newRuleTitle
samranahm 093b1c1
check isOffline before calling getAgentRuleSuggestions
samranahm f317678
Refactor AddAgentRulePage to manage active tab state with useState an…
samranahm 8d0a006
update suggested agent rule icon logic with priority-based matching a…
samranahm 3f3d465
add optional chaining in filter, change TextInput role to SEARCHBOX, …
samranahm ca363a7
change handleKeyPress to submitFormOnModEnter
samranahm a807dbe
Enhance loading and empty state handling in AddAgentRuleSuggestionsTa…
samranahm b9aa633
use max height in edit tab text input field
samranahm 53aa317
Merge remote-tracking branch 'upstream/main' into 95742/agent-rule-su…
samranahm d04f354
Implement review feedbacks
samranahm 2e8d12d
fix failing test
samranahm a5f1143
fix lint
samranahm ca02303
Merge remote-tracking branch 'upstream/main' into 95742/agent-rule-su…
samranahm fbf0fbe
Center BlockingView vertically
samranahm a43a2c6
update AddAgentRulePage to keep Suggestions tab mounted when inactive…
samranahm 30687bc
Merge remote-tracking branch 'upstream/main' into 95742/agent-rule-su…
samranahm 5d62315
fix: network flip draft clear and remove manual showConfirmModal
samranahm 4d3e782
fix lint
samranahm df4e83e
correct capitalization in comment
samranahm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| /** | ||
| * Reads backend-served suggested agent rules from Onyx for the add-agent-rule Suggestions tab. | ||
| */ | ||
| import ONYXKEYS from '@src/ONYXKEYS'; | ||
| import type SuggestedAgentRule from '@src/types/onyx/SuggestedAgentRule'; | ||
| import isLoadingOnyxValue from '@src/types/utils/isLoadingOnyxValue'; | ||
|
|
||
| import useOnyx from './useOnyx'; | ||
|
|
||
| type UseSuggestedAgentRulesResult = { | ||
| /** Suggested rules from Onyx, or an empty array while loading or when no suggestions exist */ | ||
| data: SuggestedAgentRule[]; | ||
|
|
||
| /** Whether Onyx is hydrating or the suggestions request is fetching data */ | ||
| isLoading: boolean; | ||
| }; | ||
|
|
||
| function useSuggestedAgentRules(): UseSuggestedAgentRulesResult { | ||
| const [suggestions, metadata] = useOnyx(ONYXKEYS.AGENT_RULE_SUGGESTIONS); | ||
| const [isFetchingSuggestions] = useOnyx(ONYXKEYS.IS_LOADING_AGENT_RULE_SUGGESTIONS); | ||
| const isLoading = isLoadingOnyxValue(metadata) || !!isFetchingSuggestions; | ||
|
|
||
| return { | ||
| data: suggestions ?? [], | ||
| isLoading, | ||
| }; | ||
| } | ||
|
|
||
| export default useSuggestedAgentRules; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7636,16 +7636,22 @@ ${reportName}`, | |
| addRule: 'エージェントルールを追加', | ||
| findRule: 'エージェントルールを検索', | ||
| addRuleTitle: 'ルールを追加', | ||
| newRuleTitle: '新しいルール', | ||
| editRuleTitle: 'ルールを編集', | ||
| deleteRule: 'ルールを削除', | ||
| deleteRuleConfirmation: 'このルールを削除してもよろしいですか?', | ||
| describeRuleTitle: 'AI エージェントに従わせるルールを記述してください', | ||
| describeRuleHeadline: 'ルールを説明する', | ||
| disclaimer: 'AI エージェントは間違える場合があります。', | ||
| agentCreatedTitle: 'RuleBot がワークスペースに追加されました!', | ||
| agentCreatedDescription: (agentsRoute: string) => | ||
| `<muted-text>エージェント ルールを適用するために、エージェントを作成し、ワークスペースの管理者として追加しました。<br><br>エージェントの詳細は <a href="${agentsRoute}">「アカウント」>「エージェント」</a> で編集できます。</muted-text>`, | ||
| suggestionsTab: 'おすすめ', | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. question: Are we sure the translation is correct?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, these are correct. |
||
| writeTab: '編集', | ||
| findSuggestion: 'ルールを探す', | ||
| emptySuggestionsTitle: '利用可能な提案はありません', | ||
| emptySuggestionsSubtitle: '独自のルールを作成してみてください。', | ||
| revampSubtitle: '必要なときに実行できる柔軟なルールを設定します。', | ||
| newRuleTitle: '新しいルール', | ||
| describeRuleForConcierge: 'ルールの内容を入力すると、Concierge が自動作成します', | ||
| gotIt: '了解しました', | ||
| createRule: 'ルールを作成', | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.