@cozeloop/config-provider 0.0.11 → 0.0.12-beta-1770714934822

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/dist/index.mjs CHANGED
@@ -1,3 +1,7 @@
1
+
2
+
3
+ function _define_property_v1(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _object_spread_v1(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};var ownKeys=Object.keys(source);if(typeof Object.getOwnPropertySymbols==="function"){ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}))}ownKeys.forEach(function(key){_define_property_v1(target,key,source[key])})}return target}(function(){if(typeof window==="undefined"){return}window.teaCall=function(event,params,envConfig){try{if(envConfig.isDev){return}var urlVa=envConfig.isOverSea?"https://maliva-mcs.byteoversea.com/v1/json":"https://mcs.zijieapi.com/v1/json";var appIdVa=envConfig.isOverSea?595451:566307;var _window_location,_window,_window_location1,_window1,_window_location2,_window2;fetch(urlVa,{method:"POST",body:JSON.stringify({header:{app_id:appIdVa,referrer:(_window=window)===null||_window===void 0?void 0:(_window_location=_window.location)===null||_window_location===void 0?void 0:_window_location.href,referrer_host:(_window1=window)===null||_window1===void 0?void 0:(_window_location1=_window1.location)===null||_window_location1===void 0?void 0:_window_location1.host,custom:{domain:(_window2=window)===null||_window2===void 0?void 0:(_window_location2=_window2.location)===null||_window_location2===void 0?void 0:_window_location2.host,url:window.location.href,page:window.location.pathname.replace(/d+/g,":id"),space_id:params===null||params===void 0?void 0:params.spaceID,bizId:params===null||params===void 0?void 0:params.bizId}},events:[{event:event,params:JSON.stringify(_object_spread_v1({},params))}],user:{user_unique_id:(params===null||params===void 0?void 0:params.userId)||Date.now().toString()},caller:"flow.devops.trace.sdk"}),headers:{"Content-Type":"application/json"}})}catch(error){console.error("Failed to execute teaCall:",error)}}})();
4
+
1
5
  import { jsx } from "react/jsx-runtime";
2
6
  import { createContext, useContext, useEffect, useLayoutEffect, useRef, useState } from "react";
3
7
  import { I18n, initIntl } from "@cozeloop/i18n";
@@ -76,12 +80,13 @@ function _object_spread_props(target, source) {
76
80
  return target;
77
81
  }
