|
@@ -54,10 +54,13 @@
|
|
|
</div> -->
|
|
|
<div class="input-container">
|
|
|
<!-- 文件上传预览区 -->
|
|
|
- <div class="upload-preview" v-if="uploadFiles.length > 0 || documents.length > 0">
|
|
|
+ <div
|
|
|
+ class="upload-preview"
|
|
|
+ v-if="uploadFiles.length > 0 || documents.length > 0"
|
|
|
+ >
|
|
|
<div
|
|
|
v-for="(file, index) in uploadFiles"
|
|
|
- :key="'img-'+index"
|
|
|
+ :key="'img-' + index"
|
|
|
class="preview-item"
|
|
|
>
|
|
|
<div class="preview-content">
|
|
@@ -77,7 +80,7 @@
|
|
|
|
|
|
<div
|
|
|
v-for="(doc, index) in documents"
|
|
|
- :key="'doc-'+index"
|
|
|
+ :key="'doc-' + index"
|
|
|
class="preview-item document-item"
|
|
|
>
|
|
|
<div class="preview-content">
|
|
@@ -86,7 +89,10 @@
|
|
|
<span>{{ doc.name }}</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <i class="el-icon-close remove-file" @click="removeDocument(index)"></i>
|
|
|
+ <i
|
|
|
+ class="el-icon-close remove-file"
|
|
|
+ @click="removeDocument(index)"
|
|
|
+ ></i>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
@@ -114,7 +120,7 @@
|
|
|
<i class="el-icon-upload2"></i>
|
|
|
</button>
|
|
|
</div>
|
|
|
- <!-- <button @click="playAudio" class="btn">播放音频</button> -->
|
|
|
+ <!-- <button @click="playAudio" class="btn">播放音频</button> -->
|
|
|
<button @click="sendMessage" class="btn">发送</button>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -238,7 +244,7 @@ export default {
|
|
|
formData.append("file", file);
|
|
|
|
|
|
const response = await axios.post(
|
|
|
- `${process.env.VUE_APP_BASE_AI_API}/upload/file`,//process.env.VUE_APP_BASE_API
|
|
|
+ `${process.env.VUE_APP_BASE_AI_API}/upload/file`, //process.env.VUE_APP_BASE_API
|
|
|
formData,
|
|
|
{
|
|
|
headers: {
|
|
@@ -256,7 +262,7 @@ export default {
|
|
|
};
|
|
|
|
|
|
// 根据文件类型分别存储
|
|
|
- if (file.type.startsWith('image/')) {
|
|
|
+ if (file.type.startsWith("image/")) {
|
|
|
this.uploadFiles.push(fileInfo);
|
|
|
} else {
|
|
|
// 文档类型:pdf, doc, docx, txt 等
|
|
@@ -418,7 +424,7 @@ export default {
|
|
|
.map((file) => file.url);
|
|
|
|
|
|
// 获取文档 URL
|
|
|
- const documentUrls = this.documents.map(doc => doc.url);
|
|
|
+ const documentUrls = this.documents.map((doc) => doc.url);
|
|
|
|
|
|
if (message || imageUrls.length > 0 || documentUrls.length > 0) {
|
|
|
message = message.replace(/(\r\n|\r|\n)/g, " \n");
|
|
@@ -457,7 +463,7 @@ export default {
|
|
|
url: wsUrl,
|
|
|
data: {
|
|
|
message: message,
|
|
|
- chat_config_id: "17",
|
|
|
+ chat_config_id: "2",
|
|
|
user_id: this.phone,
|
|
|
session_id: this.session_id || "",
|
|
|
source: "pc",
|
|
@@ -478,13 +484,12 @@ export default {
|
|
|
thinkingController.abort();
|
|
|
await thinkingPromise;
|
|
|
|
|
|
- if (this.$route.name !== "ai") {
|
|
|
- const additionalInput = response.data.data.milvus_ids;
|
|
|
- this.idArray = additionalInput;
|
|
|
- const idObject = { ids: this.idArray };
|
|
|
- console.log("ID Object:", idObject);
|
|
|
- await this.getMinioUrls(idObject);
|
|
|
- }
|
|
|
+ const additionalInput = response.data.data.document_ids;
|
|
|
+ this.idArray = additionalInput;
|
|
|
+ const idObject = { document_ids: this.idArray };
|
|
|
+ console.log("ID Object:", idObject);
|
|
|
+ await this.getMinioUrls(idObject);
|
|
|
+ /* if (this.$route.name !== "ai") {} */
|
|
|
// 如果有音频,播放音频
|
|
|
if (
|
|
|
response.data.data.audio_info &&
|
|
@@ -518,7 +523,7 @@ export default {
|
|
|
console.log("Sending to backend:", JSON.stringify(idObject));
|
|
|
|
|
|
const response = await axios.post(
|
|
|
- `${process.env.VUE_APP_BASE_AI_API}/milvus/getMinioURl`,
|
|
|
+ `${process.env.VUE_APP_BASE_AI_API}/milvus/getMinioURlbyDocid`,
|
|
|
idObject,
|
|
|
{
|
|
|
headers: {
|
|
@@ -583,17 +588,13 @@ export default {
|
|
|
const data = value.data.answer;
|
|
|
|
|
|
existingMessage.messageType = data;
|
|
|
- /* existingMessage.time = data.timestamp; */
|
|
|
+ /* existingMessage.time = data.timestamp; this.$route.name !== "ai" &&*/
|
|
|
existingMessage.message = "";
|
|
|
|
|
|
let mainText = data;
|
|
|
let sourceText = "";
|
|
|
|
|
|
- if (
|
|
|
- this.$route.name !== "ai" &&
|
|
|
- this.minioUrls &&
|
|
|
- this.minioUrls.length > 0
|
|
|
- ) {
|
|
|
+ if (this.minioUrls && this.minioUrls.length > 0) {
|
|
|
sourceText =
|
|
|
"\n\n<div class='source-section'><h3>相关资料来源:</h3><ol>";
|
|
|
this.minioUrls.forEach((url, index) => {
|