Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,5 @@ coverage
tsconfig.app.tsbuildinfo
tsconfig.node.tsbuildinfo

/public/data/
/public/data/
__init__.py
7 changes: 7 additions & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,15 @@ const handleClose = (key: string, keyPath: string[]) => {
<el-menu-item index='/decrypt'>解密数据</el-menu-item>
<el-menu-item index='/merge'>数据库合并</el-menu-item>
</el-sub-menu>

<el-menu-item index='/chat2ui_select'>
<statistics-icon></statistics-icon>
<template #title>AI可视化</template>
</el-menu-item>

</el-menu>


<el-menu default-active="1" class="el-menu-vertical-demo" :collapse="isCollapse" @open="handleOpen"
@close="handleClose" :router='true'>
<el-menu-item index='/about'>
Expand Down
124 changes: 81 additions & 43 deletions src/api/base.ts
Original file line number Diff line number Diff line change
@@ -1,62 +1,100 @@
import http from "@/utils/axios.js";


// const is_local_data = false;
const is_local_data = localStorage.getItem('isUseLocalData') === 't';
const is_local_data = localStorage.getItem("isUseLocalData") === "t";

export const apiVersion = () => {
return http.get('/api/rs/version').then((res: any) => {
return res;
}).catch((err: any) => {
console.log(err);
return '';
return http
.get("/api/rs/version")
.then((res: any) => {
return res;
})
}
.catch((err: any) => {
console.log(err);
return "";
});
};

export const api_db_init = async () => {
const t = await http.get('/api/rs/is_init')
console.log("is_db_init", !!t);
return !!t;
}
const t = await http.get("/api/rs/is_init");
console.log("is_db_init", !!t);
return !!t;
};

export const api_img = (url: string) => {
if (is_local_data) {
return `./imgsrc?src=${url}`;
}
return `/api/rs/imgsrc?src=${url}`;
}
if (is_local_data) {
return `./imgsrc?src=${url}`;
}
return `/api/rs/imgsrc?src=${url}`;
};
export const api_audio = (url: string) => {
if (is_local_data) {
return `./audio?src=${url}`;
}
return `/api/rs/audio?src=${url}`;
}
if (is_local_data) {
return `./audio?src=${url}`;
}
return `/api/rs/audio?src=${url}`;
};

export const api_video = (url: string) => {
if (is_local_data) {
return `./video?src=${url}`;
}
return `/api/rs/video?src=${url}`;
}
if (is_local_data) {
return `./video?src=${url}`;
}
return `/api/rs/video?src=${url}`;
};

export const api_file = (url: string) => {
if (is_local_data) {
return `./file?src=${url}`;
}
return `/api/rs/file?src=${url}`;
}
if (is_local_data) {
return `./file?src=${url}`;
}
return `/api/rs/file?src=${url}`;
};

// file_info
export const api_file_info = (url: string) => {
if (is_local_data) {
return `./file_info?src=${url}`;
}
return http.post('/api/rs/file_info', {
'file_path': url,
}).then((res: any) => {
return res;
}).catch((err: any) => {
console.log(err);
return '';
if (is_local_data) {
return `./file_info?src=${url}`;
}
return http
.post("/api/rs/file_info", {
file_path: url,
})
.then((res: any) => {
return res;
})
.catch((err: any) => {
console.log(err);
return "";
});
};

// DeepSeek设置部分
export const apiDeepSeekSet = (key: string) => {
return http
.post("/api/rs/deepseek_setting", {
deepseek: {
api_key: key,
},
})
.then((res: any) => {
return res;
})
.catch((err: any) => {
console.log(err);
return "";
});
};


/**
* 获取DeepSeek设置
*/
export const apiDeepSeekGet = () => {
return http
.get("/api/rs/deepseek_setting")
.then((res: any) => {
return res;
})
}
.catch((err: any) => {
console.log(err);
return "";
});
};
47 changes: 47 additions & 0 deletions src/api/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,50 @@ export const apiMsgs = (wxid: string, start: number, limit: number) => {
return '';
})
}

/**
* 获取ai可视化文件列表
*/
export const apiAiList = () =>{
return http.get('/api/rs/ai_ui_json_list' ).then((res: any) => {
return res;
}).catch((err: any) => {
console.log(err);
return '';
})
}


/**
* 获取ai可视化文件内容
*/

export interface AiUiJson {

wxid: string,
start_time:string,
end_time:string,

}



export const apiAiUiJson = (file_name: AiUiJson) =>{
return http.post('/api/rs/get_ui_json', {file_name}).then((res: any) => {
return res;
}).catch((err: any) => {
console.log(err);
return '';
})
}


export const apiAiUiCreateJson = (file_name: AiUiJson) =>{
return http.post('/api/rs/db_to_ai_json', {file_name}).then((res: any) => {
return res;
}).catch((err: any) => {
console.log(err);
return '';
})
}

18 changes: 16 additions & 2 deletions src/assets/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,22 @@

