feat(Vercel AI SDK): add a param in config called host (#2634)
Co-authored-by: Saket Aryan <94069182+whysosaket@users.noreply.github.com>
This commit is contained in:
co-authored by
Saket Aryan
parent
a6a3928091
commit
8e8f13a48e
@@ -26,6 +26,7 @@ export interface Mem0ConfigSettings {
|
||||
threshold?: number;
|
||||
rerank?: boolean;
|
||||
enable_graph?: boolean;
|
||||
host?: string;
|
||||
output_format?: string;
|
||||
filter_memories?: boolean;
|
||||
}
|
||||
|
||||
@@ -115,7 +115,8 @@ const searchInternalMemories = async (query: string, config?: Mem0ConfigSettings
|
||||
}),
|
||||
};
|
||||
|
||||
const response = await fetch('https://api.mem0.ai/v2/memories/search/', options);
|
||||
const baseUrl = config?.host || 'https://api.mem0.ai';
|
||||
const response = await fetch(`${baseUrl}/v2/memories/search/`, options);
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP error! status: ${response.status}`);
|
||||
}
|
||||
@@ -160,7 +161,8 @@ const updateMemories = async (messages: Array<Message>, config?: Mem0ConfigSetti
|
||||
body: JSON.stringify({messages, ...config}),
|
||||
};
|
||||
|
||||
const response = await fetch('https://api.mem0.ai/v1/memories/', options);
|
||||
const baseUrl = config?.host || 'https://api.mem0.ai';
|
||||
const response = await fetch(`${baseUrl}/v1/memories/`, options);
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP error! status: ${response.status}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user