@tencentcloud/ai-desk-customer-vue 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/CustomerServiceChat/message-list/message-elements/message-text.vue +9 -0
- package/components/CustomerServiceChat/message-list/style/h5.scss +1 -0
- package/components/CustomerServiceChat/style/h5.scss +1 -2
- package/components/CustomerServiceChat/style/uni.scss +1 -2
- package/package.json +1 -1
- package/server.ts +9 -9
- package/logger/index.ts +0 -12
- package/logger/main.ts +0 -120
|
@@ -84,6 +84,15 @@ watchEffect(() => {
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
.text {
|
|
87
|
+
white-space: pre-wrap;
|
|
88
|
+
font-size: 14px;
|
|
89
|
+
text-size-adjust: none;
|
|
90
|
+
font-family: PingFangSC-Regular;
|
|
91
|
+
overflow-wrap: break-word;
|
|
92
|
+
word-break: break-all;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.text:lang(en) {
|
|
87
96
|
white-space: pre-wrap;
|
|
88
97
|
font-size: 14px;
|
|
89
98
|
text-size-adjust: none;
|
package/package.json
CHANGED
package/server.ts
CHANGED
|
@@ -44,15 +44,15 @@ export default class TUICustomerServer {
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
static loginCustomerUIKit
|
|
48
|
-
|
|
49
|
-
SDKAppID
|
|
50
|
-
userID
|
|
51
|
-
userSig
|
|
47
|
+
static loginCustomerUIKit(SDKAppID:number, userID:string, userSig:string) {
|
|
48
|
+
TUIChatEngine.login({
|
|
49
|
+
SDKAppID,
|
|
50
|
+
userID,
|
|
51
|
+
userSig,
|
|
52
52
|
useUploadPlugin: true,
|
|
53
53
|
}).then(() => {
|
|
54
54
|
console.log("login success");
|
|
55
|
-
|
|
55
|
+
TUIConversationService.switchConversation('C2C@customer_service_account');
|
|
56
56
|
})
|
|
57
57
|
.catch((error) => {
|
|
58
58
|
console.log(error);
|
|
@@ -62,14 +62,14 @@ export default class TUICustomerServer {
|
|
|
62
62
|
/**
|
|
63
63
|
* init
|
|
64
64
|
*/
|
|
65
|
-
public static init(
|
|
65
|
+
public static init(SDKAppID:number, userID:string, userSig:string) {
|
|
66
66
|
// Backward compatibility, the new version executes the init operation by default in index.ts
|
|
67
67
|
if (TUICustomerServer.isInitialized) {
|
|
68
68
|
return;
|
|
69
69
|
}
|
|
70
70
|
TUICustomerServer.isInitialized = true;
|
|
71
71
|
// Execute call server when native plugin TUICallKit exists
|
|
72
|
-
this.loginCustomerUIKit(
|
|
72
|
+
this.loginCustomerUIKit(SDKAppID, userID, userSig);
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
// Set customer service number
|
|
@@ -117,7 +117,7 @@ export default class TUICustomerServer {
|
|
|
117
117
|
if (this.isCustomerConversation(params.conversationID)) {
|
|
118
118
|
TUIChatService.sendCustomMessage({
|
|
119
119
|
to: params.conversationID.slice(3),
|
|
120
|
-
conversationType:
|
|
120
|
+
conversationType: TUIChatEngine.TYPES.CONV_C2C,
|
|
121
121
|
payload: {
|
|
122
122
|
data: JSON.stringify({src: '7', customerServicePlugin: 0}),
|
|
123
123
|
},
|
package/logger/index.ts
DELETED
package/logger/main.ts
DELETED
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import * as logsAPI from '@opentelemetry/api-logs';
|
|
2
|
-
import { OTLPLogExporter } from '@opentelemetry/exporter-logs-otlp-http';
|
|
3
|
-
import { LoggerProvider, BatchLogRecordProcessor } from '@opentelemetry/sdk-logs';
|
|
4
|
-
import { Resource } from '@opentelemetry/resources';
|
|
5
|
-
type LogBody =
|
|
6
|
-
| string
|
|
7
|
-
| {
|
|
8
|
-
msg: string;
|
|
9
|
-
attributes?: logsAPI.LogAttributes;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const getLogBody = (args: LogBody, defaultAttributes: logsAPI.LogAttributes) => ({
|
|
13
|
-
body: typeof args === 'string' ? args : args.msg,
|
|
14
|
-
attributes:
|
|
15
|
-
typeof args === 'string'
|
|
16
|
-
? defaultAttributes
|
|
17
|
-
: {
|
|
18
|
-
...defaultAttributes,
|
|
19
|
-
...args.attributes,
|
|
20
|
-
},
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
export default class Logger {
|
|
24
|
-
logger: logsAPI.Logger;
|
|
25
|
-
attributes: logsAPI.LogAttributes;
|
|
26
|
-
logLevel: logsAPI.SeverityNumber;
|
|
27
|
-
name: string;
|
|
28
|
-
constructor({
|
|
29
|
-
name,
|
|
30
|
-
id,
|
|
31
|
-
url,
|
|
32
|
-
version = 'latest',
|
|
33
|
-
attributes,
|
|
34
|
-
logLevel = logsAPI.SeverityNumber.ERROR2,
|
|
35
|
-
}: {
|
|
36
|
-
name: string;
|
|
37
|
-
id: string;
|
|
38
|
-
url: URL | string;
|
|
39
|
-
version?: string;
|
|
40
|
-
attributes: logsAPI.LogAttributes;
|
|
41
|
-
logLevel?: logsAPI.SeverityNumber;
|
|
42
|
-
}) {
|
|
43
|
-
this.name = name;
|
|
44
|
-
this.logLevel = logLevel;
|
|
45
|
-
const loggerProvider = new LoggerProvider({
|
|
46
|
-
resource: new Resource({
|
|
47
|
-
'service.name': name,
|
|
48
|
-
'tps.tenant.id': id,
|
|
49
|
-
}),
|
|
50
|
-
});
|
|
51
|
-
loggerProvider.addLogRecordProcessor(
|
|
52
|
-
new BatchLogRecordProcessor(
|
|
53
|
-
new OTLPLogExporter({
|
|
54
|
-
url: url.toString(),
|
|
55
|
-
headers: {
|
|
56
|
-
'X-Tps-TenantID': id,
|
|
57
|
-
},
|
|
58
|
-
}),
|
|
59
|
-
),
|
|
60
|
-
);
|
|
61
|
-
const logger = loggerProvider.getLogger(name, version);
|
|
62
|
-
this.attributes = attributes;
|
|
63
|
-
this.logger = logger;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
debug = (args: LogBody) => {
|
|
67
|
-
if (this.logLevel <= logsAPI.SeverityNumber.DEBUG) {
|
|
68
|
-
console.debug(`[${this.name}]`, args);
|
|
69
|
-
}
|
|
70
|
-
this.logger.emit({
|
|
71
|
-
severityNumber: logsAPI.SeverityNumber.DEBUG,
|
|
72
|
-
severityText: 'debug',
|
|
73
|
-
...getLogBody(args, this.attributes),
|
|
74
|
-
});
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
info(args: LogBody) {
|
|
78
|
-
if (this.logLevel <= logsAPI.SeverityNumber.INFO) {
|
|
79
|
-
console.info(`[${this.name}]`, args);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
return this.logger.emit({
|
|
83
|
-
severityNumber: logsAPI.SeverityNumber.INFO,
|
|
84
|
-
severityText: 'info',
|
|
85
|
-
...getLogBody(args, this.attributes),
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
warn = (args: LogBody) => {
|
|
90
|
-
if (this.logLevel <= logsAPI.SeverityNumber.WARN) {
|
|
91
|
-
console.warn(`[${this.name}]`, args);
|
|
92
|
-
}
|
|
93
|
-
this.logger.emit({
|
|
94
|
-
severityNumber: logsAPI.SeverityNumber.WARN,
|
|
95
|
-
severityText: 'warn',
|
|
96
|
-
...getLogBody(args, this.attributes),
|
|
97
|
-
});
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
error = (args: LogBody) => {
|
|
101
|
-
if (this.logLevel <= logsAPI.SeverityNumber.ERROR) {
|
|
102
|
-
console.error(`[${this.name}]`, args);
|
|
103
|
-
}
|
|
104
|
-
this.logger.emit({
|
|
105
|
-
severityNumber: logsAPI.SeverityNumber.ERROR,
|
|
106
|
-
severityText: 'error',
|
|
107
|
-
...getLogBody(args, this.attributes),
|
|
108
|
-
});
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
setAttribute = (key: string, value: string | number) => {
|
|
112
|
-
Object.assign(this.attributes, {
|
|
113
|
-
[key]: value,
|
|
114
|
-
});
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
setAttributes = (attributes: logsAPI.LogAttributes) => {
|
|
118
|
-
Object.assign(this.attributes, attributes);
|
|
119
|
-
};
|
|
120
|
-
}
|