This commit is contained in:
lyc 2024-11-06 17:33:32 +08:00
parent 71e6b74dd4
commit d05e50218d
11 changed files with 233 additions and 56 deletions

View File

@ -48,6 +48,11 @@ export default defineConfig({
changeOrigin: true, // 改变请求的起源
rewrite: (path) => path.replace(/^\/parth/, '') // 重写路径
},
'/v1': {
target: 'https://ai.ysaix.com:7864',
changeOrigin: true,
pathRewrite: { '^/v1': '' }
}
},
},
plugins: [vue(), WindiCSS()],

View File

@ -0,0 +1,39 @@
import request from '@/utils/request'
import axios from 'axios'
// 查询模板列表
export function modelList(params) {
return request({
url: '/education/llmModel/list',
method: 'get',
params
})
}
export function conversation(data) {
return axios({
url: '/v1/api/new_conversation',
method: 'get',
headers: {
isToken: true,
'Authorization':'Bearer ragflow-IwNzMxMTIyOGY0ZTExZWZiOGE2MDI0Mm',
'Content-Type': 'application/json',
'Accept': '*/*'
},
params: data
})
}
// 进行课标研读对话
export function completion(data) {
return axios({
url: '/v1/api/completion',
method: 'post',
headers: {
'Authorization':'Bearer ragflow-IwNzMxMTIyOGY0ZTExZWZiOGE2MDI0Mm',
'Content-Type': 'application/json',
'Accept': '*/*'
},
data: data
})
}

View File

@ -1,8 +1,8 @@
@font-face {
font-family: "iconfont"; /* Project id 4723712 */
src: url('iconfont.woff2?t=1730448425319') format('woff2'),
url('iconfont.woff?t=1730448425319') format('woff'),
url('iconfont.ttf?t=1730448425319') format('truetype');
src: url('iconfont.woff2?t=1730884302716') format('woff2'),
url('iconfont.woff?t=1730884302716') format('woff'),
url('iconfont.ttf?t=1730884302716') format('truetype');
}
.iconfont {
@ -13,6 +13,10 @@
-moz-osx-font-smoothing: grayscale;
}
.icon-ai:before {
content: "\e626";
}
.icon-xiaoxi:before {
content: "\e677";
}

File diff suppressed because one or more lines are too long

View File

@ -5,6 +5,13 @@
"css_prefix_text": "icon-",
"description": "",
"glyphs": [
{
"icon_id": "41784801",
"name": "ai",
"font_class": "ai",
"unicode": "e626",
"unicode_decimal": 58918
},
{
"icon_id": "2158298",
"name": "消息",

View File

@ -6,7 +6,12 @@
<el-col :span="24">
<div class="template-item">
<div class="item-header"><span class="blue">#</span>核心素养与课程目标</div>
<div class="item-text">研读课程标准提取出与本课相关的核心素养与课程目标</div>
<div class="item-text" >
<div class="item-icon">
<i class="iconfont icon-ai"></i>
</div>
<div class="item-answer" v-html="str"></div>
</div>
</div>
</el-col>
</el-row>
@ -69,7 +74,90 @@
</template>
<script setup>
import { ref, reactive, onMounted } from 'vue';
import { sessionStore } from '@/utils/store'
import useUserStore from '@/store/modules/user'
import { conversation, completion } from '@/api/mode/index'
const userStore = useUserStore()
const props = defineProps({
curTemp: {
type: Array,
default: () =>{
return []
}
}
})
// ID
const params = reactive(
{
"conversation_id": "",
"messages": [
{
"role": "user",
"content": ""
}
],
"quote": false,
"stream": false
}
)
const curNode = reactive({})
const getConversation = async() =>{
const { user: { userId } } = userStore
const result = await conversation({ user_id: String(userId) })
console.log('result=====',result)
params.conversation_id = result.data.data.id
getCompletion()
}
//
const getCompletion = async() =>{
console.log('params=====>',params)
for (const item of props.curTemp) {
try {
console.log(item.name)
params.messages[0].content = `根据${curNode.edustage}语文课标,提炼出${item.name}`
completion(params).then(res =>{
console.log('对话结果===》', res)
let answer = res.data.data.answer
const arr = getResult(answer);
console.log(arr,'arr')
})
} finally{
}
}
}
//
let getResult = () => {
let text = "根据高中的语文课程标准和相关内容,我总结出了以下的核心素养和课标目标:\n\n**核心素养:**\n\n1. 语言建构与运用Language Construction and Application学生能够正确地使用语言文字表达思想、情感和经验。\n2. 思维发展与提升Thinking Development and Enhancement学生能够独立思考、分析问题、解决问题并且具有良好的思维品质。\n3. 审美鉴赏与创造Aesthetic Appreciation and Creation学生能够欣赏和理解不同类型的文学作品具备自觉的审美意识和高尚的审美情趣。\n4. 文化传承与理解Cultural Heritage and Understanding学生能够了解和尊重中国文化、历史和社会背景并且具有良好的文化素养。\n\n**课标目标:**\n\n1. 提升学生综合素质,着力发展核心素养,使学生具有理想信念和社会责任感。\n2. 培养学生的语言文字运用能力,掌握学习语文的基本方法,养成良好的学习习惯。\n3. 提高学生思维能力的发展与思维品质的提升,让学生能够独立思考、分析问题、解决问题。\n4. 培养学生自觉的审美意识和高尚的审美情趣,让学生在语言文字运用的学习中受到美的熏陶。\n\n这些核心素养和课标目标是根据高中语文课程标准提炼出来的旨在帮助教师更好地指导学生发展核心素养并且提高学生综合素质。"
str.value = text.replace(/^\n\n(.*?)\n\n$/s, '<div>$1</div>');
str.value = str.value.replace(/^\n(.*?)\n$/s, '<p>$1</p>');
str.value = str.value.replace(/\*\*(.*?)\*\*/g, "<div class='text-tit'>$1</div>");
str.value = str.value.replace(/(\d+\..*?)\n/g, "<div class='text-num'>$1</div>\n");
console.log(str.value)
}
onMounted(() => {
let data = sessionStore.get('subject.curNode')
Object.assign(curNode, data);
console.log(props.curTemp,'curTemp')
// getConversation()
// getResult()
//
getCompletion()
})
</script>
<style lang="scss" scoped>
@ -123,10 +211,32 @@
.item-text {
display: flex;
margin-top: 10px;
color: #409eff;
font-size: 13px;
padding-left: 20px;
text-align: left;
.item-icon{
width: 30px;
height: 30px;
line-height: 30px;
text-align: center;
background: #F6F6F6;
border-radius: 50%;
margin-right: 10px;
flex-shrink: 0;
}
.item-answer{
flex-direction: column;
padding-top: 5px;
:deep(.text-tit){
font-weight: bold;
margin: 10px 0;
}
:deep(.text-num){
padding-left: 2em;
}
}
}
}
}

