Update OpenAI embedding handling for both list and base64 embeddings

- Fix OpenAI embedding array parsing
- Improve embedding data type safety
This commit is contained in:
yangdx
2025-08-09 08:40:33 +08:00
parent cf064579ce
commit ecd7777e61
2 changed files with 3 additions and 1 deletions

1
.gitignore vendored
View File

@@ -70,4 +70,5 @@ gui/
test_*
# Cline files
memory-bank
memory-bank/

View File

@@ -477,7 +477,8 @@ async def openai_embed(
)
return np.array(
[
np.frombuffer(base64.b64decode(dp.embedding), dtype=np.float32)
np.array(dp.embedding, dtype=np.float32) if isinstance(dp.embedding, list)
else np.frombuffer(base64.b64decode(dp.embedding), dtype=np.float32)
for dp in response.data
]
)