mirror of
https://github.com/outline/outline.git
synced 2026-11-28 16:19:46 +03:00
# Conflicts: # plugins/slack/server/api/hooks.ts # plugins/slack/server/auth/slack.ts # plugins/slack/server/processors/SlackProcessor.ts # server/context.ts # server/routes/api/index.ts # shared/i18n/locales/en_US/translation.json
36 lines
1.2 KiB
TypeScript
36 lines
1.2 KiB
TypeScript
import type { Document } from "@server/models";
|
|
import type { Context } from "@server/types";
|
|
import type { ChatMarkdown } from "./types";
|
|
|
|
/** An answer to a question, with the documents that it came from. */
|
|
export interface ChatAnswer {
|
|
/** The answer, or an empty string if no answer was found. */
|
|
answer: ChatMarkdown;
|
|
/** The documents that the answer came from. */
|
|
documents: Document[];
|
|
}
|
|
|
|
/**
|
|
* Answers questions asked from a chat platform. Register an implementation
|
|
* with `Hook.ChatAnswerProvider` to answer questions in place of a search.
|
|
*/
|
|
export interface ChatAnswerProvider {
|
|
/**
|
|
* Returns true if the text is a question that the provider can answer.
|
|
*
|
|
* @param ctx the context of the user that asked, for one team.
|
|
* @param text the text that the user typed.
|
|
* @returns true if the provider can answer.
|
|
*/
|
|
canAnswer(ctx: Context, text: string): boolean;
|
|
|
|
/**
|
|
* Answers a question with the permissions of the user in the context.
|
|
*
|
|
* @param ctx the context of the user that asked, for one team.
|
|
* @param question the question.
|
|
* @returns the answer and its source documents.
|
|
*/
|
|
answer(ctx: Context, question: string): Promise<ChatAnswer>;
|
|
}
|