View File

@ -1,65 +1,80 @@
<template>
<div class="read-container">
<div class="read-header flex">
<el-dropdown>
<el-dropdown @command="changeTemplate">
<span class="el-dropdown-link">
课标研读模板
{{ curTemplate.name }}
<i class="iconfont icon-xiangxia" </i>
</span>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item>课标研读模板一</el-dropdown-item>
<el-dropdown-item>课标研读模板二</el-dropdown-item>
<el-dropdown-item v-for="item in templateList" :command="item" :key="item.id">{{ item.name
}}</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
<el-button text class="add-btn">
<i class="iconfont icon-jiahao"></i>
添加
</el-button>
<el-button type="primary" @click="aiRead">一键研读</el-button>
</div>
<div class="template-list">
<el-row>
<div class="template-list" v-loading="tempLoading">
<el-row v-for="item in childTempList" :key="item.id">
<el-col :span="24">
<div class="template-item">
<div class="item-header"><span class="blue">#</span>核心素养与课标目标</div>
<div class="item-text">研读课程标准提取出与本课相关的核心素养与课程目标</div>
</div>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<div class="template-item">
<div class="item-header"><span class="blue">#</span>课程内容要求</div>
<div class="item-text">研读课程标准提取出与本课相关的课程内容要求
</div>
</div>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<div class="template-item">
<div class="item-header"><span class="blue">#</span>学业质量要求</div>
<div class="item-text">研读课程标准提取出与本课相关的学业水平要求包括水平一水平二水平三各自的要求描述
</div>
</div>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<div class="template-item">
<div class="item-header"><span class="blue">#</span>教学实施建议</div>
<div class="item-text">研读课程标准提取出与本课相关的教学实施建议
</div>
<div class="item-header"><span class="blue">#</span>{{ item.name }}</div>
<div class="item-text">{{ item.prompt }}</div>
</div>
</el-col>
</el-row>
<el-empty v-if="!childTempList.length" description="暂无模板数据" />
</div>
</div>
</template>
<script setup>
import { ref, reactive, onMounted } from 'vue';
import { modelList} from '@/api/mode/index'
//
const curTemplate = reactive({ name: '', id: '' })
//
const templateList = ref([])
//
const getTemplateList = () => {
modelList({ model: 1, type: 1 }).then(res => {
templateList.value = res.rows
Object.assign(curTemplate, res.rows[0]);
getChildTemplate()
})
}
//
const changeTemplate = (val) => {
Object.assign(curTemplate, val);
getChildTemplate()
}
//
const tempLoading = ref(false)
const childTempList = ref([])
const getChildTemplate = () => {
tempLoading.value = true
modelList({ model: 1, type: 2, parentId: curTemplate.id }).then(res => {
childTempList.value = res.rows
}).finally(() => {
tempLoading.value = false
})
}
const emit = defineEmits(['changeMenu'])
const aiRead = async () => {
emit('changeMenu', childTempList.value)
}
onMounted(() => {
getTemplateList()
})
</script>
<style lang="scss" scoped>
@ -78,15 +93,6 @@
justify-content: space-between;
align-items: center;
.add-btn {
font-size: 13px;
.icon-jiahao {
margin-right: 3px;
font-size: 14px;
}
}
}
.template-list {

View File

@ -31,9 +31,9 @@
}}</el-button>
</div>
<div class="right-con">
<ReadTemplate v-if="activeMenu == 1" />
<ReadTemplate v-if="activeMenu == 1" @changeMenu="changeMenu" />
<QuestionAnswer v-if="activeMenu == 2" />
<ReadResult v-if="activeMenu == 3" />
<ReadResult v-if="activeMenu == 3" :curTemp="curTemp" />
</div>
</div>
</el-col>
@ -93,6 +93,12 @@ const onClickMenu = (item) => {
activeMenu.value = item.value
}
const curTemp = ref([])
const changeMenu = (data) =>{
activeMenu.value = 3
curTemp.value = data
}
</script>