@apaas-ai/aily-cui-sdk
Advanced tools
Comparing version 1.2.0 to 1.4.0
{ | ||
"nonCachedDurationMs": 3651.1133193969727 | ||
"nonCachedDurationMs": 61877.963413238525 | ||
} |
@@ -5,2 +5,26 @@ { | ||
{ | ||
"version": "1.4.0", | ||
"tag": "@apaas-ai/aily-cui-sdk@1.4.0", | ||
"date": "Sun, 28 Apr 2024 06:54:04 GMT", | ||
"comments": { | ||
"minor": [ | ||
{ | ||
"comment": "@apaas-ai/error-handler 调整成devDep" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"version": "1.3.0", | ||
"tag": "@apaas-ai/aily-cui-sdk@1.3.0", | ||
"date": "Fri, 26 Apr 2024 10:16:05 GMT", | ||
"comments": { | ||
"minor": [ | ||
{ | ||
"comment": "增加updateConfig api" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"version": "1.2.0", | ||
@@ -7,0 +31,0 @@ "tag": "@apaas-ai/aily-cui-sdk@1.2.0", |
# @apaas-ai/aily-cui-sdk | ||
This log was last generated on Tue, 02 Apr 2024 07:12:28 GMT and should not be manually modified. | ||
This log was last generated on Sun, 28 Apr 2024 06:54:04 GMT and should not be manually modified. | ||
## 1.4.0 | ||
Sun, 28 Apr 2024 06:54:04 GMT | ||
### Minor changes | ||
- @apaas-ai/error-handler 调整成devDep | ||
## 1.3.0 | ||
Fri, 26 Apr 2024 10:16:05 GMT | ||
### Minor changes | ||
- 增加updateConfig api | ||
## 1.2.0 | ||
@@ -6,0 +20,0 @@ Tue, 02 Apr 2024 07:12:28 GMT |
import { type ResourceAndFile, type Resource, type CUIFile } from '../types/cache'; | ||
interface CacheControlProps { | ||
appKey: string; | ||
channelType?: string; | ||
pathBasename?: string; | ||
resourceType?: string; | ||
} | ||
export declare class CacheControl { | ||
@@ -7,3 +13,4 @@ loadPromise: Promise<string> | null; | ||
pathBasename: string | undefined; | ||
constructor(appKey: string, channelType?: string, pathBasename?: string); | ||
resourceType: string | undefined; | ||
constructor(props: CacheControlProps); | ||
loadResource(): Promise<ResourceAndFile>; | ||
@@ -21,2 +28,3 @@ loadResourceFromServer(force?: boolean): Promise<ResourceAndFile>; | ||
private setItem; | ||
} | ||
} | ||
export {}; |
@@ -1,2 +0,2 @@ | ||
/// <reference types="react" /> | ||
/// <reference types="react" resolution-mode="require"/> | ||
export declare enum CUILayoutMode { | ||
@@ -52,2 +52,7 @@ UNSPECIFIED = "unspecified", | ||
} | ||
export interface ApaasAppInfo { | ||
tenantID?: number; | ||
namespace?: string; | ||
tenantType?: number; | ||
} | ||
export interface CUICommonConfig { | ||
@@ -61,2 +66,3 @@ baseURL: string; | ||
channelType?: string; | ||
resourceType?: string; | ||
channelContext?: Record<string, unknown>; | ||
@@ -68,2 +74,3 @@ errorDebugDisabled?: boolean; | ||
appName?: string; | ||
apaasAppInfo?: ApaasAppInfo; | ||
} | ||
@@ -92,2 +99,8 @@ export interface CUITransitionConfig { | ||
} | ||
export interface UpdateConfigProps { | ||
header?: CUIHeaderConfig; | ||
conversion?: CUIConversionConfig; | ||
editor?: CUIEditorConfig; | ||
common?: CUICommonConfig; | ||
} | ||
export interface ChatPanel { | ||
@@ -98,2 +111,6 @@ sendMessage(data: { | ||
}): Promise<void>; | ||
clear(): Promise<void>; | ||
clearAndStop(): Promise<void>; | ||
updateWelcomeMessage(): Promise<void>; | ||
updateConfig(config: UpdateConfigProps): Promise<void>; | ||
} |
{ | ||
"name": "@apaas-ai/aily-cui-sdk", | ||
"version": "1.2.0", | ||
"version": "1.4.0", | ||
"description": "aily-cui-sdk 对外接入包", | ||
@@ -38,4 +38,5 @@ "author": "xiaoziyang.tcpip@bytedance.com", | ||
"@apaas-ai/global-states": "0.0.1", | ||
"@apaas-ai/logger-web": "1.0.0", | ||
"@apaas-infra/config": "1.0.0", | ||
"@apaas-ai/logger-web": "1.0.0" | ||
"@apaas-ai/error-handler": "0.0.0" | ||
}, | ||
@@ -42,0 +43,0 @@ "scripts": { |
@@ -26,5 +26,10 @@ /* | ||
async function initChatPanel(root: HTMLElement, props: CUIConfig): Promise<ChatPanel> { | ||
const cacheControl: CacheControl = new CacheControl(props.appKey as string, props.common?.channelType, ''); | ||
const cacheControl: CacheControl = new CacheControl({ | ||
appKey: props.appKey as string, | ||
channelType: props.common?.channelType, | ||
pathBasename: '', | ||
resourceType: props.common?.resourceType, | ||
}); | ||
setupApiClient({ | ||
baseURL: props.common?.baseURL || '/oda', | ||
baseURL: props.common?.baseURL || 'https://ae.feishu.cn/oda', | ||
token: '', | ||
@@ -44,3 +49,3 @@ }); | ||
common: { | ||
channelType: 'SDK', | ||
channelType: 'AILY_CUI_SDK', | ||
scenes: 'Copilot', | ||
@@ -47,0 +52,0 @@ apaasAppInfo: apaasAppInfoData, |
@@ -37,4 +37,8 @@ /* eslint no-restricted-syntax:0 */ | ||
vi.mock('@apaas-ai/error-handler', () => ({ | ||
handleError: vi.fn(), | ||
})); | ||
describe('cache control', () => { | ||
let cacheControl: CacheControl = new CacheControl(defaultAppKey); | ||
let cacheControl: CacheControl = new CacheControl({ appKey: defaultAppKey }); | ||
@@ -67,3 +71,3 @@ let defaultFiles: CUIFile[] = [ | ||
}; | ||
cacheControl = new CacheControl(defaultAppKey); | ||
cacheControl = new CacheControl({ appKey: defaultAppKey }); | ||
}); | ||
@@ -70,0 +74,0 @@ |
@@ -6,2 +6,3 @@ /* | ||
*/ | ||
import { handleError } from '@apaas-ai/error-handler'; | ||
import { logger, normalizeError } from '@apaas-ai/logger-web'; | ||
@@ -21,2 +22,9 @@ import axios from 'axios'; | ||
interface CacheControlProps { | ||
appKey: string; | ||
channelType?: string; | ||
pathBasename?: string; | ||
resourceType?: string; | ||
} | ||
const RESOURCE_STORAGE_KEY = 'CUI_CACHE_RESOURCE'; | ||
@@ -49,7 +57,9 @@ const FILE_PREFIX_KEY = 'CUI_CACHE_FILE'; | ||
public pathBasename: string | undefined = ''; | ||
public resourceType: string | undefined = ''; | ||
constructor(appKey: string, channelType?: string, pathBasename?: string) { | ||
this.appKey = appKey; | ||
this.channelType = channelType; | ||
this.pathBasename = pathBasename; | ||
constructor(props: CacheControlProps) { | ||
this.appKey = props.appKey; | ||
this.channelType = props.channelType; | ||
this.pathBasename = props.pathBasename; | ||
this.resourceType = props.resourceType; | ||
} | ||
@@ -109,3 +119,3 @@ public async loadResource(): Promise<ResourceAndFile> { | ||
appKey: this.appKey, | ||
channelType: this.channelType as ChannelType, | ||
channelType: (this.resourceType as ChannelType) || (this.channelType as ChannelType), | ||
}, | ||
@@ -152,2 +162,6 @@ { | ||
} catch (e) { | ||
handleError(e, { | ||
team: 'oda', | ||
silent: 'yes. Because I has shown this error to user', | ||
}); | ||
if (retryTime < LOAD_FILE_RETRY_TIME) { | ||
@@ -184,3 +198,6 @@ return this.loadUrl(url, retryTime + 1); | ||
} catch (e) { | ||
// TODO: error report | ||
handleError(e, { | ||
team: 'oda', | ||
silent: 'yes. Because I has shown this error to user', | ||
}); | ||
} | ||
@@ -187,0 +204,0 @@ return resource; |
@@ -58,2 +58,8 @@ export enum CUILayoutMode { | ||
export interface ApaasAppInfo { | ||
tenantID?: number; | ||
namespace?: string; | ||
tenantType?: number; | ||
} | ||
export interface CUICommonConfig { | ||
@@ -67,2 +73,3 @@ baseURL: string; | ||
channelType?: string; | ||
resourceType?: string; | ||
channelContext?: Record<string, unknown>; | ||
@@ -75,2 +82,3 @@ errorDebugDisabled?: boolean; | ||
appName?: string; | ||
apaasAppInfo?: ApaasAppInfo; | ||
} | ||
@@ -106,4 +114,15 @@ | ||
export interface UpdateConfigProps { | ||
header?: CUIHeaderConfig; | ||
conversion?: CUIConversionConfig; | ||
editor?: CUIEditorConfig; | ||
common?: CUICommonConfig; | ||
} | ||
export interface ChatPanel { | ||
sendMessage(data: { content: string; channelContext: Record<string, unknown> }): Promise<void>; | ||
clear(): Promise<void>; | ||
clearAndStop(): Promise<void>; | ||
updateWelcomeMessage(): Promise<void>; | ||
updateConfig(config: UpdateConfigProps): Promise<void>; | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 2 instances in 1 package
3742599
47
101187
1
16