File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ import { PopupsContext } from './Popups';
1616import { SettingsContext } from './Settings' ;
1717import { FluentButton as Button } from './FluentControls' ;
1818import { Speak } from './Speech' ;
19+ import Clipboard from '@react-native-clipboard/clipboard' ;
1920import { WelcomeMessage } from './WelcomeMessage' ;
2021
2122enum ChatSource {
@@ -158,6 +159,19 @@ function Chat({
158159 }
159160 } ;
160161
162+ const copyEntireChatLog = ( ) => {
163+ const chatLogText = entries . map ( ( entry ) => {
164+ const content = entry . responses ? entry . responses [ 0 ] : '' ;
165+ if ( entry . type === ChatSource . Human ) {
166+ return `Prompt: ${ content } ` ;
167+ } else {
168+ return `OpenAI: ${ content } ` ;
169+ }
170+ } ) . join ( '\n\n' ) ;
171+
172+ Clipboard . setString ( chatLogText ) ;
173+ } ;
174+
161175 return (
162176 < FeedbackContext . Provider value = { feedbackContext } >
163177 < ChatScrollContext . Provider value = { { scrollToEnd : scrollToEnd } } >
@@ -218,6 +232,11 @@ function Chat({
218232 icon : 0xE897 ,
219233 onPress : ( ) => popups . setShowAbout ( true ) ,
220234 } ,
235+ {
236+ title : 'Copy all' ,
237+ icon : 0xE8C8 ,
238+ onPress : ( ) => copyEntireChatLog ( ) ,
239+ } ,
221240 {
222241 title : 'Settings' ,
223242 icon : 0xE713 ,
You can’t perform that action at this time.
0 commit comments