Compare commits
No commits in common. "main" and "qinqing_dev" have entirely different histories.
main
...
qinqing_de
|
@ -18,4 +18,4 @@ VITE_APP_RES_FILE_PATH = 'https://prev.ysaix.com:7868/src/assets/textbook/booktx
|
|||
|
||||
VITE_APP_BUILD_BASE_PATH = 'https://prev.ysaix.com:7868/'
|
||||
|
||||
VITE_SHOW_DEV_TOOLS = 'true'
|
||||
VITE_SHOW_DEV_TOOLS = 'false'
|
||||
|
|
21
.env.yc2
21
.env.yc2
|
@ -1,21 +0,0 @@
|
|||
# 页面标题
|
||||
VITE_APP_TITLE = 实训教学
|
||||
|
||||
# 生产环境配置
|
||||
VITE_APP_ENV = 'production'
|
||||
|
||||
# AIx融合数字管理系统/生产环境
|
||||
VITE_APP_BASE_API = 'https://prev.ysaix.com:7868/prod-api'
|
||||
|
||||
VITE_APP_DOMAIN = 'prev.ysaix.com'
|
||||
|
||||
VITE_APP_UPLOAD_API = 'https://prev.ysaix.com:7868/prod-api'
|
||||
|
||||
# 是否在打包时开启压缩,支持 gzip 和 brotli
|
||||
VITE_BUILD_COMPRESS = gzip
|
||||
|
||||
VITE_APP_RES_FILE_PATH = 'https://prev.ysaix.com:7868/src/assets/textbook/booktxt/'
|
||||
|
||||
VITE_APP_BUILD_BASE_PATH = 'https://prev.ysaix.com:7868/'
|
||||
|
||||
VITE_SHOW_DEV_TOOLS = 'false'
|
|
@ -1,54 +0,0 @@
|
|||
appId: com.electron.app.yc2
|
||||
productName: 实训教学
|
||||
directories:
|
||||
output: dist
|
||||
buildResources: build
|
||||
win:
|
||||
executableName: 实训教学
|
||||
icon: resources/logo2.ico
|
||||
files:
|
||||
- '!**/.vscode/*'
|
||||
- '!src/*'
|
||||
- '!electron.vite.config.{js,ts,mjs,cjs}'
|
||||
- '!{.eslintignore,.eslintrc.cjs,.prettierignore,.prettierrc.yaml,dev-app-update.yml,CHANGELOG.md,README.md}'
|
||||
- '!{.env,.env.*,.npmrc,pnpm-lock.yaml}'
|
||||
asarUnpack:
|
||||
- resources/**
|
||||
nsis:
|
||||
oneClick: false
|
||||
allowToChangeInstallationDirectory: true
|
||||
artifactName: ${name}-yc-${version}-setup.${ext}
|
||||
shortcutName: ${productName}
|
||||
uninstallDisplayName: ${productName}
|
||||
createDesktopShortcut: always
|
||||
mac:
|
||||
entitlementsInherit: build/entitlements.mac.plist
|
||||
extendInfo:
|
||||
- NSCameraUsageDescription: Application requests access to the device's camera.
|
||||
- NSMicrophoneUsageDescription: Application requests access to the device's microphone.
|
||||
- NSDocumentsFolderUsageDescription: Application requests access to the user's Documents folder.
|
||||
- NSDownloadsFolderUsageDescription: Application requests access to the user's Downloads folder.
|
||||
notarize: false
|
||||
dmg:
|
||||
artifactName: ${name}-yc-${version}.${ext}
|
||||
linux:
|
||||
target:
|
||||
- AppImage
|
||||
- snap
|
||||
- deb
|
||||
maintainer: electronjs.org
|
||||
category: Utility
|
||||
appImage:
|
||||
artifactName: ${name}-yc-${version}.${ext}
|
||||
npmRebuild: false
|
||||
publish:
|
||||
provider: generic
|
||||
url: https://prev.ysaix.com:7868/src/assets/smarttalkyc/
|
||||
electronDownload:
|
||||
mirror: https://npmmirror.com/mirrors/electron/
|
||||
# 额外依赖打包到输出目录
|
||||
extraFiles:
|
||||
- from: ./node_modules/im_electron_sdk/lib/
|
||||
to: ./resources
|
||||
filter:
|
||||
- '**/*'
|
22
package.json
22
package.json
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "aix-win",
|
||||
"version": "2.1.37",
|
||||
"version": "2.1.36",
|
||||
"description": "",
|
||||
"main": "./out/main/index.js",
|
||||
"author": "上海交大重庆人工智能研究院",
|
||||
|
@ -17,11 +17,15 @@
|
|||
"build:test": "electron-vite build --mode test && electron-builder --win --config ./electron-builder.yml",
|
||||
"build:prod": "electron-vite build --mode production && electron-builder --win --config ./electron-builder-prod.yml",
|
||||
"build:yc": "electron-vite build --mode yc && electron-builder --win --config ./electron-builder-yc.yml",
|
||||
"build:yc2": "electron-vite build --mode yc2 && electron-builder --win --config ./electron-builder-yc2.yml",
|
||||
"build:mac": "electron-vite build --mode production && electron-builder --mac --config ./electron-builder-prod.yml",
|
||||
"build:linux": "npm run build && electron-builder --linux"
|
||||
},
|
||||
"dependencies": {
|
||||
"@electron-toolkit/preload": "^3.0.1",
|
||||
"@electron-toolkit/utils": "^3.0.0",
|
||||
"@electron/remote": "^2.1.2",
|
||||
"@element-plus/icons-vue": "^2.3.1",
|
||||
"@vitejs/plugin-vue-jsx": "^4.0.0",
|
||||
"@antv/x6": "^2.18.1",
|
||||
"@antv/x6-plugin-clipboard": "^2.1.6",
|
||||
"@antv/x6-plugin-dnd": "^2.1.1",
|
||||
|
@ -30,11 +34,6 @@
|
|||
"@antv/x6-plugin-selection": "^2.2.2",
|
||||
"@antv/x6-plugin-snapline": "^2.1.7",
|
||||
"@antv/x6-plugin-transform": "^2.1.8",
|
||||
"@electron-toolkit/preload": "^3.0.1",
|
||||
"@electron-toolkit/utils": "^3.0.0",
|
||||
"@electron/remote": "^2.1.2",
|
||||
"@element-plus/icons-vue": "^2.3.1",
|
||||
"@vitejs/plugin-vue-jsx": "^4.0.0",
|
||||
"@vue-office/docx": "^1.6.2",
|
||||
"@vue-office/excel": "^1.7.11",
|
||||
"@vue-office/pdf": "^2.0.2",
|
||||
|
@ -54,21 +53,20 @@
|
|||
"js-cookie": "^3.0.5",
|
||||
"jsencrypt": "^3.3.2",
|
||||
"jsondiffpatch": "0.6.0",
|
||||
"less": "^4.2.0",
|
||||
"less-loader": "^7.3.0",
|
||||
"lodash": "^4.17.21",
|
||||
"node-addon-api": "^8.1.0",
|
||||
"pdfjs-dist": "4.4.168",
|
||||
"pinia": "^2.1.7",
|
||||
"pinia-plugin-persistedstate": "^3.2.1",
|
||||
"qs": "^6.13.1",
|
||||
"spark-md5": "^3.0.2",
|
||||
"vite-plugin-electron": "^0.28.8",
|
||||
"vue-qr": "^4.0.9",
|
||||
"vue-router": "^4.4.0",
|
||||
"whiteboard_lyc": "^0.1.3",
|
||||
"xgplayer": "^3.0.19",
|
||||
"xlsx": "^0.18.5"
|
||||
"xlsx": "^0.18.5",
|
||||
"less": "^4.2.0",
|
||||
"less-loader": "^7.3.0",
|
||||
"whiteboard_lyc": "^0.1.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@electron-toolkit/eslint-config": "^1.0.2",
|
||||
|
|
|
@ -284,10 +284,9 @@ export default async function ({ app, shell, BrowserWindow, ipcMain }) {
|
|||
function downloadFiles(url,fileName) {
|
||||
console.log(url,fileName)
|
||||
return new Promise((resolve, reject)=>{
|
||||
const browserWindow = BrowserWindow.getAllWindows()
|
||||
console.log(browserWindow)
|
||||
const browserWindow = BrowserWindow.getFocusedWindow()
|
||||
const id = manager.download({
|
||||
window: browserWindow[0],
|
||||
window: browserWindow,
|
||||
url: url,
|
||||
saveAsFilename: fileName,
|
||||
directory: appTempFilePath,
|
||||
|
|
|
@ -46,7 +46,7 @@ if(!gotTheLock){
|
|||
function createLoginWindow() {
|
||||
if (loginWindow) return
|
||||
loginWindow = new BrowserWindow({
|
||||
width: import.meta.env.MODE==='yc'||import.meta.env.MODE==='yc2'?1160:888,
|
||||
width: import.meta.env.MODE==='yc'?1160:888,
|
||||
height: 520,
|
||||
show: false,
|
||||
frame: false,
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 520 KiB |
|
@ -127,10 +127,7 @@ export const removePropertyOf = function(obj){
|
|||
export function removeTree(list) {
|
||||
var this_ = this
|
||||
for (var i in list) {
|
||||
if (list[i].children == null) {
|
||||
delete list[i].children;
|
||||
}
|
||||
else if (list[i].children.length == 0) {
|
||||
if (list[i].children.length == 0) {
|
||||
list[i].children = undefined
|
||||
} else {
|
||||
this_.removeTree(list[i].children)
|
||||
|
|
|
@ -96,34 +96,5 @@ const getProgress = async (id) => {
|
|||
throw error;
|
||||
}
|
||||
};
|
||||
const getBackGroundV2 = async () => {
|
||||
try {
|
||||
const response = await req("/api/aipptV2/themeListV2", "GET");
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
console.error("请求失败:", error);
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
const createPPTV2 = async (data) => {
|
||||
try {
|
||||
const response = await req("/api/aipptV2/createV2", "POST", data);
|
||||
console.log("createOutline response:", response);
|
||||
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
console.error("请求失败:", error);
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
const getProgressV2 = async (id) => {
|
||||
try {
|
||||
const response = await req(`/api/aipptV2/progressV2?sid=${id}`, "GET");
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
console.error("请求失败:", error);
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
export { createOutline, getBackGround, createPPT, getProgress, getBackGroundV2, createPPTV2, getProgressV2, createByOutline };
|
||||
export { createOutline, getBackGround, createPPT, getProgress, createByOutline };
|
||||
|
|
|
@ -286,7 +286,6 @@ import { updateClasswork, listEvaluationclue, listClassworkeval,delClassworkeval
|
|||
import { listEvaluation } from '@/api/subject'
|
||||
import { listEntpcoursefile } from '@/api/education/entpcoursefile'
|
||||
import { listKnowledgePoint } from "@/api/knowledge/knowledgePoint";
|
||||
import { isJson } from "@/utils/comm";
|
||||
|
||||
|
||||
import { useGetHomework } from '@/hooks/useGetHomework'
|
||||
|
@ -484,13 +483,12 @@ function Apis(key) {
|
|||
*/
|
||||
const t = function(name, time) {
|
||||
return new Promise(resolve => {
|
||||
const evalId = props.bookobj.levelSecondId=='' ? props.bookobj.levelFirstId : props.bookobj.levelSecondId;
|
||||
const queryForm = {
|
||||
// 分页参数
|
||||
currentPage: paginationParams.pageNum,
|
||||
pageSize: paginationParams.pageSize,
|
||||
// 课程相关参数
|
||||
eid: evalId,
|
||||
eid: props.bookobj.levelSecondId,
|
||||
sectionName: props.bookobj.coursetitle,
|
||||
edusubject: userStore.edusubject,
|
||||
edustage: userStore.edustage,
|
||||
|
@ -585,14 +583,10 @@ const getQueryFromEvaluationclue = () => {
|
|||
}
|
||||
|
||||
if (clueres.rows[i].childlist != '') {
|
||||
const tmpJson = '['+clueres.rows[i].childlist+']';
|
||||
if (isJson(tmpJson)){
|
||||
clueres.rows[i].childArray = JSON.parse(tmpJson);
|
||||
for (var j=0; j<clueres.rows[i].childArray.length; j++) {
|
||||
clueres.rows[i].childArray[j].title = clueres.rows[i].childArray[j].title.replace(/(<([^>]+)>)/ig, '');
|
||||
}
|
||||
clueres.rows[i].childArray = JSON.parse('['+clueres.rows[i].childlist+']');
|
||||
for (var j=0; j<clueres.rows[i].childArray.length; j++) {
|
||||
clueres.rows[i].childArray[j].title = clueres.rows[i].childArray[j].title.replace(/(<([^>]+)>)/ig, '');
|
||||
}
|
||||
|
||||
} else {
|
||||
clueres.rows[i].childArray = {};
|
||||
}
|
||||
|
@ -1068,27 +1062,9 @@ watch(() => props.propsformobj.uniquekey, (newVal) => {
|
|||
classWorkForm.uniquekey = props.propsformobj.uniquekey?cloneDeep(props.propsformobj.uniquekey):''; // 作业唯一标识 作业名称
|
||||
}
|
||||
})
|
||||
watch(
|
||||
[
|
||||
() => props.bookobj.levelSecondId,
|
||||
() => props.bookobj.levelFirstId
|
||||
],
|
||||
([newLevelSecondId, newLevelFirstId], [oldLevelSecondId, oldLevelFirstId]) => {
|
||||
if(props.bookobj.node.edusubject == '英语' && props.bookobj.node.edustage == '高中'){
|
||||
if(newLevelFirstId != oldLevelFirstId){
|
||||
console.log(props.bookobj,'高中英语-课程选择')
|
||||
debounceQueryData();
|
||||
}
|
||||
else{
|
||||
// 习题清空
|
||||
workResource.entpCourseWorkList = [];
|
||||
return;
|
||||
}
|
||||
}
|
||||
else{
|
||||
console.log(props.bookobj,'课程选择')
|
||||
debounceQueryData();
|
||||
}
|
||||
watch(() => props.bookobj.levelSecondId, (newVal, oldVal) => {
|
||||
console.log(props.bookobj,'课程选择')
|
||||
debounceQueryData();
|
||||
})
|
||||
|
||||
</script>
|
||||
|
|
|
@ -184,7 +184,7 @@ const chooseVedio = (item) => {
|
|||
padding: 5px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
// justify-content: space-between;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.content:hover {
|
||||
|
@ -192,7 +192,7 @@ const chooseVedio = (item) => {
|
|||
// box-shadow: 0 4px 16px 0 rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
.content-list{
|
||||
height: 150px;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center
|
||||
}
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
<template>
|
||||
<div class="login-container">
|
||||
<div class="login-yc">
|
||||
<img class="welcome-img" :src="buildMode === 'yc2?'?leftBg2:leftBg1" />
|
||||
<img class="welcome-img" :src="leftBg1" />
|
||||
</div>
|
||||
<div class="box-item login">
|
||||
<WindowTools :is-has-max="false" />
|
||||
<div style="display: flex;justify-content: center;"><img class="title-logo" :src="yclogo" /></div>
|
||||
<div class="login-title">永川中小学</div>
|
||||
<div class="login-title2">{{buildMode === 'yc2?'?'重庆永川虚拟仿真AI实训教学管理系统':'人工智能赋能科学素养与劳动技能系统'}}</div>
|
||||
<div class="login-title2">人工智能赋能科学素养与劳动技能系统</div>
|
||||
<el-form ref="formRef" class="login-form" :model="loginForm" :rules="rules" size="large">
|
||||
<el-form-item prop="username">
|
||||
<el-input v-model.trim="loginForm.username" placeholder="请输入用户名" />
|
||||
|
@ -51,12 +51,11 @@ import { encrypt, decrypt } from '@/utils/jsencrypt'
|
|||
import useUserStore from '@/store/modules/user'
|
||||
import yclogo from '@/assets/images/login/yc-logo.png'
|
||||
import leftBg1 from '@/assets/images/login/ycpeitu.png'
|
||||
import leftBg2 from '@/assets/images/login/ycpeitu2.jpg'
|
||||
import WindowTools from '@/components/window-tools/index.vue'
|
||||
import SelectSubject from '@/components/select-subject/index.vue'
|
||||
import Register from './components/Register.vue'
|
||||
import { sessionStore } from '@/utils/store'
|
||||
const buildMode = import.meta.env.MODE
|
||||
|
||||
const { session } = require('@electron/remote')
|
||||
const downloadProp = ref(0)
|
||||
const showDownLoading = ref(false)
|
||||
|
@ -172,14 +171,7 @@ onMounted(() => {
|
|||
align-items: center;
|
||||
justify-content: center;
|
||||
-webkit-app-region: drag;
|
||||
.login-yc{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
img{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.box-item {
|
||||
width: 444px;
|
||||
height: 520px;
|
||||
|
|
|
@ -1,389 +0,0 @@
|
|||
<template>
|
||||
<div class="ai-container">
|
||||
<el-steps style="max-width:100% " :active="activeStep" align-center>
|
||||
<el-step title="生成大纲" />
|
||||
<el-step title="选择模板" />
|
||||
<el-step title="制作PPT" />
|
||||
</el-steps>
|
||||
<div class="card-box">
|
||||
<el-card class="card2" v-if="activeStep === 0">
|
||||
<div class="paragraphs">
|
||||
{{ outputText }}
|
||||
</div>
|
||||
<el-button style="margin-bottom: 5px;" type="primary" @click="addMessage">从新生成</el-button>
|
||||
<el-button style="margin-bottom: 5px;" type="primary" @click="activeStep = 1">下一步</el-button>
|
||||
</el-card>
|
||||
<el-card v-if="activeStep === 1">
|
||||
<div style="padding-bottom: 10px">ppt模板选择</div>
|
||||
<div class="themes">
|
||||
<div v-for="item in backGroundList" :key="item.templateIndexId" :style="{
|
||||
padding: '5px',
|
||||
paddingRight: '5px',
|
||||
paddingLeft: '5px',
|
||||
margin: '5px',
|
||||
backgroundColor: getBackgroundColor(item.templateIndexId),
|
||||
borderRadius: '10px',
|
||||
borderBlock: '10px solid #e6e6e6'
|
||||
}" @click="chooseBackground(item.templateIndexId)" @mouseenter="changeCursor('pointer')" @mouseleave="changeCursor('default')">
|
||||
{{ item.name }}
|
||||
<img style="width: 150px; height: auto" :src="getBackGroundImg(item.detailImage)" alt="" />
|
||||
</div>
|
||||
</div>
|
||||
<el-row class="el-row">
|
||||
<!-- <el-col :span="6" class="el-col">
|
||||
<div class="grid-content-1">
|
||||
<div>演讲备注</div>
|
||||
<el-switch v-model="outlineData.is_card_note" />
|
||||
</div>
|
||||
</el-col>-->
|
||||
<!-- <el-col :span="6" class="el-col">
|
||||
<div class="grid-content-2">
|
||||
<div>生成封面</div>
|
||||
<el-switch v-model="outlineData.is_cover_img" />
|
||||
</div>
|
||||
</el-col>-->
|
||||
<el-col :span="6" class="el-col">
|
||||
<div class="grid-content-1">
|
||||
<div>自动配图</div>
|
||||
<el-switch v-model="outlineData.isFigure" />
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="6" class="el-col">
|
||||
<div class="grid-content-2">
|
||||
<div>PPT作者名:</div>
|
||||
<el-input v-model="outlineData.author" style="width: 50%" />
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<div>
|
||||
<el-button style="margin-bottom: 5px;" type="primary" @click="activeStep = 0">上一步</el-button>
|
||||
<el-button style="margin-bottom: 5px;" type="primary" v-loading="createPPTLoading" @click="outlineCreatePPT()">生成PPT</el-button>
|
||||
</div>
|
||||
</el-card>
|
||||
<el-card v-if="activeStep === 2">
|
||||
<el-progress :percentage="percentage" type="circle"></el-progress>
|
||||
</el-card>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from "vue";
|
||||
import { ElMessage } from 'element-plus'
|
||||
import {
|
||||
getBackGroundV2,
|
||||
createPPTV2,
|
||||
getProgressV2,
|
||||
} from "@/utils/ppt-request.js";
|
||||
import CryptoJS from "crypto-js"
|
||||
|
||||
import { getSignature } from "@/utils/index.js";
|
||||
import {sessionStore} from "@/utils/store";
|
||||
|
||||
let appId = "01ec9aa3";
|
||||
let secret = "M2QxMDAxMjYyYTEzODMwMGRkZTQ4NmUy";
|
||||
let apikey = "39d05b269fa229f431a56c21794a8ea5"
|
||||
let timestamp = Math.floor(Date.now() / 1000);
|
||||
let signature = getSignature(appId, secret, timestamp);
|
||||
const { ipcRenderer } = window.electron || {}
|
||||
|
||||
|
||||
const outputText = ref(""); // 用于展示的大纲数据
|
||||
const stagingData = ref([]); //储存的对话数据,用于多轮对话
|
||||
const stagOutputText = ref(""); // 暂存大纲用于拆分
|
||||
let extractedParts = ref([]) // 初步拆分
|
||||
|
||||
let firstArray = ref([]); //大纲的大纲等级数字部分
|
||||
let secondArray = ref([]); //大纲的文字部分
|
||||
|
||||
|
||||
const backGroundList = ref([]);
|
||||
let subjectdata = sessionStore.get('subject.curNode')
|
||||
const inputTheme = ref(subjectdata.edustage + subjectdata.edusubject + "《" + subjectdata.itemtitle + "》的授课课件"); // 输入的主题
|
||||
const inputRequire = ref("") // 输入的需求
|
||||
const activeStep = ref(0); // 上方进度条
|
||||
const combined = ref('') // 修改完毕的大纲数据,准备传入ppt生成模型
|
||||
|
||||
const treeData = ref([]);
|
||||
const status = ref("init");
|
||||
|
||||
const percentage = ref(0);
|
||||
|
||||
const createPPTLoading = ref(false);
|
||||
|
||||
const getBackgrounds = () => {
|
||||
treeData.value = [];
|
||||
getBackGroundV2().then((res) => {
|
||||
console.log(res);
|
||||
backGroundList.value = res.records;
|
||||
});
|
||||
};
|
||||
|
||||
const getBackGroundImg = (imgUrlStr) => {
|
||||
return JSON.parse(imgUrlStr).titleCoverImage
|
||||
};
|
||||
|
||||
const outlineData = ref({
|
||||
query: '', // 用户要求(最多8000字)
|
||||
// templateId: 'auto', // ppt生成主题
|
||||
author: 'AIX平台',
|
||||
isFigure: false, // 是否自动配图
|
||||
search: true,
|
||||
language: "cn"
|
||||
}
|
||||
)
|
||||
|
||||
const emit = defineEmits(['addSuccess'])
|
||||
const props = defineProps({
|
||||
dataList: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
}
|
||||
})
|
||||
|
||||
// 将输入数据或返回数据存入记忆中
|
||||
function updateStagingData(role, newData) {
|
||||
stagingData.value.push({ role: role, content: newData });
|
||||
}
|
||||
//大纲直接生成ppt
|
||||
const outlineCreatePPT = () => {
|
||||
const newOutlineData = { ...outlineData.value, };
|
||||
newOutlineData.query = outputText.value;
|
||||
createPPTLoading.value = true;
|
||||
createPPTV2(newOutlineData).then((res) => {
|
||||
console.log(res, "正在生成中");
|
||||
createPPTLoading.value = false;
|
||||
activeStep.value = 2
|
||||
|
||||
const checkProgress = () => {
|
||||
getProgressV2(res.sid).then(response => {
|
||||
percentage.value = Math.round(response?.donePages*100/response?.totalPages);
|
||||
if (response.pptStatus === "done") {
|
||||
emit('addSuccess',{...res,url:response.pptUrl})
|
||||
ElMessage.success("生成成功");
|
||||
} else {
|
||||
const sleepTime = 2000;
|
||||
let remainingTime = sleepTime;
|
||||
const intervalId = setInterval(() => {
|
||||
remainingTime -= 100;
|
||||
if (remainingTime <= 0) {
|
||||
clearInterval(intervalId);
|
||||
checkProgress();
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
checkProgress();
|
||||
})
|
||||
};
|
||||
|
||||
//初次对话
|
||||
const addMessage = () => {
|
||||
const themeValue = inputTheme.value;
|
||||
const requireValue = inputRequire.value;
|
||||
firstArray.value = []
|
||||
secondArray.value = []
|
||||
extractedParts.value = []
|
||||
stagOutputText.value = ''
|
||||
const combinedString = `请帮我生成一个ppt大纲,主题为:${themeValue}。具体内容要求为:${requireValue}。注意,用三个等级大纲展示,如1. 1.1 1.1.2 2. 2.1这种类型,且按照这种顺序,不要有完全相同数字等级的大纲,不要有目录`
|
||||
updateStagingData("user", combinedString);
|
||||
connectWebSocket(stagingData.value);
|
||||
// activeStep.value = 3
|
||||
};
|
||||
|
||||
let ttsWS
|
||||
function connectWebSocket(data) {
|
||||
outputText.value = ""; //清楚展示部分内容
|
||||
status.value = "ttsing";
|
||||
return getWebsocketUrl().then((url) => {
|
||||
ttsWS = new WebSocket(url);
|
||||
ttsWS.onopen = () => {
|
||||
webSocketSend(ttsWS, data);
|
||||
};
|
||||
ttsWS.onmessage = (e) => {
|
||||
result1(e.data);
|
||||
};
|
||||
ttsWS.onerror = (e) => {
|
||||
status.value = "error";
|
||||
console.log("WebSocket error:", e);
|
||||
};
|
||||
ttsWS.onclose = () => {
|
||||
status.value = "init";
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
const getBackgroundColor = (key) => {
|
||||
return outlineData.value.templateId === key ? '#83e2b6' : '#f5f5f5';
|
||||
};
|
||||
|
||||
function getWebsocketUrl() {
|
||||
return new Promise((resolve, reject) => {
|
||||
var apiKey = apikey;
|
||||
var apiSecret = secret;
|
||||
var url = "wss://spark-api.xf-yun.com/v4.0/chat";
|
||||
|
||||
var host = "spark-api.xf-yun.com";
|
||||
var date = new Date().toGMTString();
|
||||
var algorithm = "hmac-sha256";
|
||||
var headers = "host date request-line";
|
||||
var signatureOrigin = `host: ${host}\ndate: ${date}\nGET /v4.0/chat HTTP/1.1`;
|
||||
var signatureSha = CryptoJS.HmacSHA256(signatureOrigin, apiSecret);
|
||||
var signature = CryptoJS.enc.Base64.stringify(signatureSha);
|
||||
|
||||
var authorizationOrigin = `api_key="${apiKey}", algorithm="${algorithm}", headers="${headers}", signature="${signature}"`;
|
||||
var authorization = CryptoJS.enc.Base64.stringify(
|
||||
CryptoJS.enc.Utf8.parse(authorizationOrigin)
|
||||
);
|
||||
|
||||
url = `${url}?authorization=${authorization}&date=${date}&host=${host}`;
|
||||
console.log(url);
|
||||
resolve(url);
|
||||
});
|
||||
}
|
||||
function webSocketSend(ws, data) {
|
||||
const params = {
|
||||
header: {
|
||||
app_id: appId,
|
||||
},
|
||||
parameter: {
|
||||
chat: {
|
||||
domain: "4.0Ultra",
|
||||
temperature: 0.5,
|
||||
max_tokens: 1024,
|
||||
},
|
||||
},
|
||||
payload: {
|
||||
message: {
|
||||
text: data,
|
||||
},
|
||||
},
|
||||
};
|
||||
ws.send(JSON.stringify(params));
|
||||
}
|
||||
|
||||
function result1(resultData) {
|
||||
let jsonData = JSON.parse(resultData);
|
||||
outputText.value += jsonData.payload.choices.text[0].content;
|
||||
const div = document.querySelector('.paragraphs');
|
||||
if (div) {
|
||||
div.scrollTop = div.scrollHeight;
|
||||
}
|
||||
if (jsonData.payload && jsonData.payload.usage) {
|
||||
updateStagingData("assistant", outputText.value) //返回数据存入记忆池
|
||||
}
|
||||
if (jsonData.header.code !== 0) {
|
||||
alert(`提问失败: ${jsonData.header.code}:${jsonData.header.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
const chooseBackground = (data) => {
|
||||
outlineData.value.templateId = data
|
||||
}
|
||||
|
||||
const changeCursor = (cursorStyle) => {
|
||||
document.documentElement.style.cursor = cursorStyle;
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
// let pptUrl = "https://bjcdn.openstorage.cn/xinghuo-privatedata/zhiwen/2024-12-06/23754754-b5bb-494a-b96d-7a5dc78820eb/89c1aefc634a4566a1779b2bc8ffa943.pptx";
|
||||
// emit('addSuccess',{url:pptUrl})
|
||||
props.dataList.filter(item => {
|
||||
inputRequire.value += item.answer
|
||||
})
|
||||
getBackgrounds();
|
||||
// addMessage()
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.ai-container {
|
||||
width: 100%;
|
||||
background-color: #f5f7f6;
|
||||
padding: 20px
|
||||
}
|
||||
|
||||
.card-box {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.card1 {
|
||||
padding: 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.paragraphs {
|
||||
white-space: pre-wrap;
|
||||
text-align: left;
|
||||
max-height: 60vh;
|
||||
overflow-y: auto;
|
||||
border: 1px solid #409EFF;
|
||||
padding: 10px;
|
||||
margin: 5px
|
||||
}
|
||||
|
||||
.themes {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
height: 250px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.outline {
|
||||
white-space: pre-wrap;
|
||||
text-align: left;
|
||||
|
||||
border: 1px solid #409EFF;
|
||||
padding: 10px;
|
||||
outline-style: none;
|
||||
/* margin: 5px */
|
||||
}
|
||||
|
||||
.outline-row {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.outline-row>.el-col {
|
||||
display: flex;
|
||||
flex-direction: column
|
||||
}
|
||||
|
||||
.outline-row>.el-col>div,
|
||||
.outline-row>.el-col>div>.el-input {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 3px;
|
||||
}
|
||||
|
||||
.item-with-dash {
|
||||
margin-left: 100px
|
||||
}
|
||||
|
||||
.item-with-dash::after {
|
||||
content: "";
|
||||
border-bottom: 1px dashed #000;
|
||||
flex-grow: 1;
|
||||
margin-left: 4px;
|
||||
}
|
||||
|
||||
.grid-content-1 {
|
||||
border-radius: 4px;
|
||||
background-color: #c2dbf3;
|
||||
}
|
||||
|
||||
.grid-content-2 {
|
||||
border-radius: 4px;
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
|
||||
.el-row {
|
||||
padding: 20px
|
||||
}
|
||||
:deep(.el-card__body){
|
||||
padding: 10px 15px;
|
||||
}
|
||||
</style>
|
|
@ -347,7 +347,7 @@ export default {
|
|||
Object.assign(items, item)
|
||||
asyncLocalFile(items).then(() => {
|
||||
ipcRenderer.send('open-path-app', item.fileNewName)
|
||||
if (this.listenList?.indexOf(item.fileNewName) === -1) {
|
||||
if (this.listenList.indexOf(item.fileNewName) === -1) {
|
||||
this.listenList.push(item.fileNewName)
|
||||
let cookie = localStorage.getItem('Admin-Token')
|
||||
ipcRenderer.send('listen-file-change', {
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import AiPpt from './ai-pptV2.vue';
|
||||
import AiPpt from './ai-ppt.vue';
|
||||
const model = defineModel()
|
||||
const emit = defineEmits(['addSuccess'])
|
||||
const props = defineProps({
|
||||
|
|
|
@ -162,7 +162,7 @@ import KjListItem from '@/views/prepare/container/kj-list-item.vue'
|
|||
import { getSmarttalkPage, moveSmarttalk, creatAPT } from '@/api/file'
|
||||
import { toTimeText } from '@/utils/date'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { parseCataByNode, creatPPT, asyncLocalFile, creatAIPPT } from '@/utils/talkFile'
|
||||
import { parseCataByNode, creatPPT, asyncLocalFile } from '@/utils/talkFile'
|
||||
import FileOperBatch from '@/views/prepare/container/file-oper-batch.vue'
|
||||
import SetHomework from '@/components/set-homework/index.vue'
|
||||
import outLink from '@/utils/linkConfig'
|
||||
|
@ -293,12 +293,9 @@ export default {
|
|||
// },
|
||||
methods: {
|
||||
addAiPPT(item) {
|
||||
console.log(this.currentNode.itemtitle + '.pptx',item.url, {...this.uploadData,fileShowName: this.currentNode.itemtitle + '.pptx'})
|
||||
creatAIPPT(this.currentNode.itemtitle + '.pptx',item.url, {...this.uploadData,fileShowName: this.currentNode.itemtitle + '.pptx'}).then((res) => {
|
||||
this.currentFileList.unshift(res.resData)
|
||||
KjListItem.methods.openFileWin(res.resData);
|
||||
this.pptDialog = false
|
||||
})
|
||||
this.currentFileList.unshift(item.resData)
|
||||
KjListItem.methods.openFileWin(item.resData);
|
||||
this.pptDialog = false
|
||||
},
|
||||
// test() {
|
||||
// toolStore.resetDef() // 重置状态
|
||||
|
|
Loading…
Reference in New Issue