Skip to content

Commit

Permalink
js 添加浏览器埋点 (#562)
Browse files Browse the repository at this point in the history
Co-authored-by: dailin01 <dailin01@baidu.com>
  • Loading branch information
dl102306 and dailin01 authored May 29, 2024
1 parent 0636379 commit 30f069b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion javascript/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,14 @@ export function getIAMConfig(ak: string, sk: string, baseUrl: string): IAMConfig
* @returns 返回JSON格式的字符串
*/
export function getRequestBody(body: ReqBody, version: string): string {
const request_source
= (getCurrentEnvironment() === 'browser') ? `qianfan_fe_sdk_v${version}` : `qianfan_js_sdk_v${version}`;

const modifiedBody = {
...body,
extra_parameters: {
...body.extra_parameters,
request_source: `qianfan_js_sdk_v${version}`,
request_source,
},
};
return JSON.stringify(modifiedBody);
Expand Down

0 comments on commit 30f069b

Please sign in to comment.