@huyooo/ai-chat-frontend-vue 0.3.27 → 0.3.30
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/{ExtensionPartHost-Bkz200Lx.js → ExtensionPartHost-DRNTrMLl.js} +1 -1
- package/dist/composables/chat/useCapabilityConfig.d.ts +2 -2
- package/dist/composables/useChat.d.ts +1 -1
- package/dist/{index-Bs9VExG5.js → index-BOziByOM.js} +50 -15
- package/dist/index.js +1 -1
- package/package.json +3 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as VueRuntime from "vue";
|
|
2
2
|
import { defineComponent, inject, ref, computed, onMounted, watch, onBeforeUnmount, createElementBlock, openBlock, normalizeStyle, createCommentVNode, createElementVNode, createVNode, unref, toDisplayString } from "vue";
|
|
3
3
|
import { Icon } from "@iconify/vue";
|
|
4
|
-
import { D, A, b, _ as _export_sfc } from "./index-
|
|
4
|
+
import { D, A, b, _ as _export_sfc } from "./index-BOziByOM.js";
|
|
5
5
|
const e = `data-huyooo-extension-theme`, t = `
|
|
6
6
|
:host {
|
|
7
7
|
--sx-bg: var(--chat-bg, var(--huyooo-bg, #ffffff));
|
|
@@ -6,12 +6,12 @@ export declare function useCapabilityConfig(adapter: ChatAdapter): {
|
|
|
6
6
|
}, AutoRunConfig | {
|
|
7
7
|
mode?: import("@huyooo/ai-chat-core").AutoRunMode | undefined;
|
|
8
8
|
}>;
|
|
9
|
-
loadAutoRunConfig: () => Promise<void>;
|
|
9
|
+
loadAutoRunConfig: (force?: boolean) => Promise<void>;
|
|
10
10
|
saveAutoRunConfig: (config: AutoRunConfig) => Promise<void>;
|
|
11
11
|
enabledTools: import("vue").ComputedRef<string[] | undefined>;
|
|
12
12
|
capabilityExtensions: import("vue").ComputedRef<ChatCapabilityExtensionGroup[]>;
|
|
13
13
|
ensureCapabilitiesLoaded: () => Promise<void>;
|
|
14
|
-
loadCapabilitySelection: () => Promise<void>;
|
|
14
|
+
loadCapabilitySelection: (force?: boolean) => Promise<void>;
|
|
15
15
|
loadCapabilitySnapshot: () => Promise<void>;
|
|
16
16
|
loadCapabilities: (force?: boolean) => Promise<void>;
|
|
17
17
|
setToolsChatEnabled: (items: Array<{
|
|
@@ -336,7 +336,7 @@ export declare function useChat(options: UseChatOptions): {
|
|
|
336
336
|
}, import("@huyooo/ai-chat-core").AutoRunConfig | {
|
|
337
337
|
mode?: import("@huyooo/ai-chat-core").AutoRunMode | undefined;
|
|
338
338
|
}>;
|
|
339
|
-
loadAutoRunConfig: () => Promise<void>;
|
|
339
|
+
loadAutoRunConfig: (force?: boolean) => Promise<void>;
|
|
340
340
|
saveAutoRunConfig: (config: import("@huyooo/ai-chat-core").AutoRunConfig) => Promise<void>;
|
|
341
341
|
enabledTools: import("vue").ComputedRef<string[] | undefined>;
|
|
342
342
|
capabilityExtensions: import("vue").ComputedRef<import("@huyooo/ai-chat-types").ChatCapabilityExtensionGroup[]>;
|
|
@@ -734,15 +734,47 @@ function useCapabilityConfig(adapter) {
|
|
|
734
734
|
const capabilitySelectionCustomized = ref(false);
|
|
735
735
|
let capabilityInitialized = false;
|
|
736
736
|
let capabilityLoadPromise = null;
|
|
737
|
-
|
|
737
|
+
let settingsCache = null;
|
|
738
|
+
let settingsFetchPromise = null;
|
|
739
|
+
async function fetchSettings(force = false) {
|
|
740
|
+
if (!adapter.getAllSettings) {
|
|
741
|
+
return {};
|
|
742
|
+
}
|
|
743
|
+
if (force) {
|
|
744
|
+
settingsCache = null;
|
|
745
|
+
}
|
|
746
|
+
if (settingsCache) {
|
|
747
|
+
return settingsCache;
|
|
748
|
+
}
|
|
749
|
+
if (settingsFetchPromise) {
|
|
750
|
+
return settingsFetchPromise;
|
|
751
|
+
}
|
|
752
|
+
settingsFetchPromise = adapter.getAllSettings().then((settings) => {
|
|
753
|
+
settingsCache = settings;
|
|
754
|
+
return settings;
|
|
755
|
+
}).finally(() => {
|
|
756
|
+
settingsFetchPromise = null;
|
|
757
|
+
});
|
|
758
|
+
return settingsFetchPromise;
|
|
759
|
+
}
|
|
760
|
+
function applyAutoRunConfigFromSettings(settings) {
|
|
761
|
+
const configJson = settings.autoRunConfig;
|
|
762
|
+
if (!configJson) {
|
|
763
|
+
return;
|
|
764
|
+
}
|
|
765
|
+
const config = JSON.parse(configJson);
|
|
766
|
+
autoRunConfig.value = { ...DEFAULT_AUTO_RUN_CONFIG, ...config };
|
|
767
|
+
}
|
|
768
|
+
function applyCapabilitySelectionFromSettings(settings) {
|
|
769
|
+
const parsed = parseCapabilitySelection(settings[CAPABILITY_SELECTION_KEY]);
|
|
770
|
+
capabilitySelection.value = parsed.selection;
|
|
771
|
+
capabilitySelectionCustomized.value = parsed.customized;
|
|
772
|
+
}
|
|
773
|
+
async function loadAutoRunConfig(force = false) {
|
|
738
774
|
if (!adapter.getAllSettings) return;
|
|
739
775
|
try {
|
|
740
|
-
const settings = await
|
|
741
|
-
|
|
742
|
-
if (configJson) {
|
|
743
|
-
const config = JSON.parse(configJson);
|
|
744
|
-
autoRunConfig.value = { ...DEFAULT_AUTO_RUN_CONFIG, ...config };
|
|
745
|
-
}
|
|
776
|
+
const settings = await fetchSettings(force);
|
|
777
|
+
applyAutoRunConfigFromSettings(settings);
|
|
746
778
|
} catch (error) {
|
|
747
779
|
}
|
|
748
780
|
}
|
|
@@ -752,18 +784,21 @@ function useCapabilityConfig(adapter) {
|
|
|
752
784
|
const plainConfig = {
|
|
753
785
|
mode: config.mode
|
|
754
786
|
};
|
|
755
|
-
|
|
787
|
+
const serialized = JSON.stringify(plainConfig);
|
|
788
|
+
await adapter.setSetting("autoRunConfig", serialized);
|
|
789
|
+
autoRunConfig.value = { ...DEFAULT_AUTO_RUN_CONFIG, ...config };
|
|
790
|
+
if (settingsCache) {
|
|
791
|
+
settingsCache = { ...settingsCache, autoRunConfig: serialized };
|
|
792
|
+
}
|
|
756
793
|
} catch (error) {
|
|
757
794
|
throw error;
|
|
758
795
|
}
|
|
759
796
|
}
|
|
760
|
-
async function loadCapabilitySelection() {
|
|
797
|
+
async function loadCapabilitySelection(force = false) {
|
|
761
798
|
if (!adapter.getAllSettings) return;
|
|
762
799
|
try {
|
|
763
|
-
const settings = await
|
|
764
|
-
|
|
765
|
-
capabilitySelection.value = parsed.selection;
|
|
766
|
-
capabilitySelectionCustomized.value = parsed.customized;
|
|
800
|
+
const settings = await fetchSettings(force);
|
|
801
|
+
applyCapabilitySelectionFromSettings(settings);
|
|
767
802
|
} catch (error) {
|
|
768
803
|
}
|
|
769
804
|
}
|
|
@@ -860,7 +895,7 @@ function useCapabilityConfig(adapter) {
|
|
|
860
895
|
}
|
|
861
896
|
const currentLoad = (async () => {
|
|
862
897
|
await Promise.all([
|
|
863
|
-
loadCapabilitySelection(),
|
|
898
|
+
loadCapabilitySelection(force),
|
|
864
899
|
loadCapabilitySnapshot()
|
|
865
900
|
]);
|
|
866
901
|
capabilityInitialized = true;
|
|
@@ -9380,7 +9415,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
9380
9415
|
},
|
|
9381
9416
|
setup(__props) {
|
|
9382
9417
|
function loadExtensionPartHostComponent() {
|
|
9383
|
-
return import("./ExtensionPartHost-
|
|
9418
|
+
return import("./ExtensionPartHost-DRNTrMLl.js");
|
|
9384
9419
|
}
|
|
9385
9420
|
const ExtensionPartHost = defineAsyncComponent(loadExtensionPartHostComponent);
|
|
9386
9421
|
const loadPartCode = inject("loadPartCode");
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@huyooo/ai-chat-frontend-vue",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.30",
|
|
4
4
|
"description": "AI Chat Frontend - Vue components with adapter pattern",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"vue": "^3.4.0"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@huyooo/ai-chat-shared": "^0.3.
|
|
38
|
-
"@huyooo/ai-chat-types": "^0.3.
|
|
37
|
+
"@huyooo/ai-chat-shared": "^0.3.30",
|
|
38
|
+
"@huyooo/ai-chat-types": "^0.3.30",
|
|
39
39
|
"dompurify": "^3.2.0",
|
|
40
40
|
"marked": "^12.0.0",
|
|
41
41
|
"vscode-uri": "^3.1.0"
|