Skip to content

Commit

Permalink
Fix #452 and update llama.cpp (#517)
Browse files Browse the repository at this point in the history
* fix #452

* Update llama.cpp

* small changes
  • Loading branch information
danemadsen authored Apr 26, 2024
1 parent cd7d76d commit 823ff52
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 5 deletions.
2 changes: 2 additions & 0 deletions lib/providers/character.dart
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,8 @@ class Character extends ChangeNotifier {
return sha256.convert(bytes).toString();
}

Key get key => ValueKey(hash);

String get name => _name;

String get description => _description;
Expand Down
12 changes: 11 additions & 1 deletion lib/providers/user.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
import 'package:maid/static/utilities.dart';

class User extends ChangeNotifier {
Key _key = UniqueKey();
File? _profile;
String _name = "User";

Expand All @@ -12,7 +13,8 @@ class User extends ChangeNotifier {
}

User.from(User user) {
_profile = profileFile;
_key = user.key;
_profile = user.profileFile;
_name = user.name;
}

Expand All @@ -26,6 +28,8 @@ class User extends ChangeNotifier {

File? get profileFile => _profile;
String get name => _name;

Key get key => _key;

set profile(Future<File> value) {
value.then((File file) {
Expand Down Expand Up @@ -67,4 +71,10 @@ class User extends ChangeNotifier {
_name = "User";
notifyListeners();
}

@override
void notifyListeners() {
_key = UniqueKey();
super.notifyListeners();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ class _CharacterCustomizationPageState extends State<CharacterCustomizationPage>
children: [
const SizedBox(height: 10.0),
FutureAvatar(
key: character.key,
image: character.profile,
radius: 75,
),
Expand Down
3 changes: 2 additions & 1 deletion lib/ui/mobile/widgets/chat_widgets/chat_message.dart
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class _ChatMessageState extends State<ChatMessage> with SingleTickerProviderStat
children: [
const SizedBox(width: 10.0),
FutureAvatar(
key: node.role == ChatRole.user ? user.key : character.key,
image: node.role == ChatRole.user ? user.profile : character.profile,
radius: 16,
),
Expand Down Expand Up @@ -187,7 +188,7 @@ class _ChatMessageState extends State<ChatMessage> with SingleTickerProviderStat
IconButton(
padding: const EdgeInsets.all(0),
onPressed: () {
if (!context.watch<Session>().chat.tail.finalised) return;
if (!context.read<Session>().chat.tail.finalised) return;
setState(() {
editing = false;
});
Expand Down
1 change: 1 addition & 0 deletions lib/ui/mobile/widgets/tiles/character_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class CharacterTile extends StatelessWidget {
const SizedBox(height: 10.0),
ListTile(
leading: FutureAvatar(
key: character.key,
image: character.profile,
radius: 25,
),
Expand Down
3 changes: 2 additions & 1 deletion lib/ui/mobile/widgets/tiles/user_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class _UserTileState extends State<UserTile> {
),
),
leading: FutureAvatar(
key: user.key,
image: user.profile,
radius: 20,
),
Expand Down Expand Up @@ -156,7 +157,7 @@ class _UserTileState extends State<UserTile> {
FilledButton(
onPressed: () => Navigator.of(context).pop(),
child: Text(
"Cancel",
"Close",
style: Theme.of(context).textTheme.labelLarge,
),
),
Expand Down
2 changes: 1 addition & 1 deletion packages/maid_llm
Submodule maid_llm updated 1 files
+1 −1 src/llama_cpp
2 changes: 1 addition & 1 deletion packages/maid_ui

0 comments on commit 823ff52

Please sign in to comment.