mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-02-20 14:00:56 +08:00
Compare commits
7 Commits
codex/crea
...
codex/fix-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
83bf8c1d5e | ||
|
|
34e206f05d | ||
|
|
dc349923e9 | ||
|
|
0d44c9a823 | ||
|
|
02645af321 | ||
|
|
c3a175f13f | ||
|
|
257794ca00 |
@@ -12,16 +12,12 @@ export abstract class BotFather {
|
|||||||
"get_post",
|
"get_post",
|
||||||
"list_unread_messages",
|
"list_unread_messages",
|
||||||
"mark_notifications_read",
|
"mark_notifications_read",
|
||||||
|
"create_post",
|
||||||
];
|
];
|
||||||
|
|
||||||
protected readonly mcp = hostedMcpTool({
|
protected readonly openisleToken = (process.env.OPENISLE_TOKEN ?? "").trim();
|
||||||
serverLabel: "openisle_mcp",
|
|
||||||
serverUrl: "https://www.open-isle.com/mcp",
|
|
||||||
allowedTools: this.allowedMcpTools,
|
|
||||||
requireApproval: "never",
|
|
||||||
});
|
|
||||||
|
|
||||||
protected readonly openisleToken = process.env.OPENISLE_TOKEN ?? "";
|
protected readonly mcp = this.createHostedMcpTool();
|
||||||
protected readonly agent: Agent;
|
protected readonly agent: Agent;
|
||||||
|
|
||||||
constructor(protected readonly name: string) {
|
constructor(protected readonly name: string) {
|
||||||
@@ -33,8 +29,8 @@ export abstract class BotFather {
|
|||||||
|
|
||||||
console.log(
|
console.log(
|
||||||
this.openisleToken
|
this.openisleToken
|
||||||
? "🔑 OPENISLE_TOKEN detected in environment."
|
? "🔑 OPENISLE_TOKEN detected in environment; it will be attached to MCP requests."
|
||||||
: "🔓 OPENISLE_TOKEN not set; agent will request it if required."
|
: "🔓 OPENISLE_TOKEN not set; authenticated MCP tools may be unavailable."
|
||||||
);
|
);
|
||||||
|
|
||||||
this.agent = new Agent({
|
this.agent = new Agent({
|
||||||
@@ -65,13 +61,29 @@ export abstract class BotFather {
|
|||||||
"You are a helpful assistant for https://www.open-isle.com.",
|
"You are a helpful assistant for https://www.open-isle.com.",
|
||||||
"Finish tasks end-to-end before replying. If multiple MCP tools are needed, call them sequentially until the task is truly done.",
|
"Finish tasks end-to-end before replying. If multiple MCP tools are needed, call them sequentially until the task is truly done.",
|
||||||
"When presenting the result, reply in Chinese with a concise summary and include any important URLs or IDs.",
|
"When presenting the result, reply in Chinese with a concise summary and include any important URLs or IDs.",
|
||||||
this.openisleToken
|
|
||||||
? `If tools require auth, use this token exactly where the tool schema expects it: ${this.openisleToken}`
|
|
||||||
: "If a tool requires auth, ask me to provide OPENISLE_TOKEN via env.",
|
|
||||||
"After finishing replies, call mark_notifications_read with all processed notification IDs to keep the inbox clean.",
|
"After finishing replies, call mark_notifications_read with all processed notification IDs to keep the inbox clean.",
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private createHostedMcpTool() {
|
||||||
|
const token = this.openisleToken;
|
||||||
|
const authConfig = token
|
||||||
|
? {
|
||||||
|
headers: {
|
||||||
|
Authorization: `Bearer ${token}`,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
: {};
|
||||||
|
|
||||||
|
return hostedMcpTool({
|
||||||
|
serverLabel: "openisle_mcp",
|
||||||
|
serverUrl: "https://www.open-isle.com/mcp",
|
||||||
|
allowedTools: this.allowedMcpTools,
|
||||||
|
requireApproval: "never",
|
||||||
|
...authConfig,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
protected getAdditionalInstructions(): string[] {
|
protected getAdditionalInstructions(): string[] {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ class CoffeeBot extends BotFather {
|
|||||||
2. 正文包含:
|
2. 正文包含:
|
||||||
- 亲切的早安问候;
|
- 亲切的早安问候;
|
||||||
- 明确奖品写作“Coffee x 1”;
|
- 明确奖品写作“Coffee x 1”;
|
||||||
|
- 奖品图片链接:https://openisle-1307107697.cos.accelerate.myqcloud.com/dynamic_assert/0d6a9b33e9ca4fe5a90540187d3f9ecb.png;
|
||||||
- 公布开奖时间为今天下午 15:00(北京时间,写成 ${drawTimeText});
|
- 公布开奖时间为今天下午 15:00(北京时间,写成 ${drawTimeText});
|
||||||
- 标注“领奖请私聊站长 @nagisa”;
|
- 标注“领奖请私聊站长 @nagisa”;
|
||||||
- 鼓励大家留言互动。
|
- 鼓励大家留言互动。
|
||||||
|
|||||||
Reference in New Issue
Block a user