larry-zy commented on code in PR #1617:
URL: https://github.com/apache/dubbo-admin/pull/1617#discussion_r4440264436


##########
ui-vue3/src/api/service/aiMemory.ts:
##########
@@ -0,0 +1,113 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ */
+import axios from 'axios'
+
+export type TaskType = 'diagnosis' | 'configuration' | 'inspection'
+export interface MatchContext {
+  projectRef?: string
+  taskType?: TaskType
+}
+export interface AIChatRequestContext {
+  matchContext?: MatchContext
+}
+export interface MemorySettings {
+  generation: number
+  state_version: number
+  enabled: boolean
+}
+export interface MemoryOptions {
+  projects: { id: string }[]
+  task_types: TaskType[]
+}
+export interface MemoryWrite {
+  generation: number
+  state_version: number
+  version?: number
+  scope_type: 'user'
+  memory_type: 'preference' | 'task_context' | 'diagnostic_constraint'
+  fact_key: string
+  value: string
+  applicability: MatchContext
+  source_session_id?: string
+  expires_at?: string | null
+}
+export interface ExplicitMemory {
+  id: string
+  memory_type: MemoryWrite['memory_type']
+  fact_key: string
+  value: string
+  applicability: MatchContext
+  status: string
+  version: number
+  provenance: string
+  source_session_id?: string
+  expires_at?: string | null
+  updated_at: string
+}
+export interface MemoryPage extends MemorySettings {
+  records: ExplicitMemory[]
+  next_cursor?: string
+}
+
+// AI endpoints use their own envelope, unlike the Console request interceptor.
+const client = axios.create({ baseURL: '/api/v1/ai', withCredentials: true, 
timeout: 30000 })

Review Comment:
   [P1] Use the authenticated AI client for Memory requests
   
   This new Axios instance has no `accessTokenManager` request/401-refresh 
interceptors, unlike the existing client in `ai.ts`. In the supported 
Admin-issued RS256/JWKS configuration, a logged-in user can successfully call 
`/sessions`, but `/memory-options`, `/memories`, and `/memory-settings` are 
sent without Authorization and return 401. `withCredentials` only carries 
cookies; the production AI JWT verifier requires a Bearer token. I reproduced 
the missing header with an available valid token and confirmed the cookie-only 
401/Bearer 200 behavior through the real Router. Please extract or reuse a 
shared authenticated AI transport, including token refresh, for these 
endpoints; the fixture's cookie-to-Bearer adapter does not exist on the normal 
direct-JWT route.



##########
ui-vue3/e2e/mvp.ts:
##########
@@ -0,0 +1,46 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ */
+import { createApp, h, ref } from 'vue'
+import { createI18n } from 'vue-i18n'
+import Antd from 'ant-design-vue'
+import 'ant-design-vue/dist/reset.css'
+import '@/style.css'
+import AgentDrawer from '@/components/AgentDrawer.vue'
+import en from '@/base/i18n/en'
+
+// Separate Vite development entry; absent from the production build/router.
+createApp({
+  setup() {
+    const open = ref(true)
+    return () =>

Review Comment:
   [P2] Initialize the authentication flow in the standalone MVP entry
   
   This entry mounts AgentDrawer without the application's 
auth-configuration/token bootstrap, so `accessTokenManager` remains disabled. 
The fixture login only sets an HttpOnly `mvp-fixture` cookie, and its proxy 
adapter can authenticate only requests that carry that cookie. The real chat 
client uses `credentials: 'omit'`, so its streaming request contains neither 
cookie nor Bearer token. I reproduced this in a headless browser using this 
page and `TestMVPBrowserServer`: `/memory-options` and Session creation return 
200, then the first `/chat/stream` returns 401. Thus the current acceptance 
flow cannot reach the Provider. Please wire the entry and fixture to the 
application's token-issuance/authentication flow and rerun the MVP browser 
suite.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to