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