# JFAI-DEMO **Repository Path**: TQHub/jfai-demo ## Basic Information - **Project Name**: JFAI-DEMO - **Description**: 引用pandalib的demo工程 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: develop - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-04-23 - **Last Updated**: 2025-09-29 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # JFAI Demo 这是一个集成 AI 功能的 Android 应用示例项目,展示了如何通过本地或远程依赖引入 SDK,并快速集成到现有项目中。 --- ## 引入方式 1. **本地引用 AAR 包:** ```groovy implementation files('libs/pandalib-uat-release-fat.aar') ``` 2. **通过 Maven 引入:** ```groovy implementation "com.jiff.genius:hkcgis:1.0.0-SNAPSHOT" ``` 在 `build.gradle` 中配置阿里云私有仓库访问凭证: ```groovy allprojects { repositories { maven { url 'https://maven.aliyun.com/repository/public' } maven { credentials { username '636dc244368f47831055ea52' password 'Xr54s5TopP8o' } // SNAPSHOT 版本地址 url 'https://packages.aliyun.com/6808479fe3a71588779434b3/maven/2534445-snapshot-bpjgwe' // 正式版本地址 url 'https://packages.aliyun.com/6808479fe3a71588779434b3/maven/2534445-release-1c8ifp' } } } ``` --- ## 所需权限 请确保在 `AndroidManifest.xml` 中添加以下权限: ```xml ``` --- ## 使用方式 ### 添加依赖项 确保在 `build.gradle` 中添加以下依赖: ```groovy // OkHttp implementation 'com.squareup.okhttp3:okhttp:4.9.0' implementation 'com.squareup.okio:okio:3.8.0' implementation 'com.squareup.okhttp3:logging-interceptor:4.12.0' implementation 'com.squareup.okhttp3:okhttp-sse:4.12.0' // Retrofit implementation 'com.squareup.retrofit2:retrofit:2.9.0' implementation 'com.squareup.retrofit2:converter-gson:2.9.0' // Markdown 支持 implementation "io.noties.markwon:core:4.6.2" implementation "io.noties.markwon:ext-tables:4.6.2" // 生物识别 implementation "androidx.biometric:biometric:1.1.0" implementation 'androidx.core:core-ktx:1.10.1' // 图片支持 api "io.noties.markwon:image:4.6.2" // 微软语音识别 SDK api 'com.microsoft.cognitiveservices.speech:client-sdk:1.42.0' ``` ### 初始化 SDK 并打开主页面 在应用中初始化 SDK 并打开 AI 页面: ```kotlin // 初始化 SDK PandaAILibSDK.initialize(this) // 设置路由跳转监听器 HKPandaRouterUtils.pandaAIRouterListener = object : HKPandaRouterUtils.PandaAIRouterListener { override fun goRoute(path: String?) { // 跳转到 AI 页面 Toast.makeText(baseContext, "跳转AI页面: $path", Toast.LENGTH_SHORT).show() } } // 打开主页面,传入 member_id val primaryFragment = PrimaryFragment.newInstance("member_id", "") supportFragmentManager.beginTransaction() .add(R.id.container, primaryFragment) .commit() ``` --- ## 许可证 本项目遵循 MIT 许可证,请参阅 [LICENSE](LICENSE) 文件获取详细信息。