Appearance
JavaScript / TypeScript SDK
包名:asset-ai-open-sdk(要求 Node.js ≥ 18)。
各资源入参字段与 HTTP 一致,完整表见 接口参考。
安装
bash
npm install asset-ai-open-sdkts
import { AssetAiClient } from "asset-ai-open-sdk";
const client = new AssetAiClient({
baseUrl: "http://localhost:8080",
apiKey: process.env.ASSET_AI_API_KEY!,
});资源与入参要点
| 资源 | 必填入参(摘要) | 文档 |
|---|---|---|
client.property | city、address、buildingArea、propertyUsage | 房产 |
client.vehicle | province、registrationDate(建议加车型) | 车辆 |
client.land | city、location、landNo、landArea、plotRatio、landNature | 土地 |
client.equipment | model、manufactureDate(YYYY-MM) | 设备 |
client.bankStatement | 还款四字段 + files / materials | 流水 |
client.chat | 会话 / OCR / sendMessage Body | 智能对话 |
client.wallet | getWallet / createRechargeOrder / getRechargeOrder | 产品定价 |
各估值资源均提供:create / get / valuate(创建+轮询)/ valuateStream / exportReport。
登录与创建 Key(无需已有 API Key)。试用开户不必先有手机号:
ts
const token = await AssetAiClient.register({
baseUrl: "https://assetai.qiongyuantech.com",
account: "your_login_name",
password: "********",
confirmPassword: "********",
});
const key = await AssetAiClient.createApiKey({
baseUrl: "https://assetai.qiongyuantech.com",
accessToken: token.accessToken,
name: "SDK",
});已有账号用短信(purpose 默认 LOGIN):
ts
await AssetAiClient.sendLoginCode({
baseUrl: "https://assetai.qiongyuantech.com",
account: "13800000000",
});
const token = await AssetAiClient.login({
baseUrl: "https://assetai.qiongyuantech.com",
account: "13800000000",
verificationCode: "123456",
});绑手机:sendLoginCode({ ..., purpose: "BIND" }),再用带试用 Key 的 client 调 client.bindPhone(account, code)。
详情免登:await client.createWebSso(),把返回的 code 拼到详情 URL 的 sso 参数。
导出报告:await client.property.exportReport(taskId, { format: "pdf", scope: "result" }),返回 fileName / fileBase64。
示例
ts
// 房产轮询
const detail = await client.property.valuate({
city: "广东省/深圳市/南山区",
address: "科技园某某小区",
buildingArea: 89.5,
propertyUsage: "RESIDENTIAL",
});
// 设备估值
const equipment = await client.equipment.valuate({
model: "STC200",
manufactureDate: "2021-06",
manufacturer: "徐工",
});
// 流式
const { result } = await client.equipment.valuateStream({
model: "STC200",
manufactureDate: "2021-06",
});
// 智能对话 → 估值
const session = await client.chat.create();
const turn = await client.chat.sendMessage(session.id, {
content: "帮我估一下深圳南山区某某小区 89 平住宅",
});
if (turn.readyToValue && turn.input) {
await client.property.valuate({
...(turn.input as any),
source: "CHAT",
chatSessionId: session.id,
});
}