Skip to content

Commit d7148b9

Browse files
committed
docs: charge callgent
Signed-off-by: ZhaoYongChao <16632301768@163.com>
1 parent 7979c2d commit d7148b9

6 files changed

Lines changed: 119 additions & 6 deletions

File tree

.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
# Set the production url of your site here
44
SITE_URL=http://localhost:3030
5+
APP_URL=http://localhost:8000
56
SITE_BASE_PATH=/
67
SITE_SIGNUP_URL=http://localhost:3030/signup
78

docs/quick-start/pricing.mdx

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ This article assumes you already know [how to create a Callgent](/docs/quick-sta
1414
:::
1515

1616
import SelectCallgent from "@site/src/components/module/select-callgent"
17+
import Publish from "@site/src/components/quick-start/publish"
1718

1819
### 1. Select Your Callgent
1920

@@ -24,7 +25,7 @@ import SelectCallgent from "@site/src/components/module/select-callgent"
2425
### 2. Configure Authentication
2526
Set up authentication to ensure service security and specify who pays for the request. Different types of locks indicate different roles.
2627

27-
**Client Entries**: Used for identity verification. If the lock is open, the creator pays; if closed, the caller pays.
28+
**Client Entries**: Used for identity verification. If the lock is open, the creator pays; if closed, the caller pays by default. Of cause you may specify a fixed payer.
2829

2930
**Service Adaptors**: Indicate how the current request will be charged.
3031

@@ -54,18 +55,28 @@ function calcPrice(req) {
5455
```
5556

5657
### 3. Enable Monetization
57-
Under the **test** section in the image above, find the newly imported API. Click the lock icon, choose your authentication method, and confirm the lock is closed to complete the setup.
58+
In Figure 1 **test**, find the newly imported API. Click the lock icon, choose your authentication method, and confirm the lock is closed to complete the setup.
5859
<a href="/solutions/showcase/user-as-a-service/service-design" target="_blank">How to import an API?</a>
5960

6061
## 🔗 Test Your Monetized Callgent
61-
Once setup is complete, you can start calling your monetized service. Learn more: [Call the Callgent](/docs/quick-start/call-the-callgent)
62+
Once setup is complete, you can <Publish name='publish' /> your Callgent service for users to call.
63+
64+
Learn more: [Call the Callgent](/docs/quick-start/call-the-callgent)
6265

6366
## 🌟 Benefits of Monetizing with Callgent
6467

6568
- **Zero Coding Required**: Start monetizing without writing any code
6669
- **Instant Activation**: Monetization takes effect immediately upon setup
6770
- **Full Transparency**: Users can clearly see the cost breakdown
6871
- **Flexible Options**: Choose the billing method that best fits your service
72+
- **[Transaction Details](/redirect?app=billing)**: View your income and expense records
6973

7074
## 🎉 Start Your Monetization Journey Today!
7175
With Callgent's powerful monetization tools, turn your AI agent into a revenue-generating machine. Get started now! 🚀
76+
77+
78+
The next step is how to promote my cg service based on the interface/tag on the hub.
79+
80+
:::success
81+
How to promote my CG service on the hub based on interface or tag.
82+
:::

i18n/zh/docusaurus-plugin-content-docs/current/quick-start/pricing.mdx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Callgent 提供简单、灵活的变现方案!我的 Callgent 只通过几分
1414
:::
1515

1616
import SelectCallgent from "@site/src/components/module/select-callgent"
17+
import Publish from "@site/src/components/quick-start/publish"
1718

1819
### 1. 选择 Callgent
1920

@@ -54,7 +55,7 @@ function calcPrice(req) {
5455
```
5556

5657
### 3. 启用变现
57-
在图一**test**下找到我们刚才新建导入的 API,点击锁状图标,选择认证方式,确认锁已关闭即表示设置成功,<a href="/solutions/showcase/user-as-a-service/service-design" target="_blank">如何导入 Api?</a>。
58+
在图一**test**下找到我们刚才新建导入的 API,您可以<Publish name='发布' />您的Callgent服务供用户调用。<a href="/solutions/showcase/user-as-a-service/service-design" target="_blank">如何导入 Api?</a>。
5859

5960

6061
## 🔗 测试我的 Callgent 收费
@@ -65,6 +66,11 @@ function calcPrice(req) {
6566
- **即时生效**:设置完成后立即开始计费
6667
- **完全透明**:用户清晰了解每笔费用的构成
6768
- **灵活选择**:根据服务类型自由选择计费模式
69+
- **[收支明细](/redirect?app=billing)**:前往查看您的收支明细
6870

6971
## 🎉 立即开启变现之旅!
7072
借助 Callgent 的强大变现工具,将 AI Agent 转变为创收利器。现在行动吧!🚀
73+
74+
:::success
75+
如何在hub上基于接口/tag推广我的cg服务。
76+
:::

src/components/module/select-callgent.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import useIsBrowser from '@docusaurus/useIsBrowser';
33
import { CallgentResponse } from '@site/src/types/user';
44
import React, { useEffect, useState } from 'react';
55

6-
const ShowLogin = () => {
6+
const SelectCallgent = () => {
77
const isBrowser = useIsBrowser();
88
if (!isBrowser) { return null; }
99
const [callgent, setCallgent] = useState<CallgentResponse>();
@@ -26,4 +26,4 @@ const ShowLogin = () => {
2626
);
2727
};
2828

29-
export default ShowLogin;
29+
export default SelectCallgent;
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
2+
import useIsBrowser from '@docusaurus/useIsBrowser';
3+
import { CallgentResponse } from '@site/src/types/user';
4+
import axios from 'axios';
5+
import React, { useEffect, useState } from 'react';
6+
7+
const Publish = ({ name }: { name: string }) => {
8+
const isBrowser = useIsBrowser();
9+
if (!isBrowser) return null;
10+
11+
const [callgent, setCallgent] = useState<CallgentResponse>();
12+
const [submitted, setSubmitted] = useState(false);
13+
const { siteConfig } = useDocusaurusContext();
14+
const appUrl = siteConfig.customFields.appUrl;
15+
16+
const init = async () => {
17+
const LocCallgent = sessionStorage.getItem('callgent');
18+
if (LocCallgent) {
19+
setCallgent(JSON.parse(LocCallgent));
20+
}
21+
};
22+
23+
useEffect(() => {
24+
init();
25+
}, []);
26+
27+
const publish = async () => {
28+
if (!callgent || submitted) return;
29+
try {
30+
await axios.post(`/api/hub/callgents/${callgent.id}/commit`, {
31+
name: callgent.name,
32+
});
33+
setSubmitted(true);
34+
} catch (error: any) {
35+
if (axios.isAxiosError(error) && error.response?.status === 409) {
36+
setSubmitted(true);
37+
} else {
38+
console.error('Publish error:', error);
39+
}
40+
}
41+
};
42+
43+
return (
44+
<span className="tailwind">
45+
{callgent?.name ? (
46+
<span
47+
onClick={publish}
48+
className={`${submitted ? 'text-green-700 cursor-not-allowed' : 'text-green-700 cursor-pointer hover:underline'
49+
}`}
50+
>
51+
{name}
52+
</span>
53+
) : (
54+
<span className="text-gray-500">{name}</span>
55+
)}
56+
</span>
57+
);
58+
};
59+
60+
export default Publish;

src/pages/redirect/index.tsx

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import React, { useEffect } from 'react';
2+
import { useLocation } from '@docusaurus/router';
3+
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
4+
import useIsBrowser from '@docusaurus/useIsBrowser';
5+
6+
export default function Redirect(): JSX.Element {
7+
const isBrowser = useIsBrowser();
8+
if (!isBrowser) return null;
9+
10+
const location = useLocation();
11+
const { siteConfig } = useDocusaurusContext();
12+
13+
const redirectMap = {
14+
app: siteConfig.customFields.appUrl
15+
};
16+
17+
useEffect(() => {
18+
const searchParams = new URLSearchParams(location.search);
19+
20+
for (const key in redirectMap) {
21+
if (searchParams.has(key)) {
22+
const path = searchParams.get(key);
23+
if (path) {
24+
const targetUrl = `${redirectMap[key]}/${path}`;
25+
window.location.replace(targetUrl);
26+
return;
27+
}
28+
}
29+
}
30+
31+
console.warn('No valid redirect query found:', location.search);
32+
}, [location]);
33+
34+
return <></>;
35+
}

0 commit comments

Comments
 (0)