Repository navigation
fix: [Portal] Portal name and logo settings have not taken effect #7832
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,7 +9,9 @@ import AccountMenu from '../account-menu/index.vue' | |
| import { usePortalConversationListStore, type PortalApplicationGroup } from './index' | ||
| import RenameConversation from '../../components/rename/index.vue' | ||
| import { useMessageListStore } from '../../components/message-list/index' | ||
|
|
||
| import auth from '@/api/chat/auth.ts' | ||
| import { useStore } from '@/stores/chat/index.ts' | ||
| const { auth: authStore }=useStore() | ||
| defineOptions({ name: 'PortalConversationList' }) | ||
|
|
||
| const msgs = useMessageListStore() | ||
|
|
@@ -78,15 +80,22 @@ const handleClearConversations = () => { | |
| clearing.value = false | ||
| }) | ||
| } | ||
| const name=computed(()=>{ | ||
| const meta:any=authStore.authProfile?.meta | ||
| return meta.portal_name ||'智能体门户' | ||
| }) | ||
| const logo=computed(()=>{ | ||
| return authStore.authProfile?.logo | ||
| }) | ||
| </script> | ||
|
|
||
| <template> | ||
| <div class="flex-column h-full overflow-hidden p-4"> | ||
| <!-- 门户名称与收起侧栏 --> | ||
| <div class="mb-4 flex-between shrink-0 gap-2"> | ||
| <div class="min-w-0 flex-align-center gap-2"> | ||
| <PortalIcon /> | ||
| <h4 class="truncate">智能体门户</h4> | ||
| <PortalIcon :icon="logo"/> | ||
| <h4 class="truncate">{{name}}</h4> | ||
| </div> | ||
| <!-- 收起左侧 --> | ||
| <MkTooltip content="收起侧边栏"> | ||
|
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. Review1. 🐞 Potential runtime error (bug)const meta: any = authStore.authProfile?.meta
return meta.portal_name || '智能体门户'
Fix: const portalName = computed(() => authStore.authProfile?.meta?.portal_name || '智能体门户')Also drop 2. 🐞 Pinia destructuring breaks reactivityconst { auth: authStore } = useStore()Destructuring a store loses reactivity for reassigned references. If Preferred: const store = useStore()
// then use store.auth.authProfileor 3.
|
||
|
|
||
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 of the Diff
Potential Issues
Inconsistent
metasemantics between branches"meta": {"portal_name": ""}, branch 2 returns"meta": {"portal_name": portal.name}.profile()), clients must handleportal_namebeing either empty or populated. This is acceptable only if Branch 1 truly has no portal context (e.g., unauthenticated/default profile). Confirm that assumption.portal.namemay beNoneor missingnameis nullable, the API may return"portal_name": null(or raiseAttributeErrorifportalisNone)."portal_name": getattr(portal, "name", "") or "".Silent override by
**result"meta"is defined before**result. In Python, later keys win, so ifresultever contains a"meta"key it will silently replace the one set here. Verifyresultnever includesmeta, or movemetaafter**resultif you intend it to win.Repeated DB call per request
get_key_pair_by_sql().get("key")is invoked on everyprofile()call (and possibly twice if both branches execute). Consider caching the key pair (e.g.,functools.lru_cacheor a short-TTL cache) since RSA keys rarely change.Branch divergence / duplication
login_value,default_value,meta, andlogo, but sharersa_key. This duplication invites drift (e.g., someone will update one and forget the other). Consider building a base dict and merging branch-specific overrides.Indentation in the second hunk looks slightly off
"login_value"etc. are indented less than the first branch's block. Verify both blocks are aligned within their parent dict; Python will still parse but it suggests the branches may be at different nesting levels — confirm they're both intended as sibling return values.Optimization Suggestions
DEFAULT_META = {"portal_name": ""}andDEFAULT_LOGO = "./favicon.ico"to keep branches consistent.portal.name or ""(orgetattr) to guarantee a string type in the response schema.get_key_pair_by_sql()result.auth_configis fetched per-request, consider whetherlogin_valueanddefault_valueneed consistency validation (e.g.,typeshould be present inlogin_value), since an unexpectedtypecould produce an invalid default.Minor
"meta": {"portal_name": ""}vs.None: empty string is fine, but document the contract so the frontend doesn't render a blank label unintentionally.Overall the change is small and likely fine; the main risks are (a) inconsistent/absent
portal_name, (b)portal.namenullability, and (c) the**resultoverride order.