提交 09e34f76 authored 作者: coderBryanFu's avatar coderBryanFu

update

上级 486b8d7c
......@@ -558,7 +558,106 @@ function formatDateTime(isoString) {
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
}
const chat = async question => {
const handleBillChat = async question => {
// 添加用户消息
addMessage("user", question);
const params = {
model: "neko-checklist-agent",
// messages: [
// {
// role: "user",
// content: "2024年12月5日当期实体清单的主要制裁对象、制裁原因是?"
// }
// ]
messages: messages.value.map(item => {
return {
role: item.type === "ai" ? "assistant" : "user",
content: item.content
};
})
};
// 添加空的 AI 消息用于流式更新
addMessage("ai", "");
isLoading.value = true;
const loadingInterval = setInterval(() => {
if (loadingDotIndex.value < 2) {
loadingDotIndex.value++;
} else {
loadingDotIndex.value = 0;
}
}, 500);
try {
const response = await fetch("/checklistChat/langgraph/bills/chat", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(params)
});
// console.log("状态码:", response.status); // 200
// console.log("ok:", response.ok); // true
// console.log("headers:", [...response.headers.entries()]);
// 先以文本形式读取,看看实际内容
const rawText = await response.text();
// console.log("原始响应文本:", rawText);
// 尝试解析 JSON
const data = JSON.parse(rawText); // 可能在这里抛出错误
console.log("解析后的数据:", data);
clearInterval(loadingInterval);
isLoading.value = false;
console.log("data.logs:", data.logs);
console.log("data.choices:", data.choices);
if (data.logs) {
const lastMessage = messages.value[messages.value.length - 1];
if (lastMessage && lastMessage.type === "ai") {
let newDocs = data.logs.map(item => {
return item.detail + " " + formatDateTime(item.ts);
});
lastMessage.source = newDocs;
scrollToBottom();
}
}
if (data.choices && data.choices[0].message.content) {
isCurAnswerMessage.value = true;
let content = data.choices[0].message.content;
if (content === "[DONE]") {
ElMessage.success("生成完成!");
} else {
aiMessage.value += content;
updateLastAIMessage(aiMessage.value);
}
}
if (data.raw_data) {
const lastMessage = messages.value[messages.value.length - 1];
if (lastMessage && lastMessage.type === "ai") {
lastMessage.raw_data = data.raw_data;
scrollToBottom();
}
}
if (data.detail.error) {
console.log(data.detail.error.message);
// ElMessage.error(data.detail.error.message);
isCurAnswerMessage.value = true;
let content = "我们换个新话题吧!";
aiMessage.value += content;
updateLastAIMessage(aiMessage.value);
}
} catch (error) {
console.error("catch 中的错误:", error);
}
};
const handleListChat = async question => {
// 添加用户消息
addMessage("user", question);
......@@ -821,9 +920,10 @@ const sendMessage = async () => {
userInput.value = "";
aiMessage.value = "";
if (curArea.value === "法案") {
await connectSSE(question);
// await connectSSE(question);
handleBillChat(question)
} else {
chat(question);
handleListChat(question);
}
};
......
......@@ -309,9 +309,9 @@ const handleToPage = item => {
switch (item.typeStr) {
case "法案":
curRoute = router.resolve({
path: "/decreeLayout",
path: "/billLayout",
query: {
id: id
billId: item.id
}
});
break;
......
......@@ -409,8 +409,8 @@ onMounted(() => {
margin-top: 25px;
margin-left: 28px;
img {
width: 100%;
// height: 100%;
// width: 100%;
height: 100%;
}
}
.info-right {
......
......@@ -9,7 +9,9 @@
<div class="page-header-left-top-desc">
<div class="text">{{ summaryInfo.newsDateTime }} · {{ summaryInfo.newsOrg }}</div>
<div class="tag-box">
<div class="tag" v-for="(tag, index) in summaryInfo.industryList" :key="index">{{ tag.industryName }}</div>
<div class="tag" v-for="(tag, index) in summaryInfo.industryList" :key="index">
{{ tag.industryName }}
</div>
</div>
</div>
</div>
......@@ -37,7 +39,14 @@
<template #default>
<!-- 内容区域 - 分三块-->
<div class="page-content-news-abstract">
<div class="news-abstract-header">
<img src="./assets/images/abstract-header.png" alt="" />
</div>
<div class="news-abstract-content">
{{
" 美国众议院共和党人正在起草一项新提案,以限制美国对中国的投资。此前,参议院已将其纳入国防政策立法中。知情人士向Semafor透露,众议院工作人员希望在11月7日前就该提案达成共识,并将财政部的反馈纳入由肯塔基州共和党众议员安迪·巴尔提出的配套提案中(尽管政府停摆可能推迟这一时间表)。随后,众议员将利用该文本与参议员就最终《国防授权法案》的内容进行协商。此前一届国会中,类似的尝试因北卡罗来纳州前众议员帕特里克·麦克亨利的反对而失败,但本届国会中,“所有人都在共同努力”。知情人士补充说,领导人并不担心此举会剥夺特朗普在周四与中国领导人习近平会谈时的谈判筹码,因为财政部已开始实施类似的指导方针。"
}}
</div>
</div>
<div class="page-content-news-artical">
<div class="page-content-news-artical-zn">
......@@ -224,23 +233,19 @@ const newsContentInfo = ref({
newsTitle: "",
newsOrg: "",
newsImage: ""
})
});
const handleGetNewsContent = async () => {
const params = {
newsId: route.query.newsId
}
};
try {
const res = await getNewsContent(params)
console.log('新闻内容', res);
if(res.code === 200 && res.data) {
newsContentInfo.value = res.data
}
} catch (error) {
const res = await getNewsContent(params);
console.log("新闻内容", res);
if (res.code === 200 && res.data) {
newsContentInfo.value = res.data;
}
}
} catch (error) {}
};
// 事件脉络
const sanctionProcessList = ref([
......@@ -335,7 +340,7 @@ const handleGetRelationNews = async () => {
onMounted(() => {
handleGetNewsSummary();
handleGetNewsContent()
handleGetNewsContent();
handleGetNewsEvent();
handleGetRelationNews();
});
......@@ -452,9 +457,29 @@ onMounted(() => {
border-radius: 4px;
border: 1px solid rgba(246, 250, 255, 1);
text-indent: 2em;
.news-abstract-header {
margin-top: 6px;
width: 135px;
height: 32px;
img {
width: 100%;
height: 100%;
}
}
.news-abstract-content {
margin-top: 16px;
font-family: Microsoft YaHei;
font-style: Regular;
font-size: 16px;
font-weight: 400;
line-height: 30px;
letter-spacing: 0px;
text-align: justify;
}
}
&-news-artical {
// height: 480px;
margin-top: 16px;
line-height: 1.8;
color: #303133;
// display: flex;
......@@ -464,6 +489,13 @@ onMounted(() => {
&-zn,
&-en {
width: 100%;
font-family: Microsoft YaHei;
font-style: Regular;
font-size: 16px;
font-weight: 400;
line-height: 30px;
letter-spacing: 0px;
text-align: justify;
}
p {
text-align: justify;
......
<template>
<div class="timeline-wrapper">
<button class="arrow left" :disabled="index <= 0" @click="index--">
&lt;
{{ '<' }}
</button>
<div class="timeline-box">
......@@ -19,7 +19,7 @@
</div>
<div class="title">
{{ item.title }}
<img class="item-header-icon" src="@/assets/images/icon/copy.png" style="cursor: pointer;"></img>
<img class="item-header-icon" src="@/assets/images/icon/copy.png" style="cursor: pointer;" />
</div>
<div class="content">
{{ item.content }}
......@@ -30,7 +30,7 @@
</div>
<button class="arrow right" :disabled="index >= total - 5" @click="index++">
&gt;
{{ '>' }}
</button>
</div>
</template>
......@@ -94,7 +94,7 @@ export default {
.arrow {
position: absolute;
top: 50%;
top: 170px;
/* 左右切换按钮 */
width: 24px;
height: 48px;
......@@ -114,13 +114,13 @@ export default {
.left {
left: 0;
border-radius: 4px 0px 0px 4px;
border-radius: 0px 4px 4px 0px;
}
.right {
right: 0;
border-radius: 0px 4px 4px 0px;
border-radius: 4px 0px 0px 4px;
}
.timeline-box {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论