MCPcopy
hub / github.com/di-sukharev/opencommit / FlowiseEngine

Class FlowiseEngine

src/engine/flowise.ts:9–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7interface FlowiseAiConfig extends AiEngineConfig {}
8
9export class FlowiseEngine implements AiEngine {
10 config: FlowiseAiConfig;
11 client: AxiosInstance;
12
13 constructor(config) {
14 this.config = config;
15 this.client = axios.create({
16 url: `${config.baseURL}/${config.apiKey}`,
17 headers: { 'Content-Type': 'application/json' }
18 });
19 }
20
21 async generateCommitMessage(
22 messages: Array<OpenAI.Chat.Completions.ChatCompletionMessageParam>
23 ): Promise<string | undefined> {
24 const gitDiff = (messages[messages.length - 1]?.content as string)
25 .replace(/\\/g, '\\\\')
26 .replace(/"/g, '\\"')
27 .replace(/\n/g, '\\n')
28 .replace(/\r/g, '\\r')
29 .replace(/\t/g, '\\t');
30
31 const payload = {
32 question: gitDiff,
33 overrideConfig: {
34 systemMessagePrompt: messages[0]?.content
35 },
36 history: messages.slice(1, -1)
37 };
38 try {
39 const response = await this.client.post('', payload);
40 const message = response.data;
41 let content = message?.text;
42 return removeContentTags(content, 'think');
43 } catch (error) {
44 throw normalizeEngineError(error, 'flowise', this.config.model);
45 }
46 }
47}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…