-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
157490e
commit 7e918cb
Showing
29 changed files
with
430 additions
and
33 deletions.
There are no files selected for viewing
This file contains 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,29 @@ | ||
# Miscellaneous | ||
*.class | ||
*.log | ||
*.pyc | ||
*.swp | ||
.DS_Store | ||
.atom/ | ||
.buildlog/ | ||
.history | ||
.svn/ | ||
migrate_working_dir/ | ||
|
||
# IntelliJ related | ||
*.iml | ||
*.ipr | ||
*.iws | ||
.idea/ | ||
|
||
# The .vscode folder contains launch configuration and tasks you configure in | ||
# VS Code which you may wish to be included in version control, so this line | ||
# is commented out by default. | ||
#.vscode/ | ||
|
||
# Flutter/Dart/Pub related | ||
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. | ||
/pubspec.lock | ||
**/doc/api/ | ||
.dart_tool/ | ||
build/ |
This file contains 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,10 @@ | ||
# This file tracks properties of this Flutter project. | ||
# Used by Flutter tool to assess capabilities and perform upgrades etc. | ||
# | ||
# This file should be version controlled and should not be manually edited. | ||
|
||
version: | ||
revision: "bae5e49bc2a867403c43b2aae2de8f8c33b037e4" | ||
channel: "[user-branch]" | ||
|
||
project_type: package |
This file contains 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 @@ | ||
## 0.0.1 | ||
|
||
* TODO: Describe initial release. |
This file contains 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 @@ | ||
TODO: Add your license here. |
This file contains 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,39 @@ | ||
<!-- | ||
This README describes the package. If you publish this package to pub.dev, | ||
this README's contents appear on the landing page for your package. | ||
For information about how to write a good package README, see the guide for | ||
[writing package pages](https://dart.dev/guides/libraries/writing-package-pages). | ||
For general information about developing packages, see the Dart guide for | ||
[creating packages](https://dart.dev/guides/libraries/create-library-packages) | ||
and the Flutter guide for | ||
[developing packages and plugins](https://flutter.dev/developing-packages). | ||
--> | ||
|
||
TODO: Put a short description of the package here that helps potential users | ||
know whether this package might be useful for them. | ||
|
||
## Features | ||
|
||
TODO: List what your package can do. Maybe include images, gifs, or videos. | ||
|
||
## Getting started | ||
|
||
TODO: List prerequisites and provide or point to information on how to | ||
start using the package. | ||
|
||
## Usage | ||
|
||
TODO: Include short and useful examples for package users. Add longer examples | ||
to `/example` folder. | ||
|
||
```dart | ||
const like = 'sample'; | ||
``` | ||
|
||
## Additional information | ||
|
||
TODO: Tell users more about the package: where to find more information, how to | ||
contribute to the package, how to file issues, what response they can expect | ||
from the package authors, and more. |
This file contains 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,4 @@ | ||
include: package:flutter_lints/flutter.yaml | ||
|
||
# Additional information about this file can be found at | ||
# https://dart.dev/guides/language/analysis-options |
This file contains 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 @@ | ||
library composite_calculator; | ||
|
||
/// A Calculator. | ||
class Calculator { | ||
/// Returns [value] plus 1. | ||
int addOne(int value) => value + 1; | ||
} |
36 changes: 36 additions & 0 deletions
36
composite_calculator/lib/models/lamina_engineering_constants_input.dart
This file contains 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,36 @@ | ||
class LaminaEngineeringConstantsInput { | ||
final double E1; | ||
final double E2; | ||
final double G12; | ||
final double nu12; | ||
final double layupAngle; | ||
|
||
LaminaEngineeringConstantsInput({ | ||
required this.E1, | ||
required this.E2, | ||
required this.G12, | ||
required this.nu12, | ||
required this.layupAngle, | ||
}); | ||
|
||
// Factory method to create an instance with default values | ||
factory LaminaEngineeringConstantsInput.withDefaults() { | ||
return LaminaEngineeringConstantsInput( | ||
E1: 150000, | ||
E2: 10000, | ||
G12: 5000, | ||
nu12: 0.3, | ||
layupAngle: 45, | ||
); | ||
} | ||
|
||
Map<String, dynamic> toJson() { | ||
return { | ||
'E1': E1, | ||
'E2': E2, | ||
'G12': G12, | ||
'nu12': nu12, | ||
'layup_angle': layupAngle, | ||
}; | ||
} | ||
} |
This file contains 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,54 @@ | ||
name: composite_calculator | ||
description: "A new Flutter package project." | ||
version: 0.0.1 | ||
homepage: | ||
|
||
environment: | ||
sdk: '>=3.3.0 <4.0.0' | ||
flutter: ">=1.17.0" | ||
|
||
dependencies: | ||
flutter: | ||
sdk: flutter | ||
|
||
dev_dependencies: | ||
flutter_test: | ||
sdk: flutter | ||
flutter_lints: ^3.0.0 | ||
|
||
# For information on the generic Dart part of this file, see the | ||
# following page: https://dart.dev/tools/pub/pubspec | ||
|
||
# The following section is specific to Flutter packages. | ||
flutter: | ||
|
||
# To add assets to your package, add an assets section, like this: | ||
# assets: | ||
# - images/a_dot_burr.jpeg | ||
# - images/a_dot_ham.jpeg | ||
# | ||
# For details regarding assets in packages, see | ||
# https://flutter.dev/assets-and-images/#from-packages | ||
# | ||
# An image asset can refer to one or more resolution-specific "variants", see | ||
# https://flutter.dev/assets-and-images/#resolution-aware | ||
|
||
# To add custom fonts to your package, add a fonts section here, | ||
# in this "flutter" section. Each entry in this list should have a | ||
# "family" key with the font family name, and a "fonts" key with a | ||
# list giving the asset and other descriptors for the font. For | ||
# example: | ||
# fonts: | ||
# - family: Schyler | ||
# fonts: | ||
# - asset: fonts/Schyler-Regular.ttf | ||
# - asset: fonts/Schyler-Italic.ttf | ||
# style: italic | ||
# - family: Trajan Pro | ||
# fonts: | ||
# - asset: fonts/TrajanPro.ttf | ||
# - asset: fonts/TrajanPro_Bold.ttf | ||
# weight: 700 | ||
# | ||
# For details regarding fonts in packages, see | ||
# https://flutter.dev/custom-fonts/#from-packages |
This file contains 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,12 @@ | ||
import 'package:flutter_test/flutter_test.dart'; | ||
|
||
import 'package:composite_calculator/composite_calculator.dart'; | ||
|
||
void main() { | ||
test('adds one to input values', () { | ||
final calculator = Calculator(); | ||
expect(calculator.addOne(2), 3); | ||
expect(calculator.addOne(-7), -6); | ||
expect(calculator.addOne(0), 1); | ||
}); | ||
} |
This file contains 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,4 +1,5 @@ | ||
export 'utils/network_exceptions.dart'; | ||
export 'data_sources/chat_remote_data_source.dart'; | ||
export 'data_sources/chat_completion_data_source.dart'; | ||
export 'repositories/chat_repository_impl.dart'; | ||
export 'repositories/chat_session_repository_imp.dart'; | ||
export "repositories/function_tools_repository_imp.dart"; |
This file contains 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
This file contains 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,86 @@ | ||
class ChatCompletion { | ||
String? id; | ||
String? object; | ||
int? created; | ||
String? model; | ||
String? systemFingerprint; | ||
List<Choices>? choices; | ||
|
||
ChatCompletion( | ||
{this.id, | ||
this.object, | ||
this.created, | ||
this.model, | ||
this.systemFingerprint, | ||
this.choices}); | ||
|
||
ChatCompletion.fromJson(Map<String, dynamic> json) { | ||
id = json['id']; | ||
object = json['object']; | ||
created = json['created']; | ||
model = json['model']; | ||
systemFingerprint = json['system_fingerprint']; | ||
if (json['choices'] != null) { | ||
choices = <Choices>[]; | ||
json['choices'].forEach((v) { | ||
choices!.add(new Choices.fromJson(v)); | ||
}); | ||
} | ||
} | ||
|
||
Map<String, dynamic> toJson() { | ||
final Map<String, dynamic> data = new Map<String, dynamic>(); | ||
data['id'] = this.id; | ||
data['object'] = this.object; | ||
data['created'] = this.created; | ||
data['model'] = this.model; | ||
data['system_fingerprint'] = this.systemFingerprint; | ||
if (this.choices != null) { | ||
data['choices'] = this.choices!.map((v) => v.toJson()).toList(); | ||
} | ||
return data; | ||
} | ||
} | ||
|
||
class Choices { | ||
int? index; | ||
Delta? delta; | ||
Null? logprobs; | ||
Null? finishReason; | ||
|
||
Choices({this.index, this.delta, this.logprobs, this.finishReason}); | ||
|
||
Choices.fromJson(Map<String, dynamic> json) { | ||
index = json['index']; | ||
delta = json['delta'] != null ? new Delta.fromJson(json['delta']) : null; | ||
logprobs = json['logprobs']; | ||
finishReason = json['finish_reason']; | ||
} | ||
|
||
Map<String, dynamic> toJson() { | ||
final Map<String, dynamic> data = new Map<String, dynamic>(); | ||
data['index'] = this.index; | ||
if (this.delta != null) { | ||
data['delta'] = this.delta!.toJson(); | ||
} | ||
data['logprobs'] = this.logprobs; | ||
data['finish_reason'] = this.finishReason; | ||
return data; | ||
} | ||
} | ||
|
||
class Delta { | ||
String? content; | ||
|
||
Delta({this.content}); | ||
|
||
Delta.fromJson(Map<String, dynamic> json) { | ||
content = json['content']; | ||
} | ||
|
||
Map<String, dynamic> toJson() { | ||
final Map<String, dynamic> data = new Map<String, dynamic>(); | ||
data['content'] = this.content; | ||
return data; | ||
} | ||
} |
This file contains 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,14 +1,15 @@ | ||
import 'package:domain/entities/function_tool.dart'; | ||
import 'package:domain/entities/message.dart'; | ||
import 'package:domain/repositories_abstract/chat_repository.dart'; | ||
import '../data_sources/chat_remote_data_source.dart'; | ||
import '../data_sources/chat_completion_data_source.dart'; | ||
|
||
class ChatRepositoryImp implements ChatRepository { | ||
final ChatRemoteDataSource remoteDataSource; | ||
final ChatCompletionsDataSource chatCompletionsDataSource; | ||
|
||
ChatRepositoryImp({required this.remoteDataSource}); | ||
ChatRepositoryImp({required this.chatCompletionsDataSource}); | ||
|
||
@override | ||
Stream<String> sendMessages(List<Message> messages) { | ||
return remoteDataSource.sendMessages(messages); | ||
Stream<String> sendMessages(List<Message> messages, List<FunctionTool> functionTools) { | ||
return chatCompletionsDataSource.sendMessages(messages, functionTools); | ||
} | ||
} |
Oops, something went wrong.