Skip to content

Commit 8ac89b6

Browse files
committed
docs fixes v4
Signed-off-by: jakmro <kubamroz124@gmail.com>
1 parent 478068f commit 8ac89b6

7 files changed

Lines changed: 17 additions & 125 deletions

File tree

.github/assemble-docs.sh

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -35,28 +35,7 @@ cp android/README.md site_docs/android/README.md
3535
cp bindings/flutter/README.md site_docs/flutter/README.md
3636
cp bindings/swift/README.md site_docs/swift/README.md
3737
cp bindings/kotlin/README.md site_docs/kotlin/README.md
38-
39-
mkdir -p site_docs/react-native
40-
if curl -sfL "https://raw.githubusercontent.com/cactus-compute/cactus-react-native/main/README.md" -o site_docs/react-native/README.md; then
41-
42-
{
43-
echo '!!! info "Independent release cycle"'
44-
echo ' The React Native binding releases independently from the Cactus engine.'
45-
echo ' Check the [releases page](https://github.com/cactus-compute/cactus-react-native/releases) for the latest compatible version.'
46-
echo ''
47-
cat site_docs/react-native/README.md
48-
} > site_docs/react-native/README.tmp && mv site_docs/react-native/README.tmp site_docs/react-native/README.md
49-
50-
mkdir -p site_docs/react-native/assets
51-
curl -sfL "https://raw.githubusercontent.com/cactus-compute/cactus-react-native/main/assets/logo.png" -o site_docs/react-native/assets/logo.png 2>/dev/null || true
52-
echo "Fetched React Native README"
53-
else
54-
echo "# React Native Binding" > site_docs/react-native/README.md
55-
echo "" >> site_docs/react-native/README.md
56-
echo "See [cactus-react-native on GitHub](https://github.com/cactus-compute/cactus-react-native) for full documentation." >> site_docs/react-native/README.md
57-
echo "Warning: Could not fetch React Native README, using fallback"
58-
fi
59-
38+
cp bindings/react-native/README.md site_docs/react-native/README.md
6039
cp bindings/rust/README.md site_docs/rust/README.md
6140

6241
if [ -d blog ] && ls blog/*.md >/dev/null 2>&1; then

apple/CmakeLists.txt

Lines changed: 0 additions & 66 deletions
This file was deleted.

bindings/react-native/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@ Native bridge modules over the cactus C API for iOS and Android.
44

55
## Integration
66

7+
<!-- --8<-- [start:install] -->
78
```bash
89
cactus build --apple
910
cactus build --android
1011
```
12+
<!-- --8<-- [end:install] -->
1113

14+
<!-- --8<-- [start:integration] -->
1215
1. Add the bridge files from this folder to your React Native app
1316
2. Add the raw bindings they depend on: [`bindings/kotlin/`](/bindings/kotlin/) (Android), [`bindings/swift/`](/bindings/swift/) (Apple)
1417
3. Register the Android package in `MainApplication.kt`:
@@ -17,13 +20,16 @@ cactus build --android
1720
add(com.cactus.reactnative.CactusPackage())
1821
}
1922
```
23+
<!-- --8<-- [end:integration] -->
2024

2125
## Usage
2226

27+
<!-- --8<-- [start:example] -->
2328
```ts
2429
import Cactus from './index';
2530

2631
const handle = await Cactus.init('/path/to/model', null, false);
2732
const result = await Cactus.complete(handle, messagesJson, null, null, null);
2833
await Cactus.destroy(handle);
2934
```
35+
<!-- --8<-- [end:example] -->

blog/gemma4.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,12 @@ Cactus supports React Native, Flutter, Swift, Kotlin, Python, Rust, and C++. Pic
126126

127127
| Platform | Binding | Install |
128128
|---|---|---|
129-
| React Native | [cactus-react-native](https://github.com/cactus-compute/cactus-react-native) | `npm install cactus-react-native` |
129+
| React Native | [React Native bindings](https://cactus.dev/react-native/) | Native bridge over the C API |
130130
| Flutter | [cactus-flutter](https://cactus.dev/flutter/) | Dart FFI bindings |
131131
| Swift (iOS/macOS) | [cactus-swift](https://cactus.dev/swift/) | XCFramework with NPU support |
132132
| Kotlin (Android) | [cactus-kotlin](https://cactus.dev/kotlin/) | JNI + Kotlin Multiplatform |
133133
| Python | [cactus-ai](https://cactus.dev/python/) | `pip install cactus-ai` |
134-
| Rust | [cactus-sys](https://cactus.dev/rust/) | `cargo add cactus-sys` |
134+
| Rust | [Rust bindings](https://cactus.dev/rust/) | Copy `cactus.rs`, link `libcactus.a` |
135135
| C++ | [cactus.h](https://cactus.dev/docs/cactus_engine/) | Single header, link `libcactus.a` |
136136

137137
Full quickstart with code examples for every binding: [cactus.dev/docs/quickstart](https://cactus.dev/docs/quickstart/)

blog/parakeet.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ int main() {
205205

206206
### 6. Use the [Rust Binding](/bindings/rust/)
207207

208-
Add `cactus-sys` to your `Cargo.toml` and call the FFI bindings directly:
208+
Copy `cactus.rs` into your project (see [the README](/bindings/rust/)), link `libcactus.a` from `cactus build`, and call the FFI bindings directly:
209209

210210
```rust
211211
use std::ffi::CString;

docs/choose-bindings.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Pick the right one for your platform and use case:
3535

3636
## Binding Documentation
3737

38-
- **[React Native](https://github.com/cactus-compute/cactus-react-native)** -- npm package with React hooks (`useCactusLM`)
38+
- **[React Native](/bindings/react-native/)** -- Native bridge modules over the C API for iOS and Android
3939
- **[Python](/python/)** -- Module-level FFI bindings, mirrors the C API
4040
- **[Swift](/bindings/swift/)** -- XCFramework for iOS/macOS with NPU support
4141
- **[Kotlin](/bindings/kotlin/)** -- JNI bindings + Kotlin Multiplatform support

docs/quickstart.md

Lines changed: 6 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ Install Cactus and run your first on-device AI completion.
66

77
=== "React Native"
88

9-
```bash
10-
npm install cactus-react-native react-native-nitro-modules
11-
```
9+
--8<-- "react-native/README.md:install"
10+
11+
### Platform Integration
12+
13+
--8<-- "react-native/README.md:integration"
1214

1315
=== "Flutter"
1416

@@ -79,36 +81,7 @@ Install Cactus and run your first on-device AI completion.
7981

8082
=== "React Native"
8183

82-
```tsx
83-
import { useCactusLM } from 'cactus-react-native';
84-
85-
const App = () => {
86-
const cactusLM = useCactusLM();
87-
88-
useEffect(() => {
89-
if (!cactusLM.isDownloaded) {
90-
cactusLM.download();
91-
}
92-
}, []);
93-
94-
const handleGenerate = () => {
95-
cactusLM.complete({
96-
messages: [{ role: 'user', content: 'What is the capital of France?' }],
97-
});
98-
};
99-
100-
if (cactusLM.isDownloading) {
101-
return <Text>Downloading: {Math.round(cactusLM.downloadProgress * 100)}%</Text>;
102-
}
103-
104-
return (
105-
<>
106-
<Button onPress={handleGenerate} title="Generate" />
107-
<Text>{cactusLM.completion}</Text>
108-
</>
109-
);
110-
};
111-
```
84+
--8<-- "react-native/README.md:example"
11285

11386
=== "Flutter"
11487

0 commit comments

Comments
 (0)