Repository navigation
fix: [Agent] Clicking the "Go to Chat" icon on an agent card yields no response, and it is impossible to enter the chat page. #7858
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
Closed
Closed
Changes from all commits
Commits
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
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
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.
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.
Here is a review of the provided code diff, highlighting irregularities, potential issues, and optimization suggestions.
1. Irregularities & Best Practices
A. Import Placement
import applicationAPI,useRoute/useRouter,computed, andCHAT_API_BASE_PATHare inserted interspersed with variable definitions anddefineOptions.importstatements to the very top of the<script setup>block. This improves readability and follows standard ESLint/Vue formatting rules (e.g.,import/first).B. Unused
useRouteconst router = useRouter()is initialized, butrouteris never used in the logic.toChatuseswindow.open.useRouteis imported but not utilized either.router.push(). If opening in a new tab via URL construction is intended, remove the Vue Router imports.C. Template Formatting
2. Potential Issues
A. Security: Open Redirect / Command Injection
apiQueryis constructed using unvalidated data fromprops.application.work_flow.nodes...default_value. These values are joined directly into a query string (?key=value) and passed as a fragment/path part ofaccess_token.variableordefault_valuecontain characters like&,#,?, or newlines, they can break the URL structure or inject unintended parameters.access_tokenis appended before the query string. Ensure thatchatBasePath+access_tokenexpects a query string immediately after, and thataccess_tokenitself is URL-encoded if it contains special chars.URLSearchParamsto safely encode query parameters.application.work_flow.B. Race Condition / Context Loss on Window.open
window.openmight be blocked by popup blockers if not triggered directly by a user gesture. Currently, it's inside a.then(())callback. While generally okay if the promise resolves immediately, if there's network latency, some browsers might flag this as non-user-triggered.window.open.C. Fragile Data Selection
props.application?.work_flow?.nodes?.find(...). If the structure changes slightly, this silently fails returning empty strings.apiQuery.valueis always safe to append. The current implementation handles missing data correctly by returning''.3. Optimization Suggestions
A. Computed Property Dependency
apiQuerycomputed property depends onprops.application. This is correct and efficient as Vue will recompute only whenprops.applicationchanges.B. String Construction for URL
`${window.location.origin}${chatBasePath}/${ok.access_token}/${apiQuery.value}`access_tokenis URL-safe. Ifaccess_tokencontains slashes or spaces, this URL breaks.C. Template Performance
MkStatusLabelv-else block has inline logic:icon="application.is_publish ? undefined : 'icon_time_filled'". This is minor but fine. EnsureMkStatusLabelis optimized for frequent re-renders if this list is large.Refactored Script Segment Example
Summary of Actions
useRouter/useRouteimports/variables.URLSearchParamsfor building the query string to prevent malformed URLs.try/catchor.catch) around the asyncgetAccessTokencall.