@siact/sime-x-vue 0.0.12 → 0.0.13
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 +12 -11
- package/dist/sime-x-vue.mjs.map +1 -1
- package/dist/sime-x-vue.umd.js +12 -11
- 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 +1 -0
- /package/dist/{sime.png → x.png} +0 -0
package/dist/sime-x-vue.mjs
CHANGED
|
@@ -773,7 +773,8 @@ 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;
|
|
@@ -784,6 +785,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
784
785
|
chatbotUrl: () => props.chatbotUrl,
|
|
785
786
|
appId: () => props.appId,
|
|
786
787
|
appToken: () => props.appToken,
|
|
788
|
+
agentId: () => props.agentId,
|
|
787
789
|
stopBroadcast: () => stopBroadcastRef.value(),
|
|
788
790
|
registerVoiceMethods: (methods) => {
|
|
789
791
|
if (methods.stopBroadcast) stopBroadcastRef.value = methods.stopBroadcast;
|
|
@@ -1769,9 +1771,9 @@ function useAgentInvoke(options) {
|
|
|
1769
1771
|
const commandDefinitions = buildCommandDefinitionMap(commands);
|
|
1770
1772
|
conversationHistory.value.length > 0 ? [...conversationHistory.value] : void 0;
|
|
1771
1773
|
try {
|
|
1772
|
-
const response = await fetch(options.endpoint
|
|
1774
|
+
const response = await fetch(options.endpoint, {
|
|
1773
1775
|
method: "POST",
|
|
1774
|
-
headers: { "Content-Type": "application/json" },
|
|
1776
|
+
headers: { "Content-Type": "application/json", Authorization: `Bearer ${options.appToken || ""}` },
|
|
1775
1777
|
body: JSON.stringify({
|
|
1776
1778
|
input: content,
|
|
1777
1779
|
projectId: options.projectId || "",
|
|
@@ -1948,9 +1950,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1948
1950
|
xSize: {},
|
|
1949
1951
|
xTheme: {},
|
|
1950
1952
|
wakeWords: {},
|
|
1953
|
+
wakeResponses: {},
|
|
1951
1954
|
modelPath: {},
|
|
1952
1955
|
projectId: {},
|
|
1953
|
-
invokeUrl: {},
|
|
1954
1956
|
voiceConfig: {},
|
|
1955
1957
|
bubbleSize: {},
|
|
1956
1958
|
bubbleDismissDelay: {}
|
|
@@ -1962,10 +1964,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1962
1964
|
if (props.voiceConfig) return props.voiceConfig;
|
|
1963
1965
|
return null;
|
|
1964
1966
|
};
|
|
1965
|
-
const
|
|
1966
|
-
return props.invokeUrl || "http://localhost:3001/agent/zyy55sw40nrl801056m0o/stream-invoke";
|
|
1967
|
-
});
|
|
1968
|
-
const wakeResponses = ["在呢"];
|
|
1967
|
+
const wakeResponses = computed(() => props.wakeResponses || ["在呢"]);
|
|
1969
1968
|
const tts = useTTS(getVoiceConfig);
|
|
1970
1969
|
const bubbleBridge = {
|
|
1971
1970
|
open: () => {
|
|
@@ -1975,8 +1974,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1975
1974
|
scrollToBottom: () => {
|
|
1976
1975
|
}
|
|
1977
1976
|
};
|
|
1977
|
+
const endpoint = `/sime/proxy/agent/${aiChatbotX.agentId()}/stream-invoke`;
|
|
1978
1978
|
const agent = useAgentInvoke({
|
|
1979
1979
|
endpoint,
|
|
1980
|
+
appToken: aiChatbotX.appToken(),
|
|
1980
1981
|
projectId: props.projectId,
|
|
1981
1982
|
aiChatbotX,
|
|
1982
1983
|
tts: {
|
|
@@ -2015,7 +2016,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2015
2016
|
onWake: () => {
|
|
2016
2017
|
interruptCurrentResponse();
|
|
2017
2018
|
tts.warmUpAudio();
|
|
2018
|
-
const text = wakeResponses[Math.floor(Math.random() * wakeResponses.length)];
|
|
2019
|
+
const text = wakeResponses.value[Math.floor(Math.random() * wakeResponses.value.length)];
|
|
2019
2020
|
tts.speak(text);
|
|
2020
2021
|
},
|
|
2021
2022
|
onTranscriptionDone: (text) => {
|
|
@@ -2121,7 +2122,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2121
2122
|
unref(transcriptionText) || unref(isInvoking) ? (openBlock(), createElementBlock("div", _hoisted_11, toDisplayString(unref(isInvoking) ? "正在思考中..." : unref(transcriptionText)), 1)) : createCommentVNode("", true),
|
|
2122
2123
|
createElementVNode("div", _hoisted_12, [
|
|
2123
2124
|
createElementVNode("img", {
|
|
2124
|
-
src: __props.xLogo ? __props.xLogo : "/
|
|
2125
|
+
src: __props.xLogo ? __props.xLogo : "/x.png",
|
|
2125
2126
|
alt: "voice assistant",
|
|
2126
2127
|
style: normalizeStyle({
|
|
2127
2128
|
width: `${__props.xSize?.width || 88}px`
|
|
@@ -2168,7 +2169,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2168
2169
|
}
|
|
2169
2170
|
});
|
|
2170
2171
|
|
|
2171
|
-
const voiceAssistant = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
2172
|
+
const voiceAssistant = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-a88f03ab"]]);
|
|
2172
2173
|
|
|
2173
2174
|
var clientCommandKey = /* @__PURE__ */ ((clientCommandKey2) => {
|
|
2174
2175
|
clientCommandKey2["SET_THEME"] = "SiMeAgent_setTheme";
|