mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-19 06:30:10 +08:00
* fix: update EmbeddingsFactory to use net.fetch and refactor KnowledgeService to use ModernAiProvider * fix: remove deprecated @langchain/community dependency from package.json * fix: add @langchain/community dependency to package.json and update yarn.lock
18 lines
805 B
Diff
Vendored
18 lines
805 B
Diff
Vendored
diff --git a/dist/embeddings.js b/dist/embeddings.js
|
|
index 6f4b928d3e4717309382e1b5c2e31ab5bc6c5af0..bc79429c88a6d27d4997a2740c4d8ae0707f5991 100644
|
|
--- a/dist/embeddings.js
|
|
+++ b/dist/embeddings.js
|
|
@@ -94,9 +94,11 @@ var OpenAIEmbeddings = class extends Embeddings {
|
|
* @returns Promise that resolves to an embedding for the document.
|
|
*/
|
|
async embedQuery(text) {
|
|
+ const isBaiduCloud = this.clientConfig.baseURL.includes('baidubce.com');
|
|
+ const input = this.stripNewLines ? text.replace(/\n/g, " ") : text
|
|
const params = {
|
|
model: this.model,
|
|
- input: this.stripNewLines ? text.replace(/\n/g, " ") : text
|
|
+ input: isBaiduCloud ? [input] : input
|
|
};
|
|
if (this.dimensions) params.dimensions = this.dimensions;
|
|
if (this.encodingFormat) params.encoding_format = this.encodingFormat;
|