Skip to content

Commit

Permalink
fix: models fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
lollipopkit committed Jan 9, 2025
1 parent 388f3bb commit fe14cb8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions lib/data/res/openai.dart
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,13 @@ abstract final class _ModelsCacher {
if (models_ != null) return models_;
}

final uri = Uri.parse(Cfg.current.url);
final endpoint = '${uri.scheme}://${uri.host}';
final endpoint = Cfg.current.url;
// For most compatibility, use dio instead of openai_dart
final url = switch (endpoint) {
_ when endpoint.startsWith('https://api.deepseek.com/beta') =>
_ when endpoint.startsWith('https://api.deepseek.com') =>
'https://api.deepseek.com/v1/models',
_ when endpoint.startsWith('https://models.inference.ai.azure.com') =>
'https://models.inference.ai.azure.com/models',
_ => '$endpoint/models',
};
final val = await myDio.get(
Expand Down
2 changes: 1 addition & 1 deletion lib/view/page/settings/profile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ final class _ProfilePageState extends State<ProfilePage>
);
if (ok != true) return;
final clipboardData = await Pfs.paste();
var (key, url) = ('', '');
var (key, url) = ('', ChatConfig.defaultUrl);
if (clipboardData != null) {
if (clipboardData.startsWith('https://')) {
url = clipboardData;
Expand Down

0 comments on commit fe14cb8

Please sign in to comment.