mirror of
https://github.com/RYDE-WORK/Langchain-Chatchat.git
synced 2026-02-01 11:53:24 +08:00
向量处理问题
This commit is contained in:
parent
7b6cc81ff5
commit
842a23006a
@ -228,7 +228,7 @@ class RESTFulOpenAIBootstrapBaseWeb(OpenAIBootstrapBaseWeb):
|
||||
model=embeddings_request.model,
|
||||
)
|
||||
|
||||
# 判断embeddings_request.input是否为list
|
||||
# 判断embeddings_request.input是否为list[int]
|
||||
input = ""
|
||||
if isinstance(embeddings_request.input, list):
|
||||
tokens = embeddings_request.input
|
||||
@ -241,8 +241,13 @@ class RESTFulOpenAIBootstrapBaseWeb(OpenAIBootstrapBaseWeb):
|
||||
model = "cl100k_base"
|
||||
encoding = tiktoken.get_encoding(model)
|
||||
for i, token in enumerate(tokens):
|
||||
text = encoding.decode(token)
|
||||
input += text
|
||||
# 判断是否是int
|
||||
if isinstance(token, int):
|
||||
text = encoding.decode(token)
|
||||
input += text
|
||||
else:
|
||||
input += token
|
||||
|
||||
|
||||
else:
|
||||
input = embeddings_request.input
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user