Skip to content

Commit 84f2da0

Browse files
committed
prettier
1 parent ad34b78 commit 84f2da0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+1776
-1238
lines changed

core/src/actions/imageGeneration.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export const imageGeneration: Action = {
1414
description: "Generate an image to go along with the message.",
1515
validate: async (runtime: IAgentRuntime, message: Memory) => {
1616
// TODO: Abstract this to an image provider thing
17-
17+
1818
const anthropicApiKeyOk = !!runtime.getSetting("ANTHROPIC_API_KEY");
1919
const togetherApiKeyOk = !!runtime.getSetting("TOGETHER_API_KEY");
2020

core/src/adapters/sqlite.ts

-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@ export class SqliteDatabaseAdapter extends DatabaseAdapter {
152152
tableName: string;
153153
agentId?: UUID;
154154
}): Promise<Memory[]> {
155-
156155
if (!params.tableName) {
157156
// default to messages
158157
params.tableName = "messages";

core/src/clients/discord/actions/summarize_conversation.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ const summarizeAction = {
288288
"gpt-4o-mini"
289289
),
290290
});
291-
291+
292292
const summary = await generateText({
293293
runtime,
294294
context,

core/src/clients/twitter/interactions.ts

+25-27
Original file line numberDiff line numberDiff line change
@@ -311,38 +311,36 @@ export class TwitterInteractionClient extends ClientBase {
311311

312312
if (response.text) {
313313
try {
314-
const callback: HandlerCallback = async (
315-
response: Content
316-
) => {
317-
const memories = await sendTweetChunks(
318-
this,
319-
response,
320-
message.roomId,
321-
this.runtime.getSetting("TWITTER_USERNAME"),
322-
tweet.id
323-
);
324-
return memories;
325-
};
314+
const callback: HandlerCallback = async (response: Content) => {
315+
const memories = await sendTweetChunks(
316+
this,
317+
response,
318+
message.roomId,
319+
this.runtime.getSetting("TWITTER_USERNAME"),
320+
tweet.id
321+
);
322+
return memories;
323+
};
326324

327-
const responseMessages = await callback(response);
325+
const responseMessages = await callback(response);
328326

329-
state = (await this.runtime.updateRecentMessageState(
330-
state
331-
)) as State;
327+
state = (await this.runtime.updateRecentMessageState(
328+
state
329+
)) as State;
332330

333-
for (const responseMessage of responseMessages) {
334-
await this.runtime.messageManager.createMemory(
335-
responseMessage
336-
);
337-
}
331+
for (const responseMessage of responseMessages) {
332+
await this.runtime.messageManager.createMemory(
333+
responseMessage
334+
);
335+
}
338336

339-
await this.runtime.evaluate(message, state);
337+
await this.runtime.evaluate(message, state);
340338

341-
await this.runtime.processActions(
342-
message,
343-
responseMessages,
344-
state
345-
);
339+
await this.runtime.processActions(
340+
message,
341+
responseMessages,
342+
state
343+
);
346344
const responseInfo = `Context:\n\n${context}\n\nSelected Post: ${tweet.id} - ${tweet.username}: ${tweet.text}\nAgent's Output:\n${response.text}`;
347345
// f tweets folder dont exist, create
348346
if (!fs.existsSync("tweets")) {

core/src/clients/twitter/post.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export class TwitterPostClient extends ClientBase {
113113
let content = slice.slice(0, contentLength);
114114
// if its bigger than 280, delete the last line
115115
if (content.length > 280) {
116-
content = content.slice(0, content.lastIndexOf("\n"));
116+
content = content.slice(0, content.lastIndexOf("\n"));
117117
}
118118
if (content.length > contentLength) {
119119
// slice at the last period
@@ -130,8 +130,7 @@ export class TwitterPostClient extends ClientBase {
130130
);
131131
// read the body of the response
132132
const body = await result.json();
133-
const tweetResult =
134-
body.data.create_tweet.tweet_results.result;
133+
const tweetResult = body.data.create_tweet.tweet_results.result;
135134

136135
const tweet = {
137136
id: tweetResult.rest_id,

core/src/core/defaultCharacter.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -398,4 +398,4 @@ export const defaultCharacter: Character = {
398398
"dive deeper into stuff when its interesting",
399399
],
400400
},
401-
};
401+
};

core/src/core/generation.ts

+7-5
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ export async function generateText({
4444
}
4545

4646
const provider = runtime.modelProvider;
47-
const endpoint = runtime.character.modelEndpointOverride || models[provider].endpoint;
47+
const endpoint =
48+
runtime.character.modelEndpointOverride || models[provider].endpoint;
4849
const model = models[provider].model[modelClass];
4950
const temperature = models[provider].settings.temperature;
5051
const frequency_penalty = models[provider].settings.frequency_penalty;
@@ -161,9 +162,7 @@ export async function generateText({
161162
}
162163

163164
case ModelProvider.LLAMALOCAL: {
164-
elizaLogger.log(
165-
"Using local Llama model for text completion."
166-
);
165+
elizaLogger.log("Using local Llama model for text completion.");
167166
response = await runtime.llamaService.queueTextCompletion(
168167
context,
169168
temperature,
@@ -258,7 +257,10 @@ export async function generateShouldRespond({
258257
let retryDelay = 1000;
259258
while (true) {
260259
try {
261-
elizaLogger.log("Attempting to generate text with context:", context);
260+
elizaLogger.log(
261+
"Attempting to generate text with context:",
262+
context
263+
);
262264
const response = await generateText({
263265
runtime,
264266
context,

core/src/core/runtime.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,6 @@ export class AgentRuntime implements IAgentRuntime {
263263
this.token = opts.token;
264264

265265
(opts.character.plugins ?? []).forEach((plugin) => {
266-
267266
plugin.actions.forEach((action) => {
268267
this.registerAction(action);
269268
});
@@ -482,14 +481,19 @@ export class AgentRuntime implements IAgentRuntime {
482481
);
483482
if (simileAction) {
484483
action = _action;
485-
elizaLogger.success(`Action found in similes: ${action.name}`);
484+
elizaLogger.success(
485+
`Action found in similes: ${action.name}`
486+
);
486487
break;
487488
}
488489
}
489490
}
490491

491492
if (!action) {
492-
elizaLogger.error("No action found for", responses[0].content.action);
493+
elizaLogger.error(
494+
"No action found for",
495+
responses[0].content.action
496+
);
493497
return;
494498
}
495499

core/src/services/llama.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ class LlamaService {
7474
"https://huggingface.co/NousResearch/Hermes-3-Llama-3.1-8B-GGUF/resolve/main/Hermes-3-Llama-3.1-8B.Q8_0.gguf?download=true";
7575
const modelName = "model.gguf";
7676
this.modelPath = path.join(__dirname, modelName);
77-
7877
}
7978
private async ensureInitialized() {
8079
if (!this.modelInitialized) {
@@ -116,7 +115,7 @@ class LlamaService {
116115
this.model = await this.llama.loadModel({
117116
modelPath: this.modelPath,
118117
});
119-
118+
120119
this.ctx = await this.model.createContext({ contextSize: 8192 });
121120
this.sequence = this.ctx.getSequence();
122121

@@ -391,4 +390,3 @@ class LlamaService {
391390
}
392391

393392
export default LlamaService;
394-

core/tsconfig.json

+4-14
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33
"compilerOptions": {
44
"target": "ESNext",
55
"module": "ESNext",
6-
"lib": [
7-
"ESNext",
8-
"dom"
9-
],
6+
"lib": ["ESNext", "dom"],
107
"moduleResolution": "Bundler",
118
"outDir": "./dist",
129
"rootDir": "./src",
@@ -30,13 +27,6 @@
3027
"./node_modules/jest/types"
3128
]
3229
},
33-
"include": [
34-
"src/**/*"
35-
],
36-
"exclude": [
37-
"node_modules",
38-
"dist",
39-
"src/**/*.d.ts",
40-
"types/**/*.test.ts"
41-
]
42-
}
30+
"include": ["src/**/*"],
31+
"exclude": ["node_modules", "dist", "src/**/*.d.ts", "types/**/*.test.ts"]
32+
}

core/tsup.config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export default defineConfig({
1111
"fs", // Externalize fs to use Node.js built-in module
1212
"path", // Externalize other built-ins if necessary
1313
"http",
14-
"https"
14+
"https",
1515
// Add other modules you want to externalize
1616
],
1717
});

docs/docs/api/_media/README_CN.md

+23-23
Original file line numberDiff line numberDiff line change
@@ -4,39 +4,39 @@
44

55
## 功能
66

7-
- 🛠 支持discord/推特/telegram连接
8-
- 👥 支持多模态agent
9-
- 📚 简单的导入文档并与文档交互
10-
- 💾 可检索的内存和文档存储
11-
- 🚀 高可拓展性,你可以自定义客户端和行为来进行功能拓展
12-
- ☁️ 多模型支持,包括Llama、OpenAI、Grok、Anthropic等
13-
- 📦 简单好用
7+
- 🛠 支持discord/推特/telegram连接
8+
- 👥 支持多模态agent
9+
- 📚 简单的导入文档并与文档交互
10+
- 💾 可检索的内存和文档存储
11+
- 🚀 高可拓展性,你可以自定义客户端和行为来进行功能拓展
12+
- ☁️ 多模型支持,包括Llama、OpenAI、Grok、Anthropic等
13+
- 📦 简单好用
1414

1515
你可以用Eliza做什么?
1616

17-
- 🤖 聊天机器人
18-
- 🕵️ 自主Agents
19-
- 📈 业务流程自动化处理
20-
- 🎮 游戏NPC
17+
- 🤖 聊天机器人
18+
- 🕵️ 自主Agents
19+
- 📈 业务流程自动化处理
20+
- 🎮 游戏NPC
2121

2222
# 开始使用
2323

2424
**前置要求(必须):**
2525

26-
- [Node.js 22+](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm)
27-
- Nodejs安装
28-
- [pnpm](https://pnpm.io/installation)
29-
- 使用pnpm
26+
- [Node.js 22+](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm)
27+
- Nodejs安装
28+
- [pnpm](https://pnpm.io/installation)
29+
- 使用pnpm
3030

3131
### 编辑.env文件
3232

33-
- - 将 .env.example 复制为 .env 并填写适当的值
34-
- 编辑推特环境并输入你的推特账号和密码
33+
- - 将 .env.example 复制为 .env 并填写适当的值
34+
- 编辑推特环境并输入你的推特账号和密码
3535

3636
### 编辑角色文件
3737

38-
- 查看文件 `src/core/defaultCharacter.ts` - 您可以修改它
39-
- 您也可以使用 `node --loader ts-node/esm src/index.ts --characters="path/to/your/character.json"` 加载角色并同时运行多个机器人。
38+
- 查看文件 `src/core/defaultCharacter.ts` - 您可以修改它
39+
- 您也可以使用 `node --loader ts-node/esm src/index.ts --characters="path/to/your/character.json"` 加载角色并同时运行多个机器人。
4040

4141
在完成账号和角色文件的配置后,输入以下命令行启动你的bot:
4242

@@ -163,9 +163,9 @@ pnpm test:sqljs # Run tests with SQL.js
163163

164164
测试使用 Jest 编写,位于 src/\*_/_.test.ts 文件中。测试环境配置如下:
165165

166-
- 从 .env.test 加载环境变量
167-
- 使用 2 分钟的超时时间来运行长时间运行的测试
168-
- 支持 ESM 模块
169-
- 按顺序运行测试 (--runInBand)
166+
- 从 .env.test 加载环境变量
167+
- 使用 2 分钟的超时时间来运行长时间运行的测试
168+
- 支持 ESM 模块
169+
- 按顺序运行测试 (--runInBand)
170170

171171
要创建新测试,请在要测试的代码旁边添加一个 .test.ts 文件。

0 commit comments

Comments
 (0)