Skip to content

Commit

Permalink
Feat/0.3.2.1 (#727)
Browse files Browse the repository at this point in the history
  • Loading branch information
zgqgit committed Jul 3, 2024
2 parents 433db1b + 18aa222 commit a3d5205
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
12 changes: 9 additions & 3 deletions src/backend/bisheng/utils/embedding.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import httpx
from bisheng.settings import settings
from bisheng_langchain.embeddings import CustomHostEmbedding, HostEmbeddings

from langchain_openai import AzureOpenAIEmbeddings
from langchain.embeddings.base import Embeddings
from langchain_community.utils.openai import is_openai_v1
from langchain_openai.embeddings import OpenAIEmbeddings

from bisheng.settings import settings
from bisheng_langchain.embeddings import CustomHostEmbedding, HostEmbeddings


def decide_embeddings(model: str) -> Embeddings:
"""embed method"""
Expand All @@ -15,7 +18,10 @@ def decide_embeddings(model: str) -> Embeddings:
if is_openai_v1() and params.get('openai_proxy'):
params['http_client'] = httpx.Client(proxies=params.get('openai_proxy'))
params['http_async_client'] = httpx.AsyncClient(proxies=params.get('openai_proxy'))
return OpenAIEmbeddings(**params)
if params.get('openai_api_type') in ("azure", "azure_ad", "azuread"):
return AzureOpenAIEmbeddings(**params)
else:
return OpenAIEmbeddings(**params)
elif component == 'custom':
return CustomHostEmbedding(**params)
else:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ export default function MessagePanne({ useName, guideWord, loadMore }) {
} else if (msg.files?.length) {
type = 'file'
} else if (['tool', 'flow', 'knowledge'].includes(msg.category)
|| msg.category === 'processing') { // 项目演示?
// || msg.category === 'processing'
) { // 项目演示?
type = 'runLog'
} else if (msg.thought) {
type = 'system'
Expand Down

0 comments on commit a3d5205

Please sign in to comment.