Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/0.3.2.1 #727

Merged
merged 2 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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