提交 75e4f208 authored 作者: coderBryanFu's avatar coderBryanFu

update

上级 dcb35cb3
......@@ -7,7 +7,7 @@ import request from "@/api/request.js";
export function getBillInfo(params) {
return request({
method: 'GET',
url: `/billInfoBean/info/${params.id}`,
url: `/api/billInfoBean/info/${params.id}`,
params,
})
}
......@@ -20,7 +20,7 @@ export function getBillInfo(params) {
export function getBillPerson(params) {
return request({
method: 'GET',
url: `/billInfoBean/person/${params.id}`,
url: `/api/billInfoBean/person/${params.id}`,
params,
})
}
......@@ -33,7 +33,7 @@ export function getBillPerson(params) {
export function getBillEvent(params) {
return request({
method: 'GET',
url: `/billInfoBean/event/${params.id}`,
url: `/api/billInfoBean/event/${params.id}`,
params,
})
}
......@@ -46,7 +46,7 @@ export function getBillEvent(params) {
export function getBillDyqk(params) {
return request({
method: 'GET',
url: `/billInfoBean/dyqk/${params.id}`,
url: `/api/billInfoBean/dyqk/${params.id}`,
params,
})
}
......@@ -59,7 +59,7 @@ export function getBillDyqk(params) {
export function getBillBackground(params) {
return request({
method: 'GET',
url: `/billInfoBean/background/${params.id}`,
url: `/api/billInfoBean/background/${params.id}`,
params,
})
}
......@@ -72,7 +72,7 @@ export function getBillBackground(params) {
export function getBillPersonAnalyze(params) {
return request({
method: 'GET',
url: `/billInfoBean/personAnalyze/${params.id}`,
url: `/api/billInfoBean/personAnalyze/${params.id}`,
params,
})
}
......@@ -85,7 +85,7 @@ export function getBillPersonAnalyze(params) {
export function getBillContentId(params) {
return request({
method: 'GET',
url: `/billInfoBean/contentId/${params.id}`,
url: `/api/billInfoBean/contentId/${params.id}`,
params,
})
}
......@@ -98,7 +98,7 @@ export function getBillContentId(params) {
export function getBillContentTk(params) {
return request({
method: 'GET',
url: `/billInfoBean/content/tk/${params.id}`,
url: `/api/billInfoBean/content/tk/${params.id}`,
params,
})
}
......@@ -111,7 +111,7 @@ export function getBillContentTk(params) {
export function getBillContentXzfs(params) {
return request({
method: 'GET',
url: `/billInfoBean/content/xzfs/${params.id}`,
url: `/api/billInfoBean/content/xzfs/${params.id}`,
params,
})
}
......@@ -124,7 +124,7 @@ export function getBillContentXzfs(params) {
export function getBillHyly(params) {
return request({
method: 'GET',
url: `/billInfoBean/content/hyly/${params.id}`,
url: `/api/billInfoBean/content/hyly/${params.id}`,
params,
})
}
\ No newline at end of file
import request from "@/api/chatRequest";
export function getChat(params) {
return request({
method: 'POST',
url: `/aichat/chat/chat/completions`,
data: params,
})
}
\ No newline at end of file
//引入axios请求
import axios from 'axios'
//引入element-plus里面的消息提示
import {
ElMessage
} from 'element-plus'
// Token管理
const TOKEN_KEY = 'auth_token'
// 获取token
const getToken = () => {
return 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJkYXRhLWNlbnRlciIsImF1ZCI6IndlYiIsImlzcyI6ImRhdGEtY2VudGVyIiwiZXhwIjozODI1ODM1NTkxLCJpYXQiOjE2NzgzNTE5NTMsImp0aSI6IjI4YmY1NTZjMTc0MDQ3YjJiNTExNWM3NzVhYjhlNWRmIiwidXNlcm5hbWUiOiJzdXBlcl91c2VyIn0.zHyVzsleX2lEqjDBYRpwluu_wy2nZKGl0dw3IUGnKNw'
// return localStorage.getItem(TOKEN_KEY)
}
// 设置token
const setToken = (token) => {
localStorage.setItem(TOKEN_KEY, token)
}
// 移除token
const removeToken = () => {
localStorage.removeItem(TOKEN_KEY)
}
// 导出token管理方法
export { getToken, setToken, removeToken }
// const BASE_API = import.meta.env.VITE_BASE_API
// 创建axios实例
const service = axios.create({
// baseURL: BASE_API, //所有的后端接口请求地址前缀部分(没有后端请求不用写)
timeout: 60000*5 // 请求超时时间,这里15秒
//withCredentials: true,// 异步请求携带cookie,true为携带,false为不携带
//请求头里面设置通用传参类型
/*headers: {
//设置后端需要的传参类型
'Content-Type': 'application/json',
'token': 'x-auth-token',//一开始就要token
'X-Requested-With': 'XMLHttpRequest',
}*/
})
// request拦截器
service.interceptors.request.use(config => {
// 获取token并添加到请求头
// const token = getToken()
// if (token) {
// // 根据curl命令,后端接受的是token字段名,而不是Authorization
// config.headers['token'] = token
// // config.headers['Authorization'] = `Bearer ${token}` // 如果后端需要Bearer格式可以使用这个
// }
return config
}, error => {
console.log(error)
return Promise.reject(error)
})
// response拦截器
service.interceptors.response.use(
response => {
//对数据返回做什么
if (response.data.code == 0) {
ElMessage({
message: response.data.message,
type: 'error',
duration: 3 * 1000
})
}
return response.data
},
error => {
console.log('err' + error)
// 处理token过期或无效的情况
if (error.response && (error.response.status === 401 || error.response.status === 403)) {
ElMessage({
message: 'Token已过期,请重新登录',
type: 'error',
duration: 3 * 1000
})
// 清除无效的token
removeToken()
// 可以在这里跳转到登录页
// router.push('/login')
} else {
ElMessage({
message: error.message,
type: 'error',
duration: 3 * 1000
})
}
return Promise.reject(error)
}
)
export default service
\ No newline at end of file
......@@ -7,7 +7,7 @@ import request from "@/api/request.js";
export function getBillTimeAnalyze(params) {
return request({
method: 'GET',
url: `/billDeepDive/processAnalyze/time/${params.id}`,
url: `/api/billDeepDive/processAnalyze/time/${params.id}`,
params,
})
}
......@@ -19,7 +19,7 @@ export function getBillTimeAnalyze(params) {
export function getBillTotalXj(params) {
return request({
method: 'GET',
url: `/billDeepDive/processAnalyze/totalxj/${params.id}`,
url: `/api/billDeepDive/processAnalyze/totalxj/${params.id}`,
params,
})
}
......@@ -31,7 +31,7 @@ export function getBillTotalXj(params) {
export function getBillTp(params) {
return request({
method: 'GET',
url: `/billDeepDive/processAnalyze/tp/${params.id}`,
url: `/api/billDeepDive/processAnalyze/tp/${params.id}`,
params,
})
}
......@@ -43,7 +43,7 @@ export function getBillTp(params) {
export function getBillXj(params) {
return request({
method: 'GET',
url: `/billDeepDive/processAnalyze/xj/${params.id}`,
url: `/api/billDeepDive/processAnalyze/xj/${params.id}`,
params,
})
}
......@@ -55,7 +55,7 @@ export function getBillXj(params) {
export function getProcessSummaryDetail(params) {
return request({
method: 'GET',
url: `/billDeepDive/processSummary/detail/${params.id}`,
url: `/api/billDeepDive/processSummary/detail/${params.id}`,
params,
})
}
......@@ -67,7 +67,7 @@ export function getProcessSummaryDetail(params) {
export function getProcessSummaryTk(params) {
return request({
method: 'GET',
url: `/billDeepDive/processSummary/tk/${params.id}`,
url: `/api/billDeepDive/processSummary/tk/${params.id}`,
params,
})
}
......@@ -79,7 +79,7 @@ export function getProcessSummaryTk(params) {
export function getProcessSummary(params) {
return request({
method: 'GET',
url: `/billDeepDive/processSummary/${params.id}`,
url: `/api/billDeepDive/processSummary/${params.id}`,
params,
})
}
\ No newline at end of file
......@@ -4,7 +4,7 @@ import request from "@/api/request.js";
export function getHotBills() {
return request({
method: 'GET',
url: '/BillOverview/hotBills',
url: '/api/BillOverview/hotBills',
})
}
......@@ -15,7 +15,7 @@ export function getHotBills() {
export function getBillsByType(params) {
return request({
method: 'GET',
url: '/BillOverview/bills',
url: '/api/BillOverview/bills',
params,
})
}
......@@ -24,6 +24,6 @@ export function getBillsByType(params) {
export function getHylyList() {
return request({
method: 'GET',
url: `/billImpactAnalysis/industry/hylyList`,
url: `/api/billImpactAnalysis/industry/hylyList`,
})
}
\ No newline at end of file
......@@ -7,7 +7,7 @@ import request from "@/api/request.js";
export function getCompanyList(params) {
return request({
method: 'GET',
url: `/billImpactAnalysis/industry/company/${params.id}`,
url: `/api/billImpactAnalysis/industry/company/${params.id}`,
params,
})
}
......@@ -19,7 +19,7 @@ export function getCompanyList(params) {
export function getIndustryHyly(params) {
return request({
method: 'GET',
url: `/billImpactAnalysis/industry/hyly/${params.id}`,
url: `/api/billImpactAnalysis/industry/hyly/${params.id}`,
params,
})
}
......@@ -28,6 +28,6 @@ export function getIndustryHyly(params) {
export function getHylyList() {
return request({
method: 'GET',
url: `/billImpactAnalysis/industry/hylyList`,
url: `/api/billImpactAnalysis/industry/hylyList`,
})
}
\ No newline at end of file
......@@ -27,10 +27,10 @@ const removeToken = () => {
// 导出token管理方法
export { getToken, setToken, removeToken }
const BASE_API = import.meta.env.VITE_BASE_API
// const BASE_API = import.meta.env.VITE_BASE_API
// 创建axios实例
const service = axios.create({
baseURL: BASE_API, //所有的后端接口请求地址前缀部分(没有后端请求不用写)
// baseURL: BASE_API, //所有的后端接口请求地址前缀部分(没有后端请求不用写)
timeout: 60000*5 // 请求超时时间,这里15秒
//withCredentials: true,// 异步请求携带cookie,true为携带,false为不携带
//请求头里面设置通用传参类型
......
......@@ -51,7 +51,7 @@
</div>
</div>
<div class="footer">
<el-input type="textarea" :rows="3" v-model="question" placeholder="请输入问题开启智能问答" />
<el-input type="textarea" :rows="3" v-model="userInput" placeholder="请输入问题开启智能问答" />
<div class="btn">
<div class="icon">
<img src="@/assets/icons/aiBox/idea.png" alt="" />
......@@ -71,6 +71,8 @@ import { fetchEventSource } from "@microsoft/fetch-event-source";
import MarkdownIt from "markdown-it";
import { ElMessage } from "element-plus";
import { getChat } from "@/api/chat";
const contentContainer = ref(null);
const userInput = ref("");
const isLoading = ref(false);
......@@ -78,7 +80,7 @@ const abortController = ref(null);
// 消息数据
const messages = ref([
{
{
type: "user",
content: "你好"
},
......@@ -86,7 +88,6 @@ const messages = ref([
type: "ai",
content: "您好!我是AI助手,有什么可以帮助您的吗?"
}
]);
// Markdown 渲染器
......@@ -138,18 +139,22 @@ const connectSSE = async question => {
// 创建 AbortController 用于取消请求
abortController.value = new AbortController();
const params = {
query: "如何检索?",
knowledge_base_name: "kb_test251112",
top_k: 6,
score_threshold: 0.5,
metadata: { year: 2024 }
};
try {
await fetchEventSource("/api/chat-stream", {
await fetchEventSource("/chat/knowledge_base/search_docs", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
question: question
// 其他参数...
}),
body: JSON.stringify(params),
signal: abortController.value.signal,
onopen: async response => {
console.log("SSE 连接已建立", response.status);
if (response.status !== 200) {
......@@ -199,6 +204,23 @@ const connectSSE = async question => {
}
};
const chat = async () => {
const params = {
query: "如何检索?",
knowledge_base_name: "kb_test251112",
top_k: 6,
score_threshold: 0.5,
metadata: { year: 2024 }
};
try {
const res = await getChat(params);
console.log("chat", res);
} catch (error) {
console.error(error);
}
};
// 发送消息
const sendMessage = async () => {
const question = userInput.value.trim();
......@@ -214,6 +236,7 @@ const sendMessage = async () => {
userInput.value = "";
// await connectSSE(question);
chat();
};
// 停止生成
......
<template>
<div class="header-wrapper">
<div class="icon"></div>
<div class="title"></div>
<div class="btn-box"></div>
</div>
</template>
\ No newline at end of file
......@@ -15,7 +15,7 @@ import BillTemplate from '@/views/bill/template/index.vue'
import BillDeepDigLayout from '@/views/bill/deepDig/index.vue'
import BillDeepDigProcessOverview from '@/views/bill/deepDig/processOverview/index.vue'
import BillDeepDigProcessAnalysis from '@/views/bill/deepDig/processAnalysis/index.vue'
import BillDeepDigProgressOverview from '@/views/bill/deepDig/progressAnalysis/index.vue'
import BillDeepDigPoliContribution from '@/views/bill/deepDig/poliContribution/index.vue'
import BillInfluenceLayout from '@/views/bill/influence/index.vue'
import BillInfluenceIndustry from '@/views/bill/influence/industry/index.vue'
import BillInfluenceScientificResearch from '@/views/bill/influence/scientificResearch/index.vue'
......@@ -161,10 +161,10 @@ const routes = [
meta: { title: '流程分析' }
},
{
path: 'progressAnalysis',
name: 'DeepDigProgressAnalysis',
component: BillDeepDigProgressOverview,
meta: { title: '进程分析' }
path: 'poliContribution',
name: 'BillDeepDigPoliContribution',
component: BillDeepDigPoliContribution,
meta: { title: '政治献金' }
},
]
},
......
// 绘制echarts图表
import * as echarts from 'echarts'
const setChart = (option, chartId) => {
let chartDom = document.getElementById(chartId);
chartDom.removeAttribute("_echarts_instance_");
let chart = echarts.init(chartDom);
chart.setOption(option);
return chart;
};
export default setChart
\ No newline at end of file
const getDoublePieChart = (data) => {
const colorList = ['#8AC4FF','#FFD591']
const colorList1 = ['#055FC2','#FFA940']
let option = {
series: [
{
type: 'pie',
radius: [70, 100],
height: '100%',
left: 'center',
width: '100%',
itemStyle: {
borderColor: '#fff',
borderWidth: 1
},
label: {
alignTo: 'edge',
formatter: '{name|{b}}\n{time|{c} 条 {d}%}',
minMargin: 5,
edgeDistance: 10,
lineHeight: 15,
rich: {
time: {
fontSize: 10,
color: '#999'
}
}
},
labelLine: {
length: 15,
length2: 0,
maxSurfaceAngle: 80
},
labelLayout: function (params) {
const isLeft = params.labelRect.x < 556 / 2;
const points = params.labelLinePoints;
// Update the end point.
points[2][0] = isLeft
? params.labelRect.x
: params.labelRect.x + params.labelRect.width;
return {
labelLinePoints: points
};
},
data: data
}]
}
return option
}
export default getDoublePieChart;
\ No newline at end of file
const getPieChart = (data,colorList) => {
let option = {
color: colorList,
series: [
{
type: 'pie',
radius: [70, 100],
height: '100%',
left: 'center',
width: '100%',
itemStyle: {
borderColor: '#fff',
borderWidth: 1
},
label: {
alignTo: 'edge',
formatter: '{name|{b}}\n{time|{c} 条 {d}%}',
minMargin: 5,
edgeDistance: 10,
lineHeight: 15,
rich: {
time: {
fontSize: 10,
color: '#999'
}
}
},
labelLine: {
length: 15,
length2: 0,
maxSurfaceAngle: 80
},
labelLayout: function (params) {
const isLeft = params.labelRect.x < 556 / 2;
const points = params.labelLinePoints;
// Update the end point.
points[2][0] = isLeft
? params.labelRect.x
: params.labelRect.x + params.labelRect.width;
return {
labelLinePoints: points
};
},
data: data
}]
}
return option
}
export default getPieChart;
\ No newline at end of file
......@@ -38,9 +38,9 @@ const siderBtnList = ref([
path: "/billLayout/deepDig/processAnalysis",
},
{
name: "进程分析",
name: "政治献金",
isActive: false,
path: "/billLayout/deepDig/progressAnalysis",
path: "/billLayout/deepDig/poliContribution",
},
]);
......
const getPieChart = (data,colorList) => {
let option = {
color: colorList,
series: [
{
type: 'pie',
radius: [70, 100],
height: '100%',
left: 'center',
width: '100%',
itemStyle: {
borderColor: '#fff',
borderWidth: 1
},
label: {
alignTo: 'edge',
formatter: '{name|{b}}\n{time|{c} 条 {d}%}',
minMargin: 5,
edgeDistance: 10,
lineHeight: 15,
rich: {
time: {
fontSize: 10,
color: '#999'
}
}
},
labelLine: {
length: 15,
length2: 0,
maxSurfaceAngle: 80
},
labelLayout: function (params) {
const isLeft = params.labelRect.x < 556 / 2;
const points = params.labelLinePoints;
// Update the end point.
points[2][0] = isLeft
? params.labelRect.x
: params.labelRect.x + params.labelRect.width;
return {
labelLinePoints: points
};
},
data: data
}]
}
return option
}
export default getPieChart;
\ No newline at end of file
const getSankeyChart = () => {
const option = {
series: {
type: 'sankey',
layout: 'none',
left: '5%',
right: '5%',
top: '5%',
bottom: '5%',
emphasis: {
focus: 'adjacency'
},
nodeWidth: 50,
label: {
show: true,
formatter: function (params) {
return `${params.name} $${params.value}`;
},
position: 'right',
textStyle: {
fontSize: '16px',
color: '#555'
}
},
data: [
{
name: '马尔科·卢比奥',
label: {
position: 'left'
}
},
{
name: '成长俱乐部'
},
{
name: '埃利奥特管理公司'
},
{
name: '高盛集团'
},
{
name: '黑石集团'
},
{
name: '佛罗里达水晶'
},
{
name: '美国银行'
}
],
links: [
{
source: '成长俱乐部',
target: '马尔科·卢比奥',
value: 680751
},
{
source: '埃利奥特管理公司',
target: '马尔科·卢比奥',
value: 440120
},
{
source: '高盛集团',
target: '马尔科·卢比奥',
value: 371517
},
{
source: '黑石集团',
target: '马尔科·卢比奥',
value: 259321
},
{
source: '佛罗里达水晶',
target: '马尔科·卢比奥',
value: 203775
},
{
source: '美国银行',
target: '马尔科·卢比奥',
value: 150892
}
]
}
};
return option
}
export default getSankeyChart
\ No newline at end of file
<template>
<div>我是进程分析</div>
</template>
<script setup>
</script>
<style lang="scss" scoped>
</style>
差异被折叠。
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论