lollipopkit / lollipopkit/flutter_gpt_box

我不知道為什麼錯誤

Open
#272 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Dart
Stars
390
Forks
33
PR merge metrics
No merged PRs in 30d

Description

**描述BUG**

自己的轉發api出錯,電腦上的其他廠牌客戶端正常顯示

**截图**

**Log**

**设备** Android14 samsung s21

type 'String' is not a subtype of type 'num?' in type cast

```#0 _$$CreateChatCompletionStreamResponseImplFromJson (package:openai_dart/src/generated/schema/schema.g.dart:1015)
#1 new _$CreateChatCompletionStreamResponseImpl.fromJson (package:openai_dart/src/generated/schema/schema.freezed.dart:11330)
#2 _$CreateChatCompletionStreamResponseFromJson (package:openai_dart/src/generated/schema/schema.freezed.dart:11061)
#3 new CreateChatCompletionStreamResponse.fromJson (package:openai_dart/src/generated/schema/create_chat_completion_stream_response.dart:57)
#4 OpenAIClient.createChatCompletionStream. (package:openai_dart/src/client.dart:109)
#5 _MapStream._handleData (dart:async/stream_pipe.dart:247)
#6 _ForwardingStreamSubscription._handleData (dart:async/stream_pipe.dart:184)
#7 _rootRunUnary (dart:async/zone.dart:1538)
#8 _CustomZone.runUnary (dart:async/zone.dart:1429)
#9 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1329)
#10 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:381)
#11 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:312)
#12 _ForwardingStreamSubscription._add (dart:async/stream_pipe.dart:154)
#13 _MapStream._handleData (dart:async/stream_pipe.dart:252)
#14 _ForwardingStreamSubscription._handleData (dart:async/stream_pipe.dart:184)
#15 _rootRunUnary (dart:async/zone.dart:1538)
#16 _CustomZone.runUnary (dart:async/zone.dart:1429)
#17 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1329)
#18 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:381)
#19 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:312)
#20 _ForwardingStreamSubscription._add (dart:async/stream_pipe.dart:154)
#21 _WhereStream._handleData (dart:async/stream_pipe.dart:229)
#22 _ForwardingStreamSubscription._handleData (dart:async/stream_pipe.dart:184)
#23 _rootRunUnary (dart:async/zone.dart:1538)
#24 _CustomZone.runUnary (dart:async/zone.dart:1429)
#25 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1329)
#26 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:381)
#27 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:312)
#28 _SinkTransformerStreamSubscription._add (dart:async/stream_transformers.dart:67)
#29 _EventSinkWrapper.add (dart:async/stream_transformers.dart:13)
#30 _StringAdapterSink.add (dart:convert/string_conversion.dart:228)
#31 _LineSplitterSink._addLines (dart:convert/line_splitter.dart:167)
#32 _LineSplitterSink.addSlice (dart:convert/line_splitter.dart:134)
#33 StringConversionSink.add (dart:convert/string_conversion.dart:39)
#34 _SinkTransformerStreamSubscription._handleData (dart:async/stream_transformers.dart:115)
#35 _rootRunUnary (dart:async/zone.dart:1538)
#36 _CustomZone.runUnary (dart:async/zone.dart:1429)
#37 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1329)
#38 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:381)
#39 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:312)
#40 _SinkTransformerStreamSubscription._add (dart:async/stream_transformers.dart:67)
#41 _EventSinkWrapper.add (dart:async/stream_transformers.dart:13)
#42 _StringAdapterSink.add (dart:convert/string_conversion.dart:228)
#43 _StringAdapterSink.addSlice (dart:convert/string_conversion.dart:233)
#44 _Utf8ConversionSink.addSlice (dart:convert/string_conversion.dart:313)
#45 _Utf8ConversionSink.add (dart:convert/string_conversion.dart:306)
#46 _ConverterStreamEventSink.add (dart:convert/chunked_conversion.dart:70)
#47 _SinkTransformerStreamSubscription._handleData (dart:async/stream_transformers.dart:115)
#48 _rootRunUnary (dart:async/zone.dart:1538)
#49 _CustomZone.runUnary (dart:async/zone.dart:1429)
#50 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1329)
#51 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:381)
#52 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:312)
#53 _ForwardingStreamSubscription._add (dart:async/stream_pipe.dart:154)
#54 _HandleErrorStream._handleData (dart:async/stream_pipe.dart:287)
#55 _ForwardingStreamSubscription._handleData (dart:async/stream_pipe.dart:184)
#56 _rootRunUnary (dart:async/zone.dart:1538)
#57 _CustomZone.runUnary (dart:async/zone.dart:1429)
#58 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1329)
#59 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:381)
#60 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:312)
#61 _ForwardingStreamSubscription._add (dart:async/stream_pipe.dart:154)
#62 _HandleErrorStream._handleData (dart:async/stream_pipe.dart:287)
#63 _ForwardingStreamSubscription._handleData (dart:async/stream_pipe.dart:184)
#64 _rootRunUnary (dart:async/zone.dart:1538)
#65 _CustomZone.runUnary (dart:async/zone.dart:1429)
#66 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1329)
#67 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:381)
#68 _DelayedData.perform (dart:async/stream_impl.dart:573)
#69 _PendingEvents.handleNext (dart:async/stream_impl.dart:678)
#70 _PendingEvents.schedule. (dart:async/stream_impl.dart:649)
#71 _rootRun (dart:async/zone.dart:1517)
#72 _CustomZone.run (dart:async/zone.dart:1422)
#73 _CustomZone.runGuarded (dart:async/zone.dart:1321)
#74 _CustomZone.bindCallbackGuarded. (dart:async/zone.dart:1362)
#75 _rootRun (dart:async/zone.dart:1525)
#76 _CustomZone.run (dart:async/zone.dart:1422)
#77 _CustomZone.runGuarded (dart:async/zone.dart:1321)
#78 _CustomZone.bindCallbackGuarded. (dart:async/zone.dart:1362)
#79 _microtaskLoop (dart:async/schedule_microtask.dart:40)
#80 _startMicrotaskLoop (dart:async/schedule_microtask.dart:49)
```

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the failing cast at src/generated/schema/schema.g.dart:1015 and trace it through schema.freezed.dart, create_chat_completion_stream_response.dart, and client.dart. Reproduce the stream response from the forwarded API, identify the mismatched value, and verify that the response is parsed without the reported type-cast error.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, flutter
Domain
api, mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.