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. #7859
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
Merged
Merged
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.
Review
🔴 Bugs / will break at runtime
The
?.chain guards up toapi_input_field_list, but.mapis called directly on it. Ifapi_input_field_listisundefined(very common), this throws inside a computed and breaks rendering of the whole card list.When the token is missing you call
window.open(''), which opens an empty tab. Guard before opening (and ideally show an error/toast).el-buttonclick bubbles to the card click handlerThe card root has
@click="handleOpen", so clicking the chat button also fires the card click (emittingclick, potentially navigating). Use@click.stop="toChat".Malformed URL when there is no query
`${...}/${ok.access_token}/${apiQuery.value}`With
apiQuery === ''you get a trailing slash.../token/; with a query you get.../token/?a=b. The slash before an optional query is almost certainly unintended:`${window.location.origin}${chatBasePath}/${ok.access_token}${apiQuery.value}`🟠 Security / robustness
noopener,noreferrer:No error handling / no loading state —
.thenwithout.catchgives an unhandled rejection; rapid clicks fire multiple token requests. Preferasync/await+try/catch+ aloadingref that disables the button.No URL encoding —
f.variable/f.default_valuecan contain&,=, spaces, Chinese text, etc.:Refererheaders. At minimum this is worth a comment/confirmation with the backend; a short-lived token or header-based auth is preferable.🟡 Code quality / style
Imports are not at the top of the file.
import applicationAPI,useRoute/useRouter,computed, andCHAT_API_BASE_PATHare declared afterdefineOptions/defineProps/defineEmits. This violatesimport/first, hurts readability and may break some tooling. Consolidate all imports at the top and merge duplicates (vue,vue-router).Unused import —
useRouteis never used.(f: any)— give it a proper type (ApiInputField), and type the computed's return asstring.Simplification:
chatBasePathdoesn't depend on reactive state — move it to module scope so it isn't recomputed per instance. AlsoCHAT_API_BASE_PATH.replace(/\/api$/, '')silently does nothing if the constant has a trailing slash (/api/); consider normalizing or asserting.Business logic leaking into a presentational card.
ApplicationCardis now coupled towork_flowinternals and the application API. Extract into a composable, e.g.useApplicationChat(application)returning{ apiQuery, openChat, loading }.Double guard mismatch —
:class="{ 'cursor-pointer': !selectable }"implies the card is clickable when not selectable, buthandleOpenonly emits when!selectable. Correct, but thetoChatbutton is rendered unconditionally in the footer; consider hiding/disabling it when!application.is_publish(the siblingv-ifblock implies unpublished apps shouldn't be chatted with).Diff noise — the re-formatting of
MkResourceCardandMkStatusLabel(re-wrapping attributes) is unrelated to the feature and makes review harder. Revert it or split into a separate commit.Suggested rewrite (core part)