LLM
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
|
||||
function sendMsg(msg: string, target_id: string) {
|
||||
const replyMessage = {
|
||||
user_id: String(target_id),
|
||||
message: [
|
||||
{
|
||||
type: "text",
|
||||
data: {
|
||||
text: msg
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
const replyUrl = `http://localhost:30000/send_private_msg`;
|
||||
|
||||
console.log(`[发送消息] ${msg} -> ${target_id}`);
|
||||
|
||||
return fetch(replyUrl, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(replyMessage)
|
||||
});
|
||||
}
|
||||
|
||||
function sendMediaMsg(filePath: string, target_id: string, type: 'video' | 'image') {
|
||||
const mediaMessage = {
|
||||
user_id: String(target_id),
|
||||
message: [
|
||||
{
|
||||
type: type,
|
||||
data: {
|
||||
file: `file://${filePath}`
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
const replyUrl = `http://localhost:30000/send_private_msg`;
|
||||
|
||||
console.log(`[发送媒体消息] ${type} - ${filePath} -> ${target_id}`);
|
||||
|
||||
return fetch(replyUrl, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(mediaMessage)
|
||||
});
|
||||
}
|
||||
|
||||
export { sendMsg, sendMediaMsg }
|
||||
Reference in New Issue
Block a user