Skip to content

Commit 1f449bb

Browse files
committed
add topic names to AI requests
1 parent a0abfa8 commit 1f449bb

1 file changed

Lines changed: 14 additions & 9 deletions

File tree

src/infranodus/index.ts

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -554,9 +554,9 @@ class InfraNodus {
554554
: topics
555555
.map(
556556
(topic: any) =>
557-
`"[cluster ${topic.id}]: ${topic.words
558-
.slice(0, 9)
559-
.join(", ")}"`
557+
`"[cluster ${topic.id}]: ${
558+
topic.aiName ? topic.aiName + " — " : ""
559+
}${topic.words.slice(0, 9).join(", ")}"`
560560
)
561561
.join(" and ");
562562

@@ -593,9 +593,9 @@ class InfraNodus {
593593
const conceptsInTopics = topics
594594
.map(
595595
(topic: any) =>
596-
`{topic: ${topic.id}, concepts: "${topic.words
597-
.slice(0, 9)
598-
.join(", ")}"}`
596+
`{topic: ${topic.id}${
597+
topic.aiName ? `, name: "${topic.aiName}"` : ""
598+
}, concepts: "${topic.words.slice(0, 9).join(", ")}"}`
599599
)
600600
.join(" | ");
601601

@@ -648,7 +648,9 @@ class InfraNodus {
648648
return (
649649
"[cluster " +
650650
topic.id +
651-
']:"\n' +
651+
"]" +
652+
(topic.aiName ? ' "' + topic.aiName + '"' : "") +
653+
':"\n' +
652654
topic.words.slice(0, 9).join(", ") +
653655
'":\n ' +
654656
statements.join(" ") +
@@ -818,6 +820,7 @@ class InfraNodus {
818820
type?: string;
819821
source?: string;
820822
modal?: string;
823+
requestMode?: string;
821824
}) {
822825
if (!params.language) params.language = "en";
823826

@@ -831,7 +834,7 @@ class InfraNodus {
831834
chatPrompt.push({ role: "user", content: simplePrompt });
832835
}
833836
// console.log("Generate advice with", SETTINGS.AI_MODEL);
834-
return await this.genericPost("api/v1/aiAdvice", {
837+
const body: any = {
835838
mode: infraNodusInquiryMode ?? "",
836839
type: params.type ?? "",
837840
prompt: chatPrompt.length > 0 ? chatPrompt : simplePrompt,
@@ -843,7 +846,9 @@ class InfraNodus {
843846
app: "obsidian_plugin",
844847
source: params.source ?? "",
845848
modal: params.modal ?? "",
846-
});
849+
};
850+
if (params.requestMode) body.requestMode = params.requestMode;
851+
return await this.genericPost("api/v1/aiAdvice", body);
847852
}
848853

849854
// public static async generateTopics(text: string) {

0 commit comments

Comments
 (0)