@umituz/react-native-ai-gemini-provider 3.0.39 → 3.0.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-ai-gemini-provider",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.41",
|
|
4
4
|
"description": "Google Gemini AI text generation provider for React Native applications",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -47,9 +47,6 @@
|
|
|
47
47
|
"@google/generative-ai": "^0.21.0",
|
|
48
48
|
"@react-native-async-storage/async-storage": "^2.2.0",
|
|
49
49
|
"@react-native-community/slider": "^5.1.1",
|
|
50
|
-
"@react-navigation/bottom-tabs": "^7.9.0",
|
|
51
|
-
"@react-navigation/native": "^7.1.26",
|
|
52
|
-
"@react-navigation/stack": "^7.6.13",
|
|
53
50
|
"@tanstack/react-query": "^5.90.16",
|
|
54
51
|
"@types/react": "~19.1.10",
|
|
55
52
|
"@typescript-eslint/eslint-plugin": "^7.0.0",
|
|
@@ -3,27 +3,14 @@
|
|
|
3
3
|
* Reusable functions for text length and character budget calculations
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
* Calculate total character count in an array of text objects
|
|
8
|
-
* @param items - Array of objects with text content
|
|
9
|
-
* @param getText - Function to extract text from each item
|
|
10
|
-
* @returns Total character count
|
|
11
|
-
*/
|
|
12
|
-
export function calculateTotalChars<T>(
|
|
6
|
+
function calculateTotalChars<T>(
|
|
13
7
|
items: readonly T[],
|
|
14
8
|
getItemLength: (item: T) => number
|
|
15
9
|
): number {
|
|
16
10
|
return items.reduce((sum, item) => sum + getItemLength(item), 0);
|
|
17
11
|
}
|
|
18
12
|
|
|
19
|
-
|
|
20
|
-
* Check if adding an item would exceed the character budget
|
|
21
|
-
* @param currentTotal - Current total character count
|
|
22
|
-
* @param itemLength - Length of item to add
|
|
23
|
-
* @param maxBudget - Maximum allowed budget
|
|
24
|
-
* @returns true if within budget, false otherwise
|
|
25
|
-
*/
|
|
26
|
-
export function fitsWithinBudget(
|
|
13
|
+
function fitsWithinBudget(
|
|
27
14
|
currentTotal: number,
|
|
28
15
|
itemLength: number,
|
|
29
16
|
maxBudget: number
|
|
@@ -34,12 +21,6 @@ export function fitsWithinBudget(
|
|
|
34
21
|
/**
|
|
35
22
|
* Trim array to fit within character budget while keeping minimum items
|
|
36
23
|
* Keeps the last `minItems` regardless of budget, then adds as many as possible from the end
|
|
37
|
-
*
|
|
38
|
-
* @param items - Array to trim
|
|
39
|
-
* @param getItemLength - Function to get length of each item
|
|
40
|
-
* @param maxBudget - Maximum total length allowed
|
|
41
|
-
* @param minItems - Minimum number of items to keep (from the end)
|
|
42
|
-
* @returns Trimmed array
|
|
43
24
|
*/
|
|
44
25
|
export function trimArrayByCharBudget<T>(
|
|
45
26
|
items: readonly T[],
|