Skip to content
Snippets Groups Projects
Commit d52249af authored by timothycarambat's avatar timothycarambat
Browse files

support attachments via thread API chat/stream-chat endpoints

parent ef71b95c
No related branches found
No related tags found
No related merge requests found
......@@ -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..."
}
]
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment