@zero-library/chat-copilot 1.0.0 → 1.0.1
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.cjs.js +27 -5
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.mts +18 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.esm.js +27 -5
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -3105,6 +3105,9 @@ var BubbleListItems_default = ({
|
|
|
3105
3105
|
|
|
3106
3106
|
// src/services/index.ts
|
|
3107
3107
|
var createChatService = (request, config) => {
|
|
3108
|
+
const fetchModelList = () => {
|
|
3109
|
+
return request.get(`/providers/models/type/llm`);
|
|
3110
|
+
};
|
|
3108
3111
|
const fetchAgentInfo = (agentId) => {
|
|
3109
3112
|
return request.get(`/agents/${agentId}`);
|
|
3110
3113
|
};
|
|
@@ -3148,6 +3151,7 @@ var createChatService = (request, config) => {
|
|
|
3148
3151
|
return `${config?.baseURL}/agents/${agentId}/${conversationId}/files/download?path=${encodeURIComponent(path)}&${TOKEN_KEY}=${tokenManager.get()}`;
|
|
3149
3152
|
};
|
|
3150
3153
|
return {
|
|
3154
|
+
fetchModelList,
|
|
3151
3155
|
fetchAgentInfo,
|
|
3152
3156
|
createConversationId,
|
|
3153
3157
|
fetchConversations,
|
|
@@ -3165,8 +3169,8 @@ var createChatService = (request, config) => {
|
|
|
3165
3169
|
|
|
3166
3170
|
// src/stores/index.ts
|
|
3167
3171
|
var defaultLayout = {
|
|
3168
|
-
globalHeader:
|
|
3169
|
-
conversationList:
|
|
3172
|
+
globalHeader: false,
|
|
3173
|
+
conversationList: false,
|
|
3170
3174
|
preview: true,
|
|
3171
3175
|
chatHeader: true,
|
|
3172
3176
|
messageList: true,
|
|
@@ -3183,6 +3187,8 @@ function createChatStore() {
|
|
|
3183
3187
|
/** HTTP请求实例 */
|
|
3184
3188
|
request: {}
|
|
3185
3189
|
},
|
|
3190
|
+
models: [],
|
|
3191
|
+
/** 钩子函数 */
|
|
3186
3192
|
hooks: {},
|
|
3187
3193
|
layout: {},
|
|
3188
3194
|
loading: false,
|
|
@@ -3199,8 +3205,19 @@ function createChatStore() {
|
|
|
3199
3205
|
}
|
|
3200
3206
|
}
|
|
3201
3207
|
});
|
|
3208
|
+
const getModels = async () => {
|
|
3209
|
+
const { data } = await config.services.request.fetchModelList();
|
|
3210
|
+
config.models = data;
|
|
3211
|
+
if (data?.length) {
|
|
3212
|
+
setAgentModel({
|
|
3213
|
+
providerName: data[0].providerName,
|
|
3214
|
+
modelName: data[0].models[0].modelName,
|
|
3215
|
+
reasoning: true
|
|
3216
|
+
});
|
|
3217
|
+
}
|
|
3218
|
+
};
|
|
3202
3219
|
const setServices = ({ http, websocket } = {}) => {
|
|
3203
|
-
const httpConfig = { baseURL: "/luya/
|
|
3220
|
+
const httpConfig = { baseURL: "/luya/v1", headers: { [TOKEN_KEY]: tokenManager.get() }, ...http?.config };
|
|
3204
3221
|
const request = common.createRequest(httpConfig);
|
|
3205
3222
|
if (config.hooks?.onRequestInterceptor) {
|
|
3206
3223
|
request.instance.interceptors.request.use(...config.hooks.onRequestInterceptor);
|
|
@@ -3265,8 +3282,8 @@ function createChatStore() {
|
|
|
3265
3282
|
/** 当前智能体 */
|
|
3266
3283
|
agentInfo: {},
|
|
3267
3284
|
model: {
|
|
3268
|
-
modelName: "
|
|
3269
|
-
providerName: "
|
|
3285
|
+
modelName: "",
|
|
3286
|
+
providerName: "",
|
|
3270
3287
|
reasoning: true
|
|
3271
3288
|
},
|
|
3272
3289
|
/** 智能体加载状态 */
|
|
@@ -3984,6 +4001,8 @@ function createChatStore() {
|
|
|
3984
4001
|
conversation.messages[conversation.active.id].loading = false;
|
|
3985
4002
|
};
|
|
3986
4003
|
return {
|
|
4004
|
+
/** 获取模型列表 */
|
|
4005
|
+
getModels,
|
|
3987
4006
|
/** 全局配置对象 */
|
|
3988
4007
|
config,
|
|
3989
4008
|
/** 设置服务配置 */
|
|
@@ -4786,6 +4805,9 @@ var layouts_default = React9.forwardRef(({ theme: theme4, params, hooks, layout,
|
|
|
4786
4805
|
common.useDeepEffect(() => {
|
|
4787
4806
|
chatStore.setServices(services);
|
|
4788
4807
|
}, [services]);
|
|
4808
|
+
React9.useEffect(() => {
|
|
4809
|
+
chatStore.getModels();
|
|
4810
|
+
}, []);
|
|
4789
4811
|
common.useDeepEffect(() => {
|
|
4790
4812
|
if (agentState.agentInfo.id && common.isObject(config.agent?.spec)) {
|
|
4791
4813
|
chatStore.setAgent({ ...agentState.agentInfo, spec: config.agent.spec || {} });
|