--section-gap: 160px;
}
/* 可视化页面的css*/
:root {
--bg-ui-s-primary: #0f0e17;
--bg-ui-s-secondary: #1a1925;
--bg-ui-s-tertiary: #252336;
--text-ui-s-primary: #fffffe;
--text-ui-s-secondary: #a7a9be;
--accent-ui-s-primary: #ff8906;
--accent-ui-s-secondary: #f25f4c;
--accent-ui-s-tertiary: #e53170;
--accent-ui-s-blue: #3da9fc;
--accent-ui-s-purple: #7209b7;
--accent-ui-s-cyan: #00b4d8;
}

@media (prefers-color-scheme: dark) {
/* @media (prefers-color-scheme: dark) {
:root {
--color-background: var(--vt-c-black);
--color-background-soft: var(--vt-c-black-soft);
Expand All @@ -48,7 +62,7 @@
--color-heading: var(--vt-c-text-dark-1);
--color-text: var(--vt-c-text-dark-2);
}
}
} */

*,
*::before,
Expand Down
1 change: 1 addition & 0 deletions src/components/chat/ChatRecords.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ onMounted(() => {
<el-main style="height: calc(100vh - 40px);padding: 0;margin: 0;background-color: #f5f5f5;">
<ChatExportMain v-if="is_export" :wxid="wxid"/>
<ChatRecordsMain v-else :wxid="wxid"/>

</el-main>
</el-container>
</template>
Expand Down
6 changes: 6 additions & 0 deletions src/components/chatBackup/ChatExportMain.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import ExportJSON from "@/components/chatBackup/ExportJSON.vue";
import ExportHTML from "@/components/chatBackup/ExportHTML.vue";
import ExportPDF from "@/components/chatBackup/ExportPDF.vue";
import ExportDOCX from "@/components/chatBackup/ExportDOCX.vue";
import ExportJSONMini from './ExportJSONMini.vue';

const props = defineProps({
wxid: {
Expand Down Expand Up @@ -44,6 +45,10 @@ const setting = {
brief: 'json',
detail: "只包含文本,可用于数据分析,情感分析等方面。",
},
'json-mini': {
brief: 'json-mini',
detail: "只包含文本,只有最小化的json格式。支持选择时间,注意不要选择太多时间,会导致导出数据过大影响AI分析。",
},
'html': {
brief: 'html-测试中',
detail: "主要用于浏览器可视化查看。",
Expand Down Expand Up @@ -91,6 +96,7 @@ const setting = {
<ExportDEDB v-if="exportType=='dedb'" :wxid="props.wxid"/>
<ExportCSV v-if="exportType=='csv'" :wxid="props.wxid"/>
<ExportJSON v-if="exportType=='json'" :wxid="props.wxid"/>
<ExportJSONMini v-if="exportType=='json-mini'" :wxid="props.wxid"/>
<ExportHTML v-if="exportType=='html'" :wxid="props.wxid"/>
<ExportPDF v-if="exportType=='pdf'" :wxid="props.wxid"/>
<ExportDOCX v-if="exportType=='docx'" :wxid="props.wxid"/>
Expand Down
68 changes: 68 additions & 0 deletions src/components/chatBackup/ExportJSONMini.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<script setup lang="ts">

import {defineProps, ref, watch} from "vue";
import http from "@/utils/axios.js";
import DateTimeSelect from "@/components/utils/DateTimeSelect.vue";

const props = defineProps({
wxid: {
type: String,
required: true,
}
});
watch(() => props.wxid, (newVal: string, oldVal: String) => {
console.log(newVal);
});
// 上述代码是监听props.wxid的变化,当props.wxid变化时,会打印新值。

const datetime = ref([]);
const Result = ref("");

const requestExport = async () => {
Result.value = "正在处理中...";
try {
console.log(datetime.value); // 打印datetime.value的值,查看是否正确传递给后端
Result.value = await http.post('/api/rs/export_json_mini_select_time', {
'wxid': props.wxid,
// 'datetime': datetime.value,
"time":{
"start_createtime":datetime.value[0],
"end_createtime":datetime.value[1]
}
});
} catch (error) {
console.error('Error fetching data msg_count:', error);
Result.value = "请求失败\n" + error;
return [];
}
}

// 处理时间选择器的数据
const handDatetimeChildData = (val: any) => {
// 明确指定 timer 参数的类型为 Date,解决隐式 any 类型问题

datetime.value = val;
}

</script>

<template>
<div>
<div>
<strong>时间(默认全部):</strong>
<DateTimeSelect @datetime="handDatetimeChildData"/>
</div>

<div style="position: relative;">
<el-button type="primary" @click="requestExport()">导出</el-button>
</div>
<el-divider/>
<!-- 结果显示 -->
<el-input type="textarea" :rows="6" readonly placeholder="" v-model="Result"
style="width: 100%;"></el-input>
</div>
</template>

<style scoped>

</style>
2 changes: 1 addition & 1 deletion src/components/utils/DateTimeSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ watch(() => datetime.value, (newVal: any, oldVal: any) => {
start-placeholder="开始时间"
end-placeholder="结束时间"
:default-time="defaultTime"
format="YYYY-MM-DD HH:mm"
format="YYYY-MM-DD HH:mm:ss"
/>
<!-- </div>-->
</template>
Expand Down
Loading