chore: optimize sessionToken & bid's description
parent
30a680b5e6
commit
711c95ba9b
|
|
@ -11,8 +11,8 @@
|
||||||
- Node 版本: 16.0+
|
- Node 版本: 16.0+
|
||||||
- 需要准备两个 Terminal,分别启动服务端、前端页面。
|
- 需要准备两个 Terminal,分别启动服务端、前端页面。
|
||||||
- **根据你自定义的
|
- **根据你自定义的
|
||||||
RoomId、UserId 以及申请的 AppID、BusinessID(如有)、[Token](https://www.volcengine.com/docs/6348/70121)、ASR AppID、TTS AppID,修改 `src/config/index.ts` 文件中的配置信息**。
|
RoomId、UserId 以及申请的 AppID、BusinessID(如有)、Token、ASR AppID、TTS AppID,修改 `src/config/index.ts` 文件中的配置信息**。
|
||||||
- 参考[指南](https://www.volcengine.com/docs/6348/1315561),**根据你申请到的 AK、SK、SessionToken, 修改 `Server/app.js` 文件中的配置信息。**
|
- 使用账号的 [AK、SK](https://console.volcengine.com/iam/keymanage)、[SessionToken](https://www.volcengine.com/docs/6348/1315561#sub)(临时token, 子账号才需要), 修改 `Server/app.js` 文件中的 `ACCOUNT_INFO`。**
|
||||||
- 如果您已经自己完成了服务端的逻辑,可以修改前端代码文件 `src/config/index.ts` 中的 `AIGC_PROXY_HOST` 修改请求的域名,并在 `src/app/api.ts` 中修改接口的参数配置。
|
- 如果您已经自己完成了服务端的逻辑,可以修改前端代码文件 `src/config/index.ts` 中的 `AIGC_PROXY_HOST` 修改请求的域名,并在 `src/app/api.ts` 中修改接口的参数配置。
|
||||||
- **您需要在 [火山方舟-在线推理](https://console.volcengine.com/ark/region:ark+cn-beijing/endpoint?config=%7B%7D) 中创建接入点, 并将模型对应的接入点 ID 填入 `src/config/config.ts` 文件中的 `ARK_V3_MODEL_ID`**。
|
- **您需要在 [火山方舟-在线推理](https://console.volcengine.com/ark/region:ark+cn-beijing/endpoint?config=%7B%7D) 中创建接入点, 并将模型对应的接入点 ID 填入 `src/config/config.ts` 文件中的 `ARK_V3_MODEL_ID`**。
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,12 +11,28 @@ const { Signer } = require('@volcengine/openapi');
|
||||||
const app = new Koa();
|
const app = new Koa();
|
||||||
|
|
||||||
app.use(cors({
|
app.use(cors({
|
||||||
origin: '*'
|
origin: '*'
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const AK = 'Your AK';
|
/**
|
||||||
const SK = 'Your SK';
|
* @notes 在 https://console.volcengine.com/iam/keymanage/ 获取 AK/SK
|
||||||
const SessionToken = 'Your Token';
|
*/
|
||||||
|
const ACCOUNT_INFO = {
|
||||||
|
/**
|
||||||
|
* @notes 必填
|
||||||
|
*/
|
||||||
|
accessKeyId: 'Your AK',
|
||||||
|
/**
|
||||||
|
* @notes 必填
|
||||||
|
*/
|
||||||
|
secretKey: 'Your SK',
|
||||||
|
/**
|
||||||
|
* @notes 非必填, 主账号无须传入, 子账号须传, 获取方式可参考
|
||||||
|
* https://www.volcengine.com/docs/6348/1315561 中的 步骤4-使用子账号调用智能体接口 一节
|
||||||
|
*/
|
||||||
|
sessionToken: undefined,
|
||||||
|
// sessionToken: 'Your SessionToken',
|
||||||
|
}
|
||||||
|
|
||||||
app.use(bodyParser());
|
app.use(bodyParser());
|
||||||
|
|
||||||
|
|
@ -44,7 +60,7 @@ app.use(async ctx => {
|
||||||
body,
|
body,
|
||||||
};
|
};
|
||||||
const signer = new Signer(openApiRequestData, "rtc");
|
const signer = new Signer(openApiRequestData, "rtc");
|
||||||
signer.addAuthorization({accessKeyId: AK, secretKey: SK, sessionToken: SessionToken});
|
signer.addAuthorization(ACCOUNT_INFO);
|
||||||
|
|
||||||
/** Refer to: https://www.volcengine.com/docs/6348/69828 */
|
/** Refer to: https://www.volcengine.com/docs/6348/69828 */
|
||||||
const result = await fetch(`https://rtc.volcengineapi.com?Action=${Action}&Version=${Version}`, {
|
const result = await fetch(`https://rtc.volcengineapi.com?Action=${Action}&Version=${Version}`, {
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,11 @@ export const AIGC_PROXY_HOST = 'http://localhost:3001/proxyAIGCFetch';
|
||||||
export class Config {
|
export class Config {
|
||||||
AppId = 'Your AppId';
|
AppId = 'Your AppId';
|
||||||
|
|
||||||
BusinessId?: string = 'Your BusinessId';
|
/**
|
||||||
|
* @brief Not necessary.
|
||||||
|
*/
|
||||||
|
BusinessId?: string;
|
||||||
|
// BusinessId?: string = 'Your BusinessId';
|
||||||
|
|
||||||
RoomId = 'Your RoomId';
|
RoomId = 'Your RoomId';
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue