前提条件:通过 https://dsx-air.nvidia.com/ 注册并成功申请到试用资格,且创建好simulations
先打开 https://dsx-air.nvidia.com/simulations 找到自己的simulationsID
例如:nodeloce-7dec-11d0-a765-00a0cnodeloc
然后在登录状态下,打开F12,直接在Console里粘贴如下代码(自行修改sid和URL前缀)
另外可能脚本中dsx-air前缀不一定是最新的,如有新的则替换成新的(比如air-ngc)
[upvote]
if (window._sMonitor?.isActive) {
window._sMonitor.destroy();
}
class SMonitor {
#sid = "nodeloce-7dec-11d0-a765-00a0cnodeloc"; //自己的simulationsID
#intervalMs = 3000; //任务间隔 毫秒数
#abortController = null;
#timerId = null;
constructor() {
this.isActive = true;
this.#initLoop();
}
get #requestConfig() {
return {
method: "PATCH",
mode: "cors",
credentials: "include",
referrer: `https://dsx-air.nvidia.com/simulations/${this.#sid}`,
headers: {
"accept": "application/json, text/plain, */*",
"cache-control": "no-cache",
"pragma": "no-cache"
}
};
}
async #pingState() {
const timestamp = () => `[${new Date().toLocaleTimeString()}]`;
const url = `https://api.dsx-air.nvidia.com/api/v3/simulations/${this.#sid}/start/`;
try {
const response = await fetch(url, {
...this.#requestConfig,
signal: this.#abortController?.signal
});
const rawText = await response.text();
let parsedData;
try {
parsedData = JSON.parse(rawText);
} catch {
parsedData = rawText;
}
if (parsedData && typeof parsedData === 'object' && 'state' in parsedData) {
console.log(`${timestamp()} State:`, parsedData.state);
} else {
console.log(`${timestamp()} Raw Response:`, parsedData);
}
if (!response.ok) {
console.log(`${timestamp()} HTTP Error:`, response.status);
}
} catch (err) {
console.log(`${timestamp()} Network/Request Failed:`, err);
}
}
#initLoop() {
this.#abortController = new AbortController();
const tick = async () => {
if (!this.isActive) return;
await this.#pingState();
if (this.isActive) {
this.#timerId = setTimeout(tick, this.#intervalMs);
}
};
tick();
}
destroy() {
this.isActive = false;
if (this.#timerId) clearTimeout(this.#timerId);
if (this.#abortController) this.#abortController.abort();
console.log("stopped and cleaned up.");
}
}
window._sMonitor = new SMonitor();
[/upvote]
只要代码开始运行了就不要再操作这个网站了以防止自动退出登录,再之后出现任何错误都不用理会。
只要返回如下类似内容,就表示代码正常运行了。
HTTP Error: 400
HTTP Error: 403
State: REQUESTING
PS:如果申请试用资格失败的话,貌似换个IP再刷新页面有机率申请成功!
Good luck to all
34
165
可以共享、可以push的免费邮箱,更可使用自定义域名,完美契合您的各项需求。
165 条回复
排序