feat: 字段的调整和问卷跳转的处理
This commit is contained in:
@@ -21,6 +21,7 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { getAccessToken } from "@/constant/token";
|
import { getAccessToken } from "@/constant/token";
|
||||||
import { defineProps } from "vue";
|
import { defineProps } from "vue";
|
||||||
|
import { navigateTo } from "../../router";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
toolCall: {
|
toolCall: {
|
||||||
@@ -31,11 +32,7 @@ const props = defineProps({
|
|||||||
|
|
||||||
const handleCall = () => {
|
const handleCall = () => {
|
||||||
const token = getAccessToken();
|
const token = getAccessToken();
|
||||||
const url = `${props.toolCall.componentName}?token=${token}`;
|
navigateTo(props.toolCall.data, { token: token });
|
||||||
console.log(url);
|
|
||||||
uni.navigateTo({
|
|
||||||
url: `/pages/webview/index?url=${encodeURIComponent(url)}`,
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ const mainPageDataModel = ref({});
|
|||||||
// 会话进行中标志
|
// 会话进行中标志
|
||||||
const isSessionActive = ref(false);
|
const isSessionActive = ref(false);
|
||||||
/// 指令
|
/// 指令
|
||||||
let commonType = "";
|
let messageCommonType = "";
|
||||||
|
|
||||||
// WebSocket 相关
|
// WebSocket 相关
|
||||||
let webSocketManager = null;
|
let webSocketManager = null;
|
||||||
@@ -238,7 +238,7 @@ const handleReplyText = (text) => {
|
|||||||
const handleReplyInstruct = async (item) => {
|
const handleReplyInstruct = async (item) => {
|
||||||
await checkToken();
|
await checkToken();
|
||||||
|
|
||||||
commonType = item.type;
|
messageCommonType = item.type;
|
||||||
// 重置消息状态,准备接收新的AI回复
|
// 重置消息状态,准备接收新的AI回复
|
||||||
resetMessageState();
|
resetMessageState();
|
||||||
sendMessage(item.title, true);
|
sendMessage(item.title, true);
|
||||||
@@ -734,7 +734,7 @@ const sendChat = async (message, isInstruct = false) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const messageType = isInstruct ? 1 : 0;
|
const messageType = isInstruct ? 1 : 0;
|
||||||
const messageContent = isInstruct ? commonType : message;
|
const messageContent = isInstruct ? messageCommonType : message;
|
||||||
// 生成 messageId 并保存到当前会话变量(stopRequest 可能使用)
|
// 生成 messageId 并保存到当前会话变量(stopRequest 可能使用)
|
||||||
currentSessionMessageId = IdUtils.generateMessageId();
|
currentSessionMessageId = IdUtils.generateMessageId();
|
||||||
|
|
||||||
|
|||||||
@@ -2,16 +2,9 @@
|
|||||||
<view class="container">
|
<view class="container">
|
||||||
<ModuleTitle :title="recommendTheme.themeName" />
|
<ModuleTitle :title="recommendTheme.themeName" />
|
||||||
<view class="container-scroll">
|
<view class="container-scroll">
|
||||||
<view
|
<view v-for="(item, index) in recommendTheme.recommendPostsList" :key="index">
|
||||||
v-for="(item, index) in recommendTheme.recommendPostsList"
|
|
||||||
:key="index"
|
|
||||||
>
|
|
||||||
<view class="mk-card-item" @click="sendReply(item)">
|
<view class="mk-card-item" @click="sendReply(item)">
|
||||||
<image
|
<image class="card-img" :src="item.coverPhoto" mode="widthFix"></image>
|
||||||
class="card-img"
|
|
||||||
:src="item.coverPhoto"
|
|
||||||
mode="widthFix"
|
|
||||||
></image>
|
|
||||||
<text class="card-text">{{ item.topic }}</text>
|
<text class="card-text">{{ item.topic }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -20,7 +13,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { SEND_MESSAGE_CONTENT_TEXT } from "@/constant/constant";
|
import { SEND_MESSAGE_CONTENT_TEXT, SEND_MESSAGE_COMMAND_TYPE } from "@/constant/constant";
|
||||||
import { defineProps } from "vue";
|
import { defineProps } from "vue";
|
||||||
import ModuleTitle from "@/components/ModuleTitle/index.vue";
|
import ModuleTitle from "@/components/ModuleTitle/index.vue";
|
||||||
|
|
||||||
@@ -32,7 +25,12 @@ const props = defineProps({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const sendReply = (item) => {
|
const sendReply = (item) => {
|
||||||
const topic = item.userInputContent || item.topic.replace(/^#/, "");
|
if (item.userInputContentType && item.userInputContentType === '1') {
|
||||||
|
const commonItem = { type: item.userInputContent, title: item.topic }
|
||||||
|
uni.$emit(SEND_MESSAGE_COMMAND_TYPE, commonItem);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const topic = item.topic.replace(/^#/, "");
|
||||||
uni.$emit(SEND_MESSAGE_CONTENT_TEXT, topic);
|
uni.$emit(SEND_MESSAGE_CONTENT_TEXT, topic);
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -3,29 +3,18 @@
|
|||||||
<ModuleTitle :title="recommendTheme.themeName" />
|
<ModuleTitle :title="recommendTheme.themeName" />
|
||||||
|
|
||||||
<view class="container-scroll font-size-0 scroll-x whitespace-nowrap">
|
<view class="container-scroll font-size-0 scroll-x whitespace-nowrap">
|
||||||
<view
|
<view class="card-item bg-white inline-block rounded-20 mr-8"
|
||||||
class="card-item bg-white inline-block rounded-20 mr-8"
|
v-for="(item, index) in recommendTheme.recommendPostsList" :key="index" @click="sendReply(item)">
|
||||||
v-for="(item, index) in recommendTheme.recommendPostsList"
|
|
||||||
:key="index"
|
|
||||||
@click="sendReply(item)"
|
|
||||||
>
|
|
||||||
<view class="m-4 relative">
|
<view class="m-4 relative">
|
||||||
<image
|
<image class="card-img rounded-16 relative z-10" :src="item.coverPhoto" mode="aspectFill" />
|
||||||
class="card-img rounded-16 relative z-10"
|
|
||||||
:src="item.coverPhoto"
|
|
||||||
mode="aspectFill"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<view class="shadow absolute rounded-16"></view>
|
<view class="shadow absolute rounded-16"></view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="card-text border-box">
|
<view class="card-text border-box">
|
||||||
<view class="color-171717 font-size-14 line-height-20 ellipsis-1">
|
<view class="font-size-11 color-99A0AE ellipsis-1">
|
||||||
{{ item.topic }}
|
{{ item.topic }}
|
||||||
</view>
|
</view>
|
||||||
<view class="font-size-11 color-99A0AE">
|
|
||||||
{{ item.userInputContent }}
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -34,7 +23,7 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { defineProps } from "vue";
|
import { defineProps } from "vue";
|
||||||
import { SEND_MESSAGE_CONTENT_TEXT } from "@/constant/constant";
|
import { SEND_MESSAGE_CONTENT_TEXT, SEND_MESSAGE_COMMAND_TYPE } from "@/constant/constant";
|
||||||
import ModuleTitle from "@/components/ModuleTitle/index.vue";
|
import ModuleTitle from "@/components/ModuleTitle/index.vue";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
@@ -45,7 +34,12 @@ const props = defineProps({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const sendReply = (item) => {
|
const sendReply = (item) => {
|
||||||
const topic = item.userInputContent || item.topic.replace(/^#/, "");
|
if (item.userInputContentType && item.userInputContentType === '1') {
|
||||||
|
const commonItem = { type: item.userInputContent, title: item.topic }
|
||||||
|
uni.$emit(SEND_MESSAGE_COMMAND_TYPE, commonItem);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const topic = item.topic.replace(/^#/, "");
|
||||||
uni.$emit(SEND_MESSAGE_CONTENT_TEXT, topic);
|
uni.$emit(SEND_MESSAGE_CONTENT_TEXT, topic);
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ export function navigateTo(url, args) {
|
|||||||
// 如果有额外参数,拼接到URL后面
|
// 如果有额外参数,拼接到URL后面
|
||||||
const paramString = objectToUrlParams(args);
|
const paramString = objectToUrlParams(args);
|
||||||
if (paramString) {
|
if (paramString) {
|
||||||
if (targetUrl.contains("?")) {
|
if (typeof targetUrl === "string" && targetUrl.includes("?")) {
|
||||||
targetUrl += "&";
|
targetUrl += "&";
|
||||||
} else {
|
} else {
|
||||||
targetUrl += "?";
|
targetUrl += "?";
|
||||||
|
|||||||
Reference in New Issue
Block a user