-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor + fixes to chat bubble ui + lint fixes + cleanup (#3437)
- Loading branch information
Showing
5 changed files
with
204 additions
and
184 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
import { messageCompletionFooter } from "@elizaos/core"; | ||
import path from "node:path"; | ||
import multer from "multer"; | ||
import fs from "node:fs"; | ||
|
||
|
||
|
||
export const messageHandlerTemplate = | ||
// {{goals}} | ||
// "# Action Examples" is already included | ||
`{{actionExamples}} | ||
(Action examples are for reference only. Do not use the information from them in your response.) | ||
# Knowledge | ||
{{knowledge}} | ||
# Task: Generate dialog and actions for the character {{agentName}}. | ||
About {{agentName}}: | ||
{{bio}} | ||
{{lore}} | ||
{{providers}} | ||
{{attachments}} | ||
# Capabilities | ||
Note that {{agentName}} is capable of reading/seeing/hearing various forms of media, including images, videos, audio, plaintext and PDFs. Recent attachments have been included above under the "Attachments" section. | ||
{{messageDirections}} | ||
{{recentMessages}} | ||
{{actions}} | ||
# Instructions: Write the next message for {{agentName}}. | ||
${messageCompletionFooter}`; | ||
|
||
export const hyperfiHandlerTemplate = `{{actionExamples}} | ||
(Action examples are for reference only. Do not use the information from them in your response.) | ||
# Knowledge | ||
{{knowledge}} | ||
# Task: Generate dialog and actions for the character {{agentName}}. | ||
About {{agentName}}: | ||
{{bio}} | ||
{{lore}} | ||
{{providers}} | ||
{{attachments}} | ||
# Capabilities | ||
Note that {{agentName}} is capable of reading/seeing/hearing various forms of media, including images, videos, audio, plaintext and PDFs. Recent attachments have been included above under the "Attachments" section. | ||
{{messageDirections}} | ||
{{recentMessages}} | ||
{{actions}} | ||
# Instructions: Write the next message for {{agentName}}. | ||
Response format should be formatted in a JSON block like this: | ||
\`\`\`json | ||
{ "lookAt": "{{nearby}}" or null, "emote": "{{emotes}}" or null, "say": "string" or null, "actions": (array of strings) or null } | ||
\`\`\` | ||
`; | ||
|
||
|
||
|
||
|
||
export const storage = multer.diskStorage({ | ||
destination: (req, file, cb) => { | ||
const uploadDir = path.join(process.cwd(), "data", "uploads"); | ||
// Create the directory if it doesn't exist | ||
if (!fs.existsSync(uploadDir)) { | ||
fs.mkdirSync(uploadDir, { recursive: true }); | ||
} | ||
cb(null, uploadDir); | ||
}, | ||
filename: (req, file, cb) => { | ||
const uniqueSuffix = `${Date.now()}-${Math.round(Math.random() * 1e9)}`; | ||
cb(null, `${uniqueSuffix}-${file.originalname}`); | ||
}, | ||
}); | ||
|
||
// some people have more memory than disk.io | ||
export const upload = multer({ storage /*: multer.memoryStorage() */ }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.