mirror of
https://github.com/Mintplex-Labs/anything-llm.git
synced 2025-04-17 18:18:11 +00:00
support attachments via thread API chat/stream-chat endpoints
This commit is contained in:
parent
ef71b95cf9
commit
d52249aff8
2 changed files with 46 additions and 6 deletions
server
|
@ -344,7 +344,14 @@ function apiWorkspaceThreadEndpoints(app) {
|
|||
example: {
|
||||
message: "What is AnythingLLM?",
|
||||
mode: "query | chat",
|
||||
userId: 1
|
||||
userId: 1,
|
||||
attachments: [
|
||||
{
|
||||
name: "image.png",
|
||||
mime: "image/png",
|
||||
contentString: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA..."
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -374,7 +381,12 @@ function apiWorkspaceThreadEndpoints(app) {
|
|||
*/
|
||||
try {
|
||||
const { slug, threadSlug } = request.params;
|
||||
const { message, mode = "query", userId } = reqBody(request);
|
||||
const {
|
||||
message,
|
||||
mode = "query",
|
||||
userId,
|
||||
attachments = [],
|
||||
} = reqBody(request);
|
||||
const workspace = await Workspace.get({ slug });
|
||||
const thread = await WorkspaceThread.get({
|
||||
slug: threadSlug,
|
||||
|
@ -414,6 +426,7 @@ function apiWorkspaceThreadEndpoints(app) {
|
|||
mode,
|
||||
user,
|
||||
thread,
|
||||
attachments,
|
||||
});
|
||||
await Telemetry.sendTelemetry("sent_chat", {
|
||||
LLMSelection: process.env.LLM_PROVIDER || "openai",
|
||||
|
@ -469,7 +482,14 @@ function apiWorkspaceThreadEndpoints(app) {
|
|||
example: {
|
||||
message: "What is AnythingLLM?",
|
||||
mode: "query | chat",
|
||||
userId: 1
|
||||
userId: 1,
|
||||
attachments: [
|
||||
{
|
||||
name: "image.png",
|
||||
mime: "image/png",
|
||||
contentString: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA..."
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -520,7 +540,12 @@ function apiWorkspaceThreadEndpoints(app) {
|
|||
*/
|
||||
try {
|
||||
const { slug, threadSlug } = request.params;
|
||||
const { message, mode = "query", userId } = reqBody(request);
|
||||
const {
|
||||
message,
|
||||
mode = "query",
|
||||
userId,
|
||||
attachments = [],
|
||||
} = reqBody(request);
|
||||
const workspace = await Workspace.get({ slug });
|
||||
const thread = await WorkspaceThread.get({
|
||||
slug: threadSlug,
|
||||
|
@ -568,6 +593,7 @@ function apiWorkspaceThreadEndpoints(app) {
|
|||
mode,
|
||||
user,
|
||||
thread,
|
||||
attachments,
|
||||
});
|
||||
await Telemetry.sendTelemetry("sent_chat", {
|
||||
LLMSelection: process.env.LLM_PROVIDER || "openai",
|
||||
|
|
|
@ -2902,7 +2902,14 @@
|
|||
"example": {
|
||||
"message": "What is AnythingLLM?",
|
||||
"mode": "query | chat",
|
||||
"userId": 1
|
||||
"userId": 1,
|
||||
"attachments": [
|
||||
{
|
||||
"name": "image.png",
|
||||
"mime": "image/png",
|
||||
"contentString": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA..."
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3007,7 +3014,14 @@
|
|||
"example": {
|
||||
"message": "What is AnythingLLM?",
|
||||
"mode": "query | chat",
|
||||
"userId": 1
|
||||
"userId": 1,
|
||||
"attachments": [
|
||||
{
|
||||
"name": "image.png",
|
||||
"mime": "image/png",
|
||||
"contentString": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA..."
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue