From 96788c3779a67c3e7d51cfeacf3a82489a8de377 Mon Sep 17 00:00:00 2001
From: no99 <17663930442@163.com>
Date: Tue, 4 Mar 2025 14:23:45 +0800
Subject: [PATCH] =?UTF-8?q?=E9=93=BE=E6=8E=A5=E5=A4=BA=E5=AE=9D=E5=A5=87?=
=?UTF-8?q?=E5=85=B5=E6=95=B0=E6=8D=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.env.development | 2 +
.env.production | 3 +-
src/api/sword.js | 25 +++++++
src/views/chat.vue | 213 +++++++++++++++++++++++++++++++++++++++--------------
4 files changed, 186 insertions(+), 57 deletions(-)
diff --git a/.env.development b/.env.development
index 1320e72..4562df8 100644
--- a/.env.development
+++ b/.env.development
@@ -7,5 +7,7 @@ VITE_PUBLIC_PATH=/
#新数据接口
VITE_APP_API_BASE_URL="http://39.101.133.168:8828/link"
+#RAGFlow API
+VITE_APP_RAGFLOW_API_BASE_URL = http://hsy8b7.natappfree.cc/api/v1/chats
# Whether to open mock
VITE_USE_MOCK=true
diff --git a/.env.production b/.env.production
index 5c74376..8b4e9ba 100644
--- a/.env.production
+++ b/.env.production
@@ -9,7 +9,8 @@ VITE_USE_MOCK = true
#新数据接口
VITE_APP_API_BASE_URL = https://api.homilychart.com/link
-
+#RAGFlow API
+VITE_APP_RAGFLOW_API_BASE_URL = http://hsy8b7.natappfree.cc/api/v1/chats
# Whether to enable gzip or brotli compression
# Optional: gzip | brotli | none
# If you need multiple forms, you can use `,` to separate
diff --git a/src/api/sword.js b/src/api/sword.js
index 1ee2cfa..6ea1be6 100644
--- a/src/api/sword.js
+++ b/src/api/sword.js
@@ -2,6 +2,31 @@ import request from '../utils/request'
// 路径
const APIurl = import.meta.env.VITE_APP_API_BASE_URL
+const RAGFlowAPIurl = import.meta.env.VITE_APP_RAGFLOW_API_BASE_URL
+// 创建客服新对话接口
+export const newSessionAPI = function (params) {
+ return request({
+ url: `${APIurl}/api/deepseek/getResponse`,
+ method: 'post',
+ data: new URLSearchParams(params),
+ headers: {
+ Authorization: 'Bearer ragflow-hkNjEwYjcwZjBlMDExZWZiYjYzMDI0Mm'
+ }
+ })
+}
+// 股票代码对话接口
+export const codeAPI = function (params) {
+ return request({
+ url: `${RAGFlowAPIurl}/d107d300f38211ef93e60242ac120003/completions`,
+ method: 'post',
+ data: new URLSearchParams(params.data),
+ headers: {
+ 'Content-Type': 'application/json',
+ Authorization: 'Bearer ragflow-hkNjEwYjcwZjBlMDExZWZiYjYzMDI0Mm'
+ },
+ body: JSON.stringify({ question: content, stream: true, session_id: params.sessionId.value }) // 设置 stream 为 true
+ })
+}
//统计用户行为接口
export const computedUsersAPI = function (params) {
diff --git a/src/views/chat.vue b/src/views/chat.vue
index 6b3cd77..81fb791 100644
--- a/src/views/chat.vue
+++ b/src/views/chat.vue
@@ -1,87 +1,105 @@
@@ -310,8 +411,8 @@ onMounted(async () => {
-