@siact/sime-x-vue 0.0.12 → 0.0.14
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/sime-x-vue.mjs +23 -12
- package/dist/sime-x-vue.mjs.map +1 -1
- package/dist/sime-x-vue.umd.js +23 -12
- package/dist/sime-x-vue.umd.js.map +1 -1
- package/dist/style.css +60 -60
- package/package.json +1 -1
- package/types/components/sime-provider.vue.d.ts +2 -0
- package/types/components/voice-assistant.vue.d.ts +1 -1
- package/types/composables/use-agent-invoke.d.ts +7 -7
- package/types/types.d.ts +5 -0
- /package/dist/{sime.png → x.png} +0 -0
package/dist/sime-x-vue.mjs
CHANGED
|
@@ -773,20 +773,30 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
773
773
|
debug: { type: Boolean },
|
|
774
774
|
chatbotUrl: {},
|
|
775
775
|
appId: {},
|
|
776
|
-
appToken: {}
|
|
776
|
+
appToken: {},
|
|
777
|
+
agentId: {}
|
|
777
778
|
},
|
|
778
779
|
setup(__props) {
|
|
779
780
|
const props = __props;
|
|
780
781
|
const commandManager = shallowRef(new CommandManager({ debug: props.debug ?? false }));
|
|
782
|
+
const startListeningRef = shallowRef(async () => {
|
|
783
|
+
});
|
|
784
|
+
const stopListeningRef = shallowRef(async () => {
|
|
785
|
+
});
|
|
781
786
|
const stopBroadcastRef = shallowRef(async () => {
|
|
782
787
|
});
|
|
783
788
|
provide(AiChatbotXKey, {
|
|
784
789
|
chatbotUrl: () => props.chatbotUrl,
|
|
785
790
|
appId: () => props.appId,
|
|
786
791
|
appToken: () => props.appToken,
|
|
792
|
+
agentId: () => props.agentId,
|
|
793
|
+
startListening: () => startListeningRef.value(),
|
|
794
|
+
stopListening: () => stopListeningRef.value(),
|
|
787
795
|
stopBroadcast: () => stopBroadcastRef.value(),
|
|
788
796
|
registerVoiceMethods: (methods) => {
|
|
789
797
|
if (methods.stopBroadcast) stopBroadcastRef.value = methods.stopBroadcast;
|
|
798
|
+
if (methods.start) startListeningRef.value = methods.start;
|
|
799
|
+
if (methods.stop) stopListeningRef.value = methods.stop;
|
|
790
800
|
},
|
|
791
801
|
getCommads: async () => commandManager.value.getCommands(),
|
|
792
802
|
registerCommand: (cmd) => {
|
|
@@ -1769,9 +1779,9 @@ function useAgentInvoke(options) {
|
|
|
1769
1779
|
const commandDefinitions = buildCommandDefinitionMap(commands);
|
|
1770
1780
|
conversationHistory.value.length > 0 ? [...conversationHistory.value] : void 0;
|
|
1771
1781
|
try {
|
|
1772
|
-
const response = await fetch(options.endpoint
|
|
1782
|
+
const response = await fetch(options.endpoint, {
|
|
1773
1783
|
method: "POST",
|
|
1774
|
-
headers: { "Content-Type": "application/json" },
|
|
1784
|
+
headers: { "Content-Type": "application/json", Authorization: `Bearer ${options.appToken || ""}` },
|
|
1775
1785
|
body: JSON.stringify({
|
|
1776
1786
|
input: content,
|
|
1777
1787
|
projectId: options.projectId || "",
|
|
@@ -1948,9 +1958,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1948
1958
|
xSize: {},
|
|
1949
1959
|
xTheme: {},
|
|
1950
1960
|
wakeWords: {},
|
|
1961
|
+
wakeResponses: {},
|
|
1951
1962
|
modelPath: {},
|
|
1952
1963
|
projectId: {},
|
|
1953
|
-
invokeUrl: {},
|
|
1954
1964
|
voiceConfig: {},
|
|
1955
1965
|
bubbleSize: {},
|
|
1956
1966
|
bubbleDismissDelay: {}
|
|
@@ -1962,10 +1972,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1962
1972
|
if (props.voiceConfig) return props.voiceConfig;
|
|
1963
1973
|
return null;
|
|
1964
1974
|
};
|
|
1965
|
-
const
|
|
1966
|
-
return props.invokeUrl || "http://localhost:3001/agent/zyy55sw40nrl801056m0o/stream-invoke";
|
|
1967
|
-
});
|
|
1968
|
-
const wakeResponses = ["在呢"];
|
|
1975
|
+
const wakeResponses = computed(() => props.wakeResponses || ["在呢"]);
|
|
1969
1976
|
const tts = useTTS(getVoiceConfig);
|
|
1970
1977
|
const bubbleBridge = {
|
|
1971
1978
|
open: () => {
|
|
@@ -1975,8 +1982,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1975
1982
|
scrollToBottom: () => {
|
|
1976
1983
|
}
|
|
1977
1984
|
};
|
|
1985
|
+
const endpoint = `/sime/proxy/agent/${aiChatbotX.agentId()}/stream-invoke`;
|
|
1978
1986
|
const agent = useAgentInvoke({
|
|
1979
1987
|
endpoint,
|
|
1988
|
+
appToken: aiChatbotX.appToken(),
|
|
1980
1989
|
projectId: props.projectId,
|
|
1981
1990
|
aiChatbotX,
|
|
1982
1991
|
tts: {
|
|
@@ -2015,7 +2024,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2015
2024
|
onWake: () => {
|
|
2016
2025
|
interruptCurrentResponse();
|
|
2017
2026
|
tts.warmUpAudio();
|
|
2018
|
-
const text = wakeResponses[Math.floor(Math.random() * wakeResponses.length)];
|
|
2027
|
+
const text = wakeResponses.value[Math.floor(Math.random() * wakeResponses.value.length)];
|
|
2019
2028
|
tts.speak(text);
|
|
2020
2029
|
},
|
|
2021
2030
|
onTranscriptionDone: (text) => {
|
|
@@ -2029,7 +2038,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2029
2038
|
const { voiceStatus, transcriptionText, wakeAnimating, isTranscribing } = voice;
|
|
2030
2039
|
const { isInvoking, currentTextContent, currentToolParts, executingTools, hasAnyContent, toolDisplayName } = agent;
|
|
2031
2040
|
aiChatbotX?.registerVoiceMethods({
|
|
2032
|
-
stopBroadcast: async () => interruptCurrentResponse()
|
|
2041
|
+
stopBroadcast: async () => interruptCurrentResponse(),
|
|
2042
|
+
start: () => toggleVoiceMode(true),
|
|
2043
|
+
stop: () => toggleVoiceMode(false)
|
|
2033
2044
|
});
|
|
2034
2045
|
onBeforeUnmount(async () => {
|
|
2035
2046
|
bubble.destroy();
|
|
@@ -2121,7 +2132,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2121
2132
|
unref(transcriptionText) || unref(isInvoking) ? (openBlock(), createElementBlock("div", _hoisted_11, toDisplayString(unref(isInvoking) ? "正在思考中..." : unref(transcriptionText)), 1)) : createCommentVNode("", true),
|
|
2122
2133
|
createElementVNode("div", _hoisted_12, [
|
|
2123
2134
|
createElementVNode("img", {
|
|
2124
|
-
src: __props.xLogo ? __props.xLogo : "/
|
|
2135
|
+
src: __props.xLogo ? __props.xLogo : "/x.png",
|
|
2125
2136
|
alt: "voice assistant",
|
|
2126
2137
|
style: normalizeStyle({
|
|
2127
2138
|
width: `${__props.xSize?.width || 88}px`
|
|
@@ -2168,7 +2179,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2168
2179
|
}
|
|
2169
2180
|
});
|
|
2170
2181
|
|
|
2171
|
-
const voiceAssistant = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
2182
|
+
const voiceAssistant = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-76f6b7ef"]]);
|
|
2172
2183
|
|
|
2173
2184
|
var clientCommandKey = /* @__PURE__ */ ((clientCommandKey2) => {
|
|
2174
2185
|
clientCommandKey2["SET_THEME"] = "SiMeAgent_setTheme";
|