-
Notifications
You must be signed in to change notification settings - Fork 11
[CM-1083] Create project structure #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
11a65fd
[CM-1084] Create project structure
osugikoji 1756c6a
Remove credentials
osugikoji 00281f1
Remove space
osugikoji 18e367d
Change applicationid sample name
osugikoji d314e7e
Add readme description and apache license
osugikoji 76a4180
Increment kotlin version and fix build error on iOS sample
osugikoji c5cedd6
Code review adjustments
osugikoji File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
*.iml | ||
.gradle | ||
/local.properties | ||
.idea | ||
.DS_Store | ||
/build | ||
*/build | ||
/captures | ||
.externalNativeBuild | ||
.cxx | ||
xcuserdata |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,23 @@ | ||
# chatgpt-sdk | ||
ChatGPT SDK | ||
# YChatGPT (Working in Progress 🚧) | ||
|
||
ChatGPT is a large language model developed by OpenAI that is trained to generate human-like text based on a given prompt or context. | ||
|
||
YChatGPT aims to abstract all API call logic from ChatGPT for multiple platforms. | ||
|
||
## License | ||
|
||
``` | ||
Copyright 2023 YChatGPT | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
plugins { | ||
id("com.android.application") | ||
kotlin("android") | ||
} | ||
|
||
android { | ||
namespace = "co.yml.ychatgpt.android" | ||
compileSdk = Config.COMPILE_SDK_VERSION | ||
defaultConfig { | ||
applicationId = "co.yml.ychatgpt.android" | ||
minSdk = Config.MIN_SDK_VERSION | ||
targetSdk = Config.TARGET_SDK_VERSION | ||
versionCode = 1 | ||
versionName = "1.0" | ||
} | ||
|
||
buildFeatures { | ||
compose = true | ||
} | ||
|
||
composeOptions { | ||
kotlinCompilerExtensionVersion = "1.3.2" | ||
} | ||
|
||
packagingOptions { | ||
resources { | ||
excludes += "/META-INF/{AL2.0,LGPL2.1}" | ||
} | ||
} | ||
|
||
buildTypes { | ||
getByName("release") { | ||
isMinifyEnabled = false | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation(project(":chat-gpt")) | ||
implementation(Dependencies.UI.COMPOSE_UI) | ||
implementation(Dependencies.UI.COMPOSE_TOOLING) | ||
implementation(Dependencies.UI.COMPOSE_TOOLING_PREVIEW) | ||
implementation(Dependencies.UI.COMPOSE_FOUNDATION) | ||
implementation(Dependencies.UI.COMPOSE_MATERIAL) | ||
implementation(Dependencies.UI.COMPOSE_ACTIVITY) | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> | ||
|
||
<application | ||
android:allowBackup="false" | ||
android:supportsRtl="true" | ||
android:theme="@style/AppTheme"> | ||
<activity | ||
android:name="co.yml.ychatgpt.android.MainActivity" | ||
android:exported="true"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
</application> | ||
</manifest> |
42 changes: 42 additions & 0 deletions
42
android-sample/src/main/java/co/yml/ychatgpt/android/MainActivity.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package co.yml.ychatgpt.android | ||
|
||
import android.os.Bundle | ||
import androidx.activity.ComponentActivity | ||
import androidx.activity.compose.setContent | ||
import androidx.compose.foundation.layout.fillMaxSize | ||
import androidx.compose.material.MaterialTheme | ||
import androidx.compose.material.Surface | ||
import androidx.compose.material.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.tooling.preview.Preview | ||
|
||
class MainActivity : ComponentActivity() { | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContent { | ||
MyApplicationTheme { | ||
Surface( | ||
modifier = Modifier.fillMaxSize(), | ||
color = MaterialTheme.colors.background | ||
) { | ||
GreetingView("Hello world") | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
@Composable | ||
fun GreetingView(text: String) { | ||
Text(text = text) | ||
} | ||
|
||
@Preview | ||
@Composable | ||
fun DefaultPreview() { | ||
MyApplicationTheme { | ||
GreetingView("Hello, Android!") | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
android-sample/src/main/java/co/yml/ychatgpt/android/MyApplicationTheme.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package co.yml.ychatgpt.android | ||
|
||
import androidx.compose.foundation.isSystemInDarkTheme | ||
import androidx.compose.foundation.shape.RoundedCornerShape | ||
import androidx.compose.material.MaterialTheme | ||
import androidx.compose.material.Shapes | ||
import androidx.compose.material.Typography | ||
import androidx.compose.material.darkColors | ||
import androidx.compose.material.lightColors | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.text.TextStyle | ||
import androidx.compose.ui.text.font.FontFamily | ||
import androidx.compose.ui.text.font.FontWeight | ||
import androidx.compose.ui.unit.dp | ||
import androidx.compose.ui.unit.sp | ||
|
||
@Composable | ||
fun MyApplicationTheme( | ||
darkTheme: Boolean = isSystemInDarkTheme(), | ||
content: @Composable () -> Unit | ||
) { | ||
val colors = if (darkTheme) { | ||
darkColors( | ||
primary = Color(0xFFBB86FC), | ||
primaryVariant = Color(0xFF3700B3), | ||
secondary = Color(0xFF03DAC5) | ||
) | ||
} else { | ||
lightColors( | ||
primary = Color(0xFF6200EE), | ||
primaryVariant = Color(0xFF3700B3), | ||
secondary = Color(0xFF03DAC5) | ||
) | ||
} | ||
val typography = Typography( | ||
body1 = TextStyle( | ||
fontFamily = FontFamily.Default, | ||
fontWeight = FontWeight.Normal, | ||
fontSize = 16.sp | ||
) | ||
) | ||
val shapes = Shapes( | ||
small = RoundedCornerShape(4.dp), | ||
medium = RoundedCornerShape(4.dp), | ||
large = RoundedCornerShape(0.dp) | ||
) | ||
|
||
MaterialTheme( | ||
colors = colors, | ||
typography = typography, | ||
shapes = shapes, | ||
content = content | ||
) | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<resources> | ||
<style name="AppTheme" parent="android:Theme.Material.NoActionBar"/> | ||
</resources> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
plugins { | ||
//trick: for the same plugin versions in all sub-modules | ||
id("com.android.application").version(Versions.GRADLE_PLUGIN).apply(false) | ||
id("com.android.library").version(Versions.GRADLE_PLUGIN).apply(false) | ||
kotlin("android").version(Versions.KOTLIN).apply(false) | ||
kotlin("multiplatform").version(Versions.KOTLIN).apply(false) | ||
} | ||
|
||
tasks.register("clean", Delete::class) { | ||
delete(rootProject.buildDir) | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
plugins { | ||
`kotlin-dsl` | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
object Config { | ||
const val COMPILE_SDK_VERSION = 33 | ||
const val MIN_SDK_VERSION = 23 | ||
const val TARGET_SDK_VERSION = 33 | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
object Versions { | ||
const val GRADLE_PLUGIN = "7.3.0" | ||
const val DOKKA_PLUGIN = "1.7.20" | ||
const val KOTLIN = "1.7.20" | ||
const val COMPOSE = "1.3.3" | ||
const val COMPOSE_FOUNDATION = "1.3.1" | ||
const val COMPOSE_ACTIVITY = "1.6.1" | ||
const val KTOR = "2.2.2" | ||
const val KOIN = "3.2.0" | ||
const val MATERIAL_DESIGN = "1.6.1" | ||
} | ||
|
||
object Dependencies { | ||
|
||
object Network { | ||
const val KTOR_NEGOTIATION = "io.ktor:ktor-client-content-negotiation:${Versions.KTOR}" | ||
const val KTOR_SERIALIZATION = "io.ktor:ktor-serialization-kotlinx-json:${Versions.KTOR}" | ||
const val KTOR_CORE = "io.ktor:ktor-client-core:${Versions.KTOR}" | ||
const val KTOR_LOGGING = "io.ktor:ktor-client-logging:${Versions.KTOR}" | ||
const val KTOR_ANDROID = "io.ktor:ktor-client-android:${Versions.KTOR}" | ||
const val KTOR_IOS = "io.ktor:ktor-client-ios:${Versions.KTOR}" | ||
} | ||
|
||
object DI { | ||
const val KOIN_CORE = "io.insert-koin:koin-core:${Versions.KOIN}" | ||
} | ||
|
||
object UI { | ||
const val MATERIAL_DESIGN = "com.google.android.material:${Versions.MATERIAL_DESIGN}" | ||
const val COMPOSE_UI = "androidx.activity:activity-compose:${Versions.COMPOSE}" | ||
const val COMPOSE_TOOLING = "androidx.compose.ui:ui-tooling:${Versions.COMPOSE}" | ||
const val COMPOSE_TOOLING_PREVIEW = "androidx.compose.ui:ui-tooling-preview:${Versions.COMPOSE}" | ||
const val COMPOSE_FOUNDATION = "androidx.compose.foundation:foundation:${Versions.COMPOSE_FOUNDATION}" | ||
const val COMPOSE_MATERIAL = "androidx.compose.material:material:${Versions.COMPOSE_FOUNDATION}" | ||
const val COMPOSE_ACTIVITY = "androidx.activity:activity-compose:${Versions.COMPOSE_ACTIVITY}" | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.