Skip to content

Commit 12b409a

Browse files
使用bizyengine的接口来获取节点信息 (#155)
* 使用bizyengine的接口来获取节点信息 * 添加版
1 parent 2693c7a commit 12b409a

2 files changed

Lines changed: 4 additions & 18 deletions

File tree

bizyui/js/model_price.js

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
import { getCookie } from "./subassembly/tools.js";
2-
3-
// API基础地址
4-
const API_BASE_URL = "https://api.bizyair.cn/y/v1";
5-
61
/**
72
* 货币类型枚举,包含徽章配置信息
83
*/
@@ -55,7 +50,6 @@ export function hasModelInput(node) {
5550
// 如果临时存储中没有,则从outputs中查找
5651
const localized_name = "bizyair_model_name";
5752
if (!node.outputs) {
58-
console.error(`[modelPrice-hasModelInput] error finding node outputs`);
5953
return null;
6054
}
6155
return node.outputs.find((item) => item.name === localized_name);
@@ -86,7 +80,6 @@ export function addCustomBadge(node, badgeOptions) {
8680
// 每次添加badge 清空所有badge 因为badge没有一个唯一标识符,并且价格展示也就一个badge 所以直接全部清除
8781
node.badges = [];
8882
node.badges.push(() => customBadge);
89-
console.log(`[addCustomBadge] 添加badge成功 徽章信息`, node.badges);
9083
}
9184

9285
/**
@@ -218,22 +211,16 @@ export async function addPriceBadgeToNode(node, modelName = "") {
218211
*/
219212
export async function fetchNodePrice(model, nodeInputs) {
220213
try {
221-
// 从cookie中获取认证token
222-
const authToken = getCookie("bizy_token");
223-
if (!authToken) {
224-
throw new Error("未找到认证Token,请先登录");
225-
}
226214
if (!nodeInputs) {
227215
throw new Error("节点输入信息为空,无法获取价格");
228216
}
229-
217+
// 调用bizyengine价格查询接口
230218
const response = await fetch(
231-
`${API_BASE_URL}/trd_api/node/${model}/price`,
219+
`/bizyair/trd_api_pricing?model=${encodeURIComponent(model)}`,
232220
{
233221
method: "POST",
234222
headers: {
235-
"Content-Type": "application/json",
236-
Authorization: `Bearer ${authToken}`,
223+
"Content-Type": "application/json"
237224
},
238225
body: JSON.stringify(nodeInputs),
239226
}
@@ -244,7 +231,6 @@ export async function fetchNodePrice(model, nodeInputs) {
244231
}
245232

246233
const result = await response.json();
247-
console.log("节点价格查询结果:", result);
248234
return result;
249235
} catch (error) {
250236
console.error("获取节点价格失败:", error);

version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.2.82
1+
1.2.83

0 commit comments

Comments
 (0)