Skip to content

Commit ee383a1

Browse files
authored
feat: Add an opening message and an icon to the conversation page. (#7486)
1 parent 8c4cb92 commit ee383a1

41 files changed

Lines changed: 1133 additions & 103 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎ui/src/api/admin/auth/external-login.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
/** 提供 Admin 第三方认证、扫码登录及客户端授权回调接口。 */
22

33
import { get } from '../core/request'
4-
import type { ExternalAuthSetting, LoginResponse, QrCodeSource } from './types'
4+
import type { ExternalAuthSetting, QrCodeSource } from '@/api/types'
5+
import type { LoginResponse } from './types'
56

67
/** 获取外部认证方式的跳转配置。 */
78
const getExternalAuthSetting = (authType: string) => {

‎ui/src/api/admin/auth/types.ts‎

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/** Admin 认证 API 及其 Store 消费方共同使用的类型。 */
22

3-
import type { LoginMethod, QrCodeConfig, WorkspaceItem } from '@/api/types'
3+
import type { WorkspaceItem } from '@/api/types'
44

55
export interface CurrentUserInfo {
66
email: string
@@ -32,24 +32,6 @@ export interface CaptchaResponse {
3232
captcha: string
3333
}
3434

35-
export interface ExternalAuthConfig {
36-
authEndpoint?: string
37-
clientId?: string
38-
ldpUri?: string
39-
redirectUrl: string
40-
scope?: string
41-
state?: string
42-
}
43-
44-
export interface ExternalAuthSetting {
45-
config?: ExternalAuthConfig
46-
}
47-
48-
export interface QrCodeSource {
49-
auth_type: Extract<LoginMethod, 'dingtalk' | 'lark' | 'wecom'>
50-
config: QrCodeConfig
51-
}
52-
5335
export interface BaseProfile {
5436
edition: 'CE' | 'EE' | 'PE'
5537
license_is_valid: boolean

‎ui/src/api/admin/system/resource-management/application/application.ts‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
import { del, get, getExportFile, put } from '@/api/admin/core/request'
22
import type { ParamsPage, ResponsePage } from '@/api/admin/core/types'
3-
import type { ApplicationAccessToken, ApplicationAccessTokenPayload, ApplicationDetail, ApplicationFormPayload, Dict } from '@/api/types'
3+
import type {
4+
ApplicationAccessToken,
5+
ApplicationAccessTokenPayload,
6+
ApplicationDetail,
7+
ApplicationDisplaySetting,
8+
ApplicationFormPayload,
9+
Dict,
10+
} from '@/api/types'
411

512
const prefix = '/system/resource/application'
613

@@ -43,6 +50,9 @@ const getAccessToken = (applicationId: string) => get<ApplicationAccessToken>(`$
4350
const putAccessToken = (applicationId: string, payload: ApplicationAccessTokenPayload) =>
4451
put<ApplicationAccessTokenPayload, ApplicationAccessToken>(`${prefix}/${applicationId}/access_token`, payload)
4552

53+
/** 获取智能体展示设置,仅许可证有效的专业版、企业版提供;未保存过的字段可能缺失。 */
54+
const getDisplaySetting = (applicationId: string) => get<Partial<ApplicationDisplaySetting>>(`${prefix}/${applicationId}/setting`)
55+
4656
/** 保存智能体展示设置,沿用 V2 图片与配置的 multipart 协议。 */
4757
const putDisplaySetting = (applicationId: string, payload: FormData) => put<FormData>(`${prefix}/${applicationId}/setting`, payload)
4858

@@ -61,6 +71,7 @@ export default {
6171
getApplicationDetail,
6272
getAccessToken,
6373
putAccessToken,
74+
getDisplaySetting,
6475
putDisplaySetting,
6576
putApplication,
6677
putApplicationPublish,

‎ui/src/api/admin/workspace/application/application.ts‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
import { del, get, getExportFile, post, put } from '../../core/request'
22
import type { ParamsPage, ResponsePage } from '../../core/types'
3-
import type { ApplicationAccessToken, ApplicationAccessTokenPayload, ApplicationDetail, ApplicationFormPayload, Dict } from '@/api/types'
3+
import type {
4+
ApplicationAccessToken,
5+
ApplicationAccessTokenPayload,
6+
ApplicationDetail,
7+
ApplicationDisplaySetting,
8+
ApplicationFormPayload,
9+
Dict,
10+
} from '@/api/types'
411
import { getWorkspaceId } from '@/utils/resource-context'
512

613
const getPrefix = () => {
@@ -32,6 +39,9 @@ const getAccessToken = (applicationId: string) => get<ApplicationAccessToken>(`$
3239
const putAccessToken = (applicationId: string, payload: ApplicationAccessTokenPayload) =>
3340
put<ApplicationAccessTokenPayload, ApplicationAccessToken>(`${getPrefix()}/${applicationId}/access_token`, payload)
3441

42+
/** 获取智能体展示设置,仅许可证有效的专业版、企业版提供;未保存过的字段可能缺失。 */
43+
const getDisplaySetting = (applicationId: string) => get<Partial<ApplicationDisplaySetting>>(`${getPrefix()}/${applicationId}/setting`)
44+
3545
/** 保存智能体展示设置,沿用 V2 图片与配置的 multipart 协议。 */
3646
const putDisplaySetting = (applicationId: string, payload: FormData) => put<FormData>(`${getPrefix()}/${applicationId}/setting`, payload)
3747

@@ -101,6 +111,7 @@ export default {
101111
getApplicationDetail,
102112
getAccessToken,
103113
putAccessToken,
114+
getDisplaySetting,
104115
putDisplaySetting,
105116
deleteApplication,
106117
exportApplication,

‎ui/src/api/chat/auth.ts‎

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
/** 提供单应用对话与门户的认证前置配置、匿名认证、登录和登出接口。 */
1+
/** 提供单应用对话与门户的认证前置配置、匿名认证、账号/第三方/扫码登录和登出接口。 */
22

33
import { get, post, promise, request } from './core/request'
44
import type { ApiResponse } from './core/types'
5-
import type { ApplicationAuthProfile, ChatLoginRequest, ChatLoginResponse, PortalAuthProfile } from '@/api/types'
5+
import type { ApplicationAuthProfile, ChatLoginRequest, ChatLoginResponse, ExternalAuthSetting, PortalAuthProfile, QrCodeSource } from '@/api/types'
66

77
interface ChatCaptchaResponse {
88
captcha: string
@@ -43,6 +43,30 @@ const postLogin = (loginRequest: ChatLoginRequest, accessToken?: string, savedTo
4343
)
4444
}
4545

46+
/** 使用 LDAP 账号登录;传入 accessToken 时登录到对应应用,否则登录门户。携带本地保存的 token。 */
47+
const postLdapLogin = (loginRequest: ChatLoginRequest, accessToken?: string, savedToken?: string) => {
48+
return promise<ChatLoginResponse>(
49+
request.post<ApiResponse<ChatLoginResponse>>(accessToken ? `/auth/ldap/login/${accessToken}` : '/auth/ldap/login', loginRequest, {
50+
headers: getSavedTokenHeaders(savedToken),
51+
}),
52+
)
53+
}
54+
55+
/** 获取 CAS、OIDC、OAuth2 等对话用户第三方认证的跳转配置。 */
56+
const getExternalAuthSetting = (authType: string) => {
57+
return get<ExternalAuthSetting>(`/chat_user/${authType}/detail`)
58+
}
59+
60+
/** 获取对话用户扫码登录提供商配置。 */
61+
const getQrCodeSources = () => {
62+
return get<QrCodeSource[]>('/auth/qr_type/source')
63+
}
64+
65+
/** 使用钉钉扫码授权码登录;传入 accessToken 时登录到对应应用。 */
66+
const getDingTalkCallback = (code: string, accessToken?: string) => {
67+
return get<ChatLoginResponse>('/auth/dingtalk', accessToken ? { code, accessToken } : { code })
68+
}
69+
4670
/**
4771
* 获取应用登录验证码;无需验证码时返回空字符串。
4872
* 后端当前以 `application_id` 查询参数接收 accessToken,且仅支持应用场景。
@@ -56,4 +80,15 @@ const postLogout = () => {
5680
return post<undefined, boolean>('/v3/auth/logout')
5781
}
5882

59-
export default { getApplicationAuthProfile, getPortalAuthProfile, postAnonymousAuth, postLogin, getCaptcha, postLogout }
83+
export default {
84+
getApplicationAuthProfile,
85+
getPortalAuthProfile,
86+
postAnonymousAuth,
87+
postLogin,
88+
postLdapLogin,
89+
getExternalAuthSetting,
90+
getQrCodeSources,
91+
getDingTalkCallback,
92+
getCaptcha,
93+
postLogout,
94+
}

‎ui/src/api/types/application.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@ export interface ApplicationFormPayload {
140140
tts_type?: string
141141
tts_autoplay?: boolean
142142
stt_autosend?: boolean
143+
file_upload_enable?: boolean
144+
file_upload_setting?: Record<string, unknown>
143145
folder_id?: string
144146
workspace_id?: string
145147
mcp_enable?: boolean

‎ui/src/api/types/chat-application.ts‎

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,50 @@
11
/** 对话端智能体信息类型。 */
22

3-
/** 对话端可见的智能体基础信息,仅声明当前使用的字段。 */
3+
import type LogicFlow from '@logicflow/core'
4+
import type { ApplicationType } from './application'
5+
import type { Dict } from './common'
6+
7+
/**
8+
* 对话端可见的智能体信息。门户智能体列表只返回基础字段;
9+
* profile 接口额外返回对话配置(已发布版本)与访问设置,访问设置中的展示项需许可证有效才返回。
10+
*/
411
export interface ChatApplicationProfile {
512
id: string
613
name: string
714
icon: string
8-
desc?: string
15+
desc?: string | null
916
prologue?: string
17+
type?: ApplicationType
18+
dialogue_number?: number
19+
problem_optimization?: boolean
20+
stt_model_id?: string | null
21+
tts_model_id?: string | null
22+
stt_model_enable?: boolean
23+
tts_model_enable?: boolean
24+
tts_type?: string
25+
tts_autoplay?: boolean
26+
stt_autosend?: boolean
27+
file_upload_enable?: boolean
28+
file_upload_setting?: Dict<unknown>
29+
/** 仅包含开始节点(base-node),非工作流智能体为 null。 */
30+
work_flow?: LogicFlow.GraphConfigData | null
31+
show_source?: boolean
32+
show_exec?: boolean
33+
show_share?: boolean
34+
language?: string | null
35+
show_history?: boolean
36+
draggable?: boolean
37+
show_guide?: boolean
38+
avatar?: string
39+
show_avatar?: boolean
40+
float_icon?: string
41+
disclaimer?: boolean
42+
disclaimer_value?: string
43+
custom_theme?: { theme_color?: string; header_font_color?: string }
44+
user_avatar?: string
45+
show_user_avatar?: boolean
46+
float_location?: Dict<unknown>
47+
chat_background?: string
1048
}
1149

1250
/** 门户历史对话中单条会话的摘要。 */

‎ui/src/api/types/login.ts‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,25 @@ export interface QrCodeConfig {
2121
qr_url?: string
2222
}
2323

24+
export interface QrCodeSource {
25+
auth_type: QrCodeProvider
26+
config: QrCodeConfig
27+
}
28+
29+
/** CAS、OIDC、OAuth2 等第三方认证的跳转配置。 */
30+
export interface ExternalAuthConfig {
31+
authEndpoint?: string
32+
clientId?: string
33+
ldpUri?: string
34+
redirectUrl: string
35+
scope?: string
36+
state?: string
37+
}
38+
39+
export interface ExternalAuthSetting {
40+
config?: ExternalAuthConfig
41+
}
42+
2443
export interface UpdatePasswordForm {
2544
password: string
2645
re_password: string
10.9 KB
Loading

‎ui/src/constants/CONSTANT_README.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,6 @@ API 枚举值。例如角色类型和登录方式以 `src/api/enums` 为唯一
4545

4646
`file-type.ts` 维护图片、文档、视频和音频的文件扩展名常量,扩展名统一使用大写。
4747
使用方判断文件类型时先将后缀转换为大写,再与对应常量匹配。
48+
49+
`application.ts` 的 `APPLICATION_DISPLAY_SETTING_DEFAULT` 维护智能体显示设置默认值,专业版显示设置弹窗的
50+
初始与恢复默认、调试面板(社区版或接口未返回的字段)共用;常量只读,使用方修改前先深拷贝。

0 commit comments

Comments
 (0)