78
82
  const useSDKReport = ()=>{
79
- const { bizId, isDev = false, spaceID, isOverSea = false } = CozeLoopProvider.useConfig();
83
+ const { bizId, isDev = false, spaceID, isOverSea = false, userInfo } = CozeLoopProvider.useConfig();
80
84
  return (envName, params)=>{
81
85
  if (isDev || !window.teaCall || !spaceID) return;
82
86
  window.teaCall(envName, _object_spread_props(_object_spread({}, null != params ? params : {}), {
83
87
  workspace_id: spaceID,
84
- biz_id: bizId
88
+ biz_id: bizId,
89
+ userId: null == userInfo ? void 0 : userInfo.user_id
85
90
  }), {
86
91
  isOverSea,
87
92
  isDev
@@ -133,7 +138,7 @@ function PageLoading() {
133
138
  });
134
139
  }
135
140
  function CozeLoopProviderImpl(props) {
136
- const { children, defaultLanguage, locale: resources, sendEvent, bizId, region, language, isDev, theme, trace, evaluateConfig, getPopupContainer, providerWrapStyle, space, userInfo, appID } = props;
141
+ const { children, defaultLanguage, locale: resources, sendEvent, bizId, region, language, isDev, theme, trace, evaluateConfig, getPopupContainer, providerWrapStyle, space, spaceID, userInfo, appID } = props;
137
142
  const isInitialized = useRef(false);
138
143
  const [initialized, setInitialized] = useState(false);
139
144
  useLayoutEffect(()=>{
@@ -186,6 +191,7 @@ function CozeLoopProviderImpl(props) {
186
191
  isDev,
187
192
  theme,
188
193
  trace,
194
+ spaceID: null != spaceID ? spaceID : null == space ? void 0 : space.id,
189
195
  evaluateConfig,
190
196
  space,
191
197
  userInfo,
@@ -1,3 +1,4 @@
1
+ import { type ComponentType } from 'react';
1
2
  import { type EvaluatorType } from '@cozeloop/api-schema/evaluation';
2
3
  import { type TraceConfig } from '../observation';
3
4
  import { type ModelConfig } from '../model';
@@ -115,4 +116,9 @@ export interface EvaluateConfig<P extends EvaluatePageKey = EvaluatePageKey> {
115
116
  evalSetConfig?: EvalSetConfig;
116
117
  /** 模型配置 */
117
118
  modelConfig?: ModelConfig;
119
+ vchartColorConfig?: string[];
120
+ customRenderNode?: {
121
+ dataEmptyNode?: ComponentType;
122
+ searchEmptyNode?: ComponentType;
123
+ };
118
124
  }
@@ -1,4 +1,5 @@
1
1
  import { type ComponentType } from 'react';
2
+ import { type Model } from '@cozeloop/api-schema/llm-manage';
2
3
  import { type ModelConfig as ModelConfigSchema } from '@cozeloop/api-schema/evaluation';
3
4
  import { type PopoverProps } from '@coze-arch/coze-design';
4
5
  interface ModelFamily {
@@ -17,12 +18,33 @@ interface ModelInfo {
17
18
  description?: string;
18
19
  disabled?: boolean;
19
20
  }
21
+ /**
22
+ * TODO: 兼容兼容历史组件,后续移除
23
+ */
24
+ declare enum Scenario {
25
+ scenario_default = "default",
26
+ scenario_prompt_debug = "prompt_debug",
27
+ scenario_prompt_as_a_service = "prompt_as_a_service",
28
+ scenario_eval_target = "eval_target",
29
+ scenario_evaluator = "evaluator",
30
+ scenario_data_synthesis = "data_synthesis"
31
+ }
20
32
  interface ModelPickerBasicProps {
21
33
  spaceId: string;
22
34
  value?: ModelConfigSchema;
23
35
  onChange?: (value: ModelConfigSchema | undefined) => void;
24
36
  disabled?: boolean;
25
37
  autoSelectFirst?: boolean;
38
+ /**
39
+ * TODO: 兼容兼容历史组件相关 props,后续移除
40
+ */
41
+ legacyProps?: {
42
+ /** 使用场景 */
43
+ scenario?: Scenario;
44
+ /** 刷新模型数据 */
45
+ refreshModelKey?: number;
46
+ onModelChange?: (value?: Model) => void;
47
+ };
26
48
  }
27
49
  interface ModelPickerPopoverBasicProps extends ModelPickerBasicProps {
28
50
  popoverProps?: Omit<PopoverProps, 'content' | 'trigger' | 'visible'>;
package/package.json CHANGED
@@ -1,19 +1,19 @@
1
1
  {
2
2
  "name": "@cozeloop/config-provider",
3
- "version": "0.0.11",
3
+ "version": "0.0.12-beta-1770714934822",
4
4
  "description": "Config Provider for CozeLoop",
5
5
  "author": "qihai@bytedance.com",
6
6
  "main": "./dist/index.mjs",
7
7
  "scripts": {
8
8
  "build": "exit 0",
9
- "build:sdk": "rush pack-sdk --package @cozeloop/config-provider --config ./rslib.config.js --skip-tea-report",
9
+ "build:sdk": "rush pack-sdk --package @cozeloop/config-provider --config ./rslib.config.js --skip-tea-report false",
10
10
  "lint": "eslint ./ --cache",
11
11
  "test": "NODE_OPTIONS='--max_old_space_size=2048' NODE_ENV=test vitest --run --passWithNoTests",
12
12
  "test:cov": "npm run test -- --coverage"
13
13
  },
14
14
  "dependencies": {
15
- "@coze-arch/coze-design": "0.0.7-alpha.985c0d",
16
- "@cozeloop/i18n": "0.0.3",
15
+ "@coze-arch/coze-design": "0.0.7-alpha.5f0418",
16
+ "@cozeloop/i18n": "0.0.12-beta-1770714934822",
17
17
  "eventemitter3": "^5.0.1",
18
18
  "intl-messageformat": "^10.7.16",
19
19
  "qs": "^6.11.2"
@@ -25,7 +25,7 @@
25
25
  "publishRegistries": [
26
26
  "npm"
27
27
  ],
28
- "types": "./dist/index.d.ts",
28
+ "types": "./dist/types/index.d.ts",
29
29
  "files": [
30
30
  "dist",
31
31
  "README.md",