mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-13 16:59:05 +08:00
fix: embedding get price definition missing (#922)
This commit is contained in:
parent
0a0d63457d
commit
3a0a9e2d8f
@ -379,7 +379,7 @@ class IndexingRunner:
|
|||||||
return {
|
return {
|
||||||
"total_segments": total_segments,
|
"total_segments": total_segments,
|
||||||
"tokens": tokens,
|
"tokens": tokens,
|
||||||
"total_price": '{:f}'.format(embedding_model.get_token_price(tokens)),
|
"total_price": '{:f}'.format(embedding_model.calc_tokens_price(tokens)),
|
||||||
"currency": embedding_model.get_currency(),
|
"currency": embedding_model.get_currency(),
|
||||||
"preview": preview_texts
|
"preview": preview_texts
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ class BaseEmbedding(BaseProviderModel):
|
|||||||
logger.debug(f"model: {self.name} price_config: {self._price_config}")
|
logger.debug(f"model: {self.name} price_config: {self._price_config}")
|
||||||
return self._price_config
|
return self._price_config
|
||||||
|
|
||||||
def calc_tokens_price(self, tokens:int) -> decimal.Decimal:
|
def calc_tokens_price(self, tokens: int) -> decimal.Decimal:
|
||||||
"""
|
"""
|
||||||
calc tokens total price.
|
calc tokens total price.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user