mirror of
https://github.com/logancyang/obsidian-copilot.git
synced 2026-07-22 07:50:24 +00:00
Brevilabs CORS issue (#918)
* Add logging for time range query * Fix dupe system prompt for vault search * Use safefetch for brevilabs * Rename ribbon icon to Open Copilot Chat
This commit is contained in:
parent
a5e75b1947
commit
e49aafa393
5 changed files with 25 additions and 5 deletions
|
|
@ -1,7 +1,9 @@
|
|||
import { BREVILABS_API_BASE_URL } from "@/constants";
|
||||
import { Notice } from "obsidian";
|
||||
import { getSettings } from "@/settings/model";
|
||||
import { getDecryptedKey } from "@/encryptionService";
|
||||
import { getSettings } from "@/settings/model";
|
||||
import { safeFetch } from "@/utils";
|
||||
import { Notice } from "obsidian";
|
||||
|
||||
export interface BrocaResponse {
|
||||
response: {
|
||||
tool_calls: Array<{
|
||||
|
|
@ -88,7 +90,7 @@ export class BrevilabsClient {
|
|||
});
|
||||
}
|
||||
|
||||
const response = await fetch(url.toString(), {
|
||||
const response = await safeFetch(url.toString(), {
|
||||
method,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
|
|
|
|||
|
|
@ -302,6 +302,11 @@ class CopilotPlusChainRunner extends BaseChainRunner {
|
|||
content,
|
||||
});
|
||||
|
||||
// Add debug logging for final request
|
||||
if (debug) {
|
||||
console.log("==== Final Request to AI ====\n", messages);
|
||||
}
|
||||
|
||||
let fullAIResponse = "";
|
||||
const chatStream = await this.chainManager.chatModelManager.getChatModel().stream(messages);
|
||||
|
||||
|
|
@ -427,7 +432,7 @@ class CopilotPlusChainRunner extends BaseChainRunner {
|
|||
const qaPrompt = await this.chainManager.promptManager.getQAPrompt({
|
||||
question: standaloneQuestion,
|
||||
context: context,
|
||||
systemMessage: getSystemPrompt(),
|
||||
systemMessage: "", // System prompt is added separately in streamMultimodalResponse
|
||||
});
|
||||
|
||||
fullAIResponse = await this.streamMultimodalResponse(
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ export class IntentAnalyzer {
|
|||
indexTool,
|
||||
pomodoroTool,
|
||||
webSearchTool,
|
||||
simpleYoutubeTranscriptionTool,
|
||||
];
|
||||
|
||||
static async analyzeIntent(
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ export default class CopilotPlugin extends Plugin {
|
|||
},
|
||||
});
|
||||
|
||||
this.addRibbonIcon("message-square", "Copilot Chat", (evt: MouseEvent) => {
|
||||
this.addRibbonIcon("message-square", "Open Copilot Chat", (evt: MouseEvent) => {
|
||||
this.activateView();
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -246,6 +246,14 @@ export class HybridRetriever extends BaseRetriever {
|
|||
|
||||
const dateRange = this.generateDateRange(startDate, endDate);
|
||||
|
||||
if (this.debug) {
|
||||
console.log(
|
||||
"==== Daily note date range: ====",
|
||||
dateRange[0],
|
||||
dateRange[dateRange.length - 1]
|
||||
);
|
||||
}
|
||||
|
||||
// Perform the first search with title filter
|
||||
const dailyNoteResults = await this.getExplicitChunks(dateRange);
|
||||
|
||||
|
|
@ -258,6 +266,10 @@ export class HybridRetriever extends BaseRetriever {
|
|||
},
|
||||
}));
|
||||
|
||||
if (this.debug) {
|
||||
console.log("==== Modified and created time range: ====", startTimestamp, endTimestamp);
|
||||
}
|
||||
|
||||
// Perform a second search with time range filters
|
||||
searchParams.where = {
|
||||
ctime: { between: [startTimestamp, endTimestamp] },
|
||||
|
|
|
|||
Loading…
Reference in a new issue