提交 253ee75a 编写于 作者: View Design's avatar View Design

Wed May 28 20:42:00 CST 2025 inscode

上级 48a66d55
function equalToken(model) { function listToArray(data) {
let unitPrice = 1/1000000; // 1token 是多少钱 const regex = /^-(\s+-)?(.+)/gm;
if (model.currency === 'USD') { const matches = data.match(regex);
const exchangeRate = 7; if (!matches) return [];
return (model.price / unitPrice) / exchangeRate; return matches.map(line => line.replace(/^-(\s+-)?/, '').trim());
} };
return model.price / unitPrice;
}
const model = { const data1 = `- - 《星际穿越》中时间与物理的主题是如何体现的?
price: 0.0014, - - 电影《肖申克的救赎》中,安迪如何体现了自由与救赎的主题?
currency: 'USD' - - 在《教父》中,家族与权力的冲突是如何表现的?`
}
const token = equalToken(model); const data2 = `- 《星际穿越》中时间与物理的主题是如何体现的?
- 电影《肖申克的救赎》中,安迪如何体现了自由与救赎的主题?
- 在《教父》中,家族与权力的冲突是如何表现的?`
console.log(token); console.log(listToArray(data1))
\ No newline at end of file console.log(listToArray(data2))
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册