Skip to content

Commit 4a97a22

Browse files
committed
init EVA-mobile V1.0.0
1 parent 1bb8e62 commit 4a97a22

142 files changed

Lines changed: 18210 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

eva-mobile/.gitignore

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Learn more https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files
2+
3+
# dependencies
4+
node_modules/
5+
6+
# Expo
7+
.expo/
8+
dist/
9+
web-build/
10+
expo-env.d.ts
11+
12+
# Native
13+
.kotlin/
14+
*.orig.*
15+
*.jks
16+
*.p8
17+
*.p12
18+
*.key
19+
*.mobileprovision
20+
21+
# Metro
22+
.metro-health-check*
23+
24+
# debug
25+
npm-debug.*
26+
yarn-debug.*
27+
yarn-error.*
28+
29+
# macOS
30+
.DS_Store
31+
*.pem
32+
33+
# local env files
34+
.env*.local
35+
36+
# typescript
37+
*.tsbuildinfo
38+
39+
app-example
40+
/ios
41+
/android/**/*.keystore
42+
**/*/android/build
43+
44+
.idea
45+
**/.gradle/
46+
**/android/build
47+
48+
.vscode
49+
.env

eva-mobile/README-zh.md

Lines changed: 188 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,188 @@
1+
# EVA Mobile - EVA OS 多模态大模型示例
2+
3+
[![React Native](https://img.shields.io/badge/React_Native-0.81.4-blue.svg)](https://reactnative.dev/)
4+
[![Expo](https://img.shields.io/badge/Expo-54-black.svg)](https://expo.dev/)
5+
[![EVA OS](https://img.shields.io/badge/Powered_by-EVA_OS-purple.svg)](https://github.com/autoark)
6+
[![License](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
7+
8+
**EVA Mobile****EVA OS** 的官方移动端开源示例应用,专为展示 EVA OS 强大的**实时多模态(语音 + 视频)大模型**能力而构建。
9+
10+
作为一个开源参考实现,本项目展示了如何将移动端应用(基于 React Native)无缝接入 EVA OS 服务,实现低延迟、高互动的 AI 体验。
11+
12+
---
13+
14+
## 🌟 核心特性:EVA OS 能力展示
15+
16+
EVA OS 是**专为新一代硬件打造的开源·多模态·低延迟实时AI Agent引擎**。本项目通过直观的移动端体验,演示了 EVA OS 如何让 AI 不仅能"听"和"看",还能实时地以语音和视频与用户进行自然交互。
17+
18+
- **🗣️ 实时全双工语音**
19+
毫秒级响应的语音交互,支持自然打断,体验如同真人面对面交谈。
20+
21+
- **👁️ 多模态视觉理解**
22+
通过手机摄像头实时传输视频流,EVA 模型能"看到"你的环境、表情和动作,并将其融入对话上下文。
23+
24+
- **🎥 实时视频流**
25+
支持接收 EVA 服务生成的实时视频流,提供沉浸式的面对面交流感。
26+
27+
## 🔌 连接流程详解
28+
29+
本项目演示了客户端如何与 **LiveKit** 实时音视频服务对接。以下是标准的对接流程说明:
30+
31+
### 1. 获取服务凭证 (API Key & Token)
32+
33+
在连接 LiveKit 之前,你需要完成身份认证流程:
34+
35+
1. **获取 API Key**:
36+
前往 [EVA Console](https://eva.autoarkai.com) 创建一个 **Solution**,在 Solution 详情页中你将获得 API Key。
37+
38+
2. **请求房间 Token**:
39+
客户端不能直接使用 API Key 连接。你需要向你的业务后端(调用 EVA 服务 API)发起请求,使用 API Key 换取一个**有时效性的房间 Token**(Room Token)。
40+
41+
### 2. 标准连接时序
42+
43+
客户端与 LiveKit 的连接遵循标准的 Token 认证机制。无论你使用何种客户端框架,流程均一致:
44+
45+
1. **请求 Token**
46+
客户端 -> 业务后端 (EVA API) -> 返回 Room Token。
47+
48+
2. **建立连接**
49+
客户端使用获取到的 `Room Token` 和 LiveKit 服务器地址 (`WebSocket URL`) 初始化连接对象。
50+
51+
* **WebSocket URL**: 你的 LiveKit 实例地址(如 `wss://rtc.autoarkai.com`)。
52+
* **Token**: 从步骤 1 获取的 JWT 字符串。
53+
54+
3. **发布与订阅**
55+
连接成功后,客户端即可加入房间(Room),发布本地的麦克风/摄像头流(Publish),并订阅 AI 模型的音视频流(Subscribe)。
56+
57+
### 3. 参考代码实现
58+
59+
我们提供了一个 `EvaClient` 工具类(位于 `lib/eva-client.ts`),用于简化 Token 的获取。以下展示了核心逻辑:
60+
61+
```typescript
62+
// lib/eva-client.ts (参考实现)
63+
import axios from 'axios';
64+
65+
export class EvaClient {
66+
constructor(
67+
public baseUrl: string,
68+
public wssUrl: string,
69+
public apiKey: string
70+
) {}
71+
72+
// 使用 API Key 换取 Room Token
73+
async getRoom() {
74+
const response = await axios.post(`${this.baseUrl}/api/solution/chat-room`, {}, {
75+
headers: {
76+
'Authorization': `Bearer ${this.apiKey}`,
77+
},
78+
});
79+
return response.data.data; // 返回 { roomId, roomToken }
80+
}
81+
}
82+
```
83+
84+
在 React 组件中使用:
85+
86+
```tsx
87+
import { LiveKitRoom } from '@livekit/react-native';
88+
import { EvaClient } from './lib/eva-client';
89+
import { useState, useEffect } from 'react';
90+
91+
export default function RoomConnect() {
92+
const [token, setToken] = useState("");
93+
94+
// 示例配置 (实际请使用环境变量)
95+
const client = new EvaClient(
96+
"https://eva.autoark.ai.com",
97+
"wss://rtc.autoarkai.com",
98+
"YOUR_API_KEY"
99+
);
100+
101+
useEffect(() => {
102+
const connect = async () => {
103+
const roomData = await client.getRoom();
104+
setToken(roomData.roomToken);
105+
};
106+
connect();
107+
}, []);
108+
109+
if (!token) return null;
110+
111+
return (
112+
<LiveKitRoom
113+
serverUrl={client.wssUrl}
114+
token={token}
115+
connect={true}
116+
audio={true}
117+
video={true}
118+
>
119+
<MyRoomView />
120+
</LiveKitRoom>
121+
);
122+
}
123+
```
124+
125+
## 🚀 快速开始
126+
127+
### 1. 环境准备
128+
129+
确保你的开发环境已安装:
130+
- [Node.js](https://nodejs.org/) & [pnpm](https://pnpm.io/)
131+
- **iOS**: Xcode (仅限 macOS)
132+
- **Android**: Android Studio
133+
134+
> 💡 详细的环境配置步骤(如 Android SDK、CocoaPods 等),请参考 React Native 官方文档:[Setting up the development environment](https://reactnative.dev/docs/environment-setup)
135+
136+
### 2. 获取代码与安装
137+
138+
```bash
139+
git clone https://github.com/autoark/eva.git
140+
cd examples/eva-mobile
141+
pnpm install
142+
```
143+
144+
### 3. 配置环境变量
145+
146+
在项目根目录下创建 `.env` 文件:
147+
148+
```bash
149+
# .env
150+
151+
# 必填:你的 EVA 服务 API 地址
152+
# 客户端将向此地址请求 Token
153+
EXPO_PUBLIC_BASE_URL=https://api.your-eva-service.com
154+
155+
# 必填:LiveKit WebSocket 地址
156+
# 请确保与 EVA 服务端配置的 LiveKit 实例一致
157+
EXPO_PUBLIC_WSS_URL=wss://your-livekit-instance.com
158+
```
159+
160+
### 4. 运行应用
161+
162+
由于本项目依赖 Native Modules (WebRTC, Audio, Camera),**必须构建 Development Build**,无法使用 Expo Go。
163+
164+
#### iOS 运行
165+
```bash
166+
# 启动 iOS 模拟器或真机
167+
pnpm ios
168+
```
169+
170+
#### Android 运行
171+
```bash
172+
# 启动 Android 模拟器或真机
173+
pnpm android
174+
```
175+
176+
## 🛠 技术栈
177+
178+
- **框架**: [React Native](https://reactnative.dev/) + [Expo](https://expo.dev/)
179+
- **实时通信**: WebRTC / [LiveKit](https://livekit.io/)
180+
- **UI**: [NativeWind](https://www.nativewind.dev/) / [react-native-reusables](https://reactnativereusables.com/)
181+
182+
## 🤝 贡献与支持
183+
184+
欢迎提交 Issue 或 Pull Request。如需获取 EVA 服务 API Key 或商业支持,请访问我们的官网或联系 AutoArk 团队。
185+
186+
## 📄 许可证
187+
188+
[MIT License](LICENSE)

eva-mobile/android/.gitignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# OSX
2+
#
3+
.DS_Store
4+
5+
# Android/IntelliJ
6+
#
7+
build/
8+
.idea
9+
.gradle
10+
local.properties
11+
*.iml
12+
*.hprof
13+
.cxx/
14+
15+
# Bundle artifacts
16+
*.jsbundle

0 commit comments

Comments
 (0)