mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-06-05 01:17:35 +08:00
fix: should add weather mcp
This commit is contained in:
@@ -44,15 +44,10 @@ export abstract class BotFather {
|
|||||||
: "🌥️ APIFY_API_TOKEN not set; weather updates will be unavailable."
|
: "🌥️ APIFY_API_TOKEN not set; weather updates will be unavailable."
|
||||||
);
|
);
|
||||||
|
|
||||||
let availableTools = [this.mcp];
|
|
||||||
if (this.weatherMcp) {
|
|
||||||
availableTools.push(this.weatherMcp);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.agent = new Agent({
|
this.agent = new Agent({
|
||||||
name: this.name,
|
name: this.name,
|
||||||
instructions: this.buildInstructions(),
|
instructions: this.buildInstructions(),
|
||||||
tools: availableTools,
|
tools: [this.mcp, this.weatherMcp],
|
||||||
model: "gpt-4o",
|
model: "gpt-4o",
|
||||||
modelSettings: {
|
modelSettings: {
|
||||||
temperature: 0.7,
|
temperature: 0.7,
|
||||||
@@ -100,17 +95,13 @@ export abstract class BotFather {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private createWeatherMcpTool(): ReturnType<typeof hostedMcpTool> | null {
|
private createWeatherMcpTool(): ReturnType<typeof hostedMcpTool> {
|
||||||
if (!this.weatherToken) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return hostedMcpTool({
|
return hostedMcpTool({
|
||||||
serverLabel: "weather_mcp_server",
|
serverLabel: "weather_mcp_server",
|
||||||
serverUrl: "https://jiri-spilka--weather-mcp-server.apify.actor/mcp",
|
serverUrl: "https://jiri-spilka--weather-mcp-server.apify.actor/mcp",
|
||||||
requireApproval: "never",
|
requireApproval: "never",
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${this.weatherToken}`,
|
Authorization: `Bearer ${this.weatherToken || ""}`,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user