mirror of
https://github.com/ItzCrazyKns/Perplexica.git
synced 2025-12-14 15:48:15 +00:00
feat(ollama-llm): use hash to generate id
This commit is contained in:
@@ -161,8 +161,13 @@ class OllamaLLM extends BaseLLM<OllamaConfig> {
|
|||||||
yield {
|
yield {
|
||||||
contentChunk: chunk.message.content,
|
contentChunk: chunk.message.content,
|
||||||
toolCallChunk:
|
toolCallChunk:
|
||||||
chunk.message.tool_calls?.map((tc) => ({
|
chunk.message.tool_calls?.map((tc, i) => ({
|
||||||
id: crypto.randomUUID(),
|
id: crypto
|
||||||
|
.createHash('sha256')
|
||||||
|
.update(
|
||||||
|
`${i}-${tc.function.name}`,
|
||||||
|
) /* Ollama currently doesn't return a tool call ID so we're creating one based on the index and tool call name */
|
||||||
|
.digest('hex'),
|
||||||
name: tc.function.name,
|
name: tc.function.name,
|
||||||
arguments: tc.function.arguments,
|
arguments: tc.function.arguments,
|
||||||
})) || [],
|
})) || [],
|
||||||
|
|||||||
Reference in New Issue
Block a user