提交 4e14e157 authored 作者: 王鹏飞's avatar 王鹏飞

chore: update

上级 13088ff0
...@@ -4,6 +4,15 @@ import { useChat } from '@ezijing/ai-vue' ...@@ -4,6 +4,15 @@ import { useChat } from '@ezijing/ai-vue'
import { generatePrompt } from '../prompt' import { generatePrompt } from '../prompt'
import { generatePrompt as generatePrompt2 } from '../prompt2' import { generatePrompt as generatePrompt2 } from '../prompt2'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import {
importType,
requiredType,
deliveryMode,
deliveryTime,
orderStockCount,
shippingTemplate,
afterSalesPolicy,
} from '@/utils/dictionary'
interface ScoreDetail { interface ScoreDetail {
is_ai?: boolean is_ai?: boolean
...@@ -70,22 +79,34 @@ export function useScore() { ...@@ -70,22 +79,34 @@ export function useScore() {
if (item.type == 1) { if (item.type == 1) {
prompt += `请根据选手提交的商品品类信息进行评分(满分${item.percent}分): prompt += `请根据选手提交的商品品类信息进行评分(满分${item.percent}分):
选手提交内容: 选手提交内容:
${JSON.stringify(liveData.commodity_types)}` ${JSON.stringify(liveData.commodity_types)}`
} else if (item.type == 2) { } else if (item.type == 2) {
prompt += `请根据选手提交的商品属性配置信息进行评分(满分${item.percent}分): prompt += `请根据选手提交的商品属性配置信息进行评分(满分${item.percent}分):
选手提交内容: 重要性字典:${JSON.stringify(importType)}
必要性字典:${JSON.stringify(requiredType)}
选手提交内容:
${JSON.stringify(liveData.commodity_attrs)}` ${JSON.stringify(liveData.commodity_attrs)}`
} else if (item.type == 3) { } else if (item.type == 3) {
prompt += `请根据选手提交的商品信息维护内容进行评分(满分${item.percent}分): prompt += `请根据选手提交的商品信息维护内容进行评分(满分${item.percent}分):
选手提交内容: 发货模式字典:${JSON.stringify(deliveryMode)}
发货时效字典:${JSON.stringify(deliveryTime)}
订单库存扣减规则字典:${JSON.stringify(orderStockCount)}
运费模板字典:${JSON.stringify(shippingTemplate)}
售后政策字典:${JSON.stringify(afterSalesPolicy)}
选手提交内容:
${JSON.stringify(liveData.commodities)}` ${JSON.stringify(liveData.commodities)}`
} else if (item.type == 4) { } else if (item.type == 4) {
prompt += `请根据选手提交的直播话术进行评分(满分${item.percent}分): prompt += `请根据选手提交的直播话术进行评分(满分${item.percent}分):
选手提交内容: 选手提交内容:
${JSON.stringify(liveData.speeches)}` ${JSON.stringify(liveData.speeches)}`
} }
prompt += `评分标准:
${item.content}`
}) })
prompt += `EXAMPLE JSON OUTPUT: prompt += `EXAMPLE JSON OUTPUT:
{ {
"commodity_type": { "commodity_type": {
...@@ -102,8 +123,14 @@ ${JSON.stringify(liveData.speeches)}` ...@@ -102,8 +123,14 @@ ${JSON.stringify(liveData.speeches)}`
} }
}` }`
} }
const messages = [
const result = await generateText({ prompt, response_format: { type: 'json_object' } } as any) {
role: 'system',
content: `你是一位专业的电商运营评分专家,负责对选手的商品信息维护操作进行客观、准确的评分。`,
},
{ role: 'user', content: prompt },
]
const result = await generateText({ messages, response_format: { type: 'json_object' } } as any)
if (!result) return if (!result) return
try { try {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论