08:49:27 @kohei@yamashita.social
2023-07-12 23:33:12 山下耕平@Lv32:karakuri_agent:の投稿 kohei@yamashita.social
icon

メンバーシップ作った:christmasparrot:
この投稿見たら100回ブーストして!そして参加して!!
LINE×ChatGPT Bot簡単に作れるし、ラインから画像生成もできるよ
:ablobpumpkin:

https://note.com/0235_jp/n/n94f91088343c

Web site image
GASGPTを使ってLINE×ChatGPTのBotを作る|株式会社0235
08:54:30 @kohei@yamashita.social
icon

ふぁぼーん未だに使えるのなんか逆に怖くなってきたわ

09:40:25 @kohei@yamashita.social
09:43:27 @kohei@yamashita.social
icon

書き込みの権限があるやつから優先的に消されてたりして

11:19:30 @kohei@yamashita.social
icon

iftttはZapierと違ってアクション一覧取れないからいい感じにChatGPTの実装変えずにアクション実行できないなぁとか思ってたけどいい方法ひらめいた。この方法ならifttt以外にも応用できるから便利だ

11:19:42 @kohei@yamashita.social
icon

後でnoteに書こう

15:49:01 @kohei@yamashita.social
icon

ふぁぼーんのアカウントを新しい会社用に転生させるか悩んでいる。

15:49:53 @kohei@yamashita.social
icon

一応、ふぁぼーんも新しい会社の持ち物的なノリにしてるからきっと大丈夫...

17:11:25 @kohei@yamashita.social
icon

Code Interpreterってデータ解析とかに使う用かと思ってたけどテキストの保存とかもできんのか?
ちょっと後で調べよ

https://twitter.com/kajikent/status/1677916641026252801

17:14:32 @kohei@yamashita.social
icon

Pythonが動かせるからなんか色々できるって感じなのか、理解

17:15:27 @kohei@yamashita.social
icon

めっちゃ色々勘違いしてた

17:44:13 @kohei@yamashita.social
icon

LINEから出力したテキストのパースって凄まじく難しいんだけど、健気に何度もリトライしてる。
AutoGPTでも同じようなことできるかもだけど、やはりリトライしまくっても定額なのはすごい心強い。

Attach image
17:57:26 @kohei@yamashita.social
icon

どうしてもうまいこと行かなかったから指示を少し足して最初からやり直したらいい感じの出力した😳

17:58:15 @kohei@yamashita.social
これがラインのテキスト解析のコード
icon

# Lists to hold each column of the DataFrame
dates = []
times = []
senders = []
contents = []

# Process each line again
for line in lines:
# Check if the line matches the date format
date_match = re.match(date_pattern, line)
if date_match:
current_date = datetime.strptime(date_match.group(1), '%Y/%m/%d').date()
continue

# Check if the line matches the time and sender format
time_sender_match = re.match(time_sender_pattern, line)
if time_sender_match:
# Save the previous message if there is one
if current_content:
dates.append(current_date)
times.append(current_time)
senders.append(current_sender)
contents.append('\n'.join(current_content))

# Start a new message
current_time = time_sender_match.group(1)
current_sender = time_sender_match.group(2)
current_content = [re.sub(time_format_in_content_pattern, '', line[time_sender_match.end():])]
else:
# If the line is part of a message, add it to the current content
current_content.append(re.sub(time_format_in_content_pattern, '', line))

# Add the last message if there is one
if current_content:
dates.append(current_date)
times.append(current_time)
senders.append(current_sender)
contents.append('\n'.join(current_content))

# Create a DataFrame
df = pd.DataFrame({
'年': [d.year for d in dates],
'月': [d.month for d in dates],
'日': [d.day for d in dates],
'時間': times,
'送信者': senders,
'内容': contents
})

# Remove the first row
df = df.iloc[1:]

# Save the DataFrame to an Excel file
df.to_excel('/mnt/data/line_chat_history_corrected.xlsx', index=False)

df.head()

17:58:33 @kohei@yamashita.social
icon

しゅご

18:00:02 @kohei@yamashita.social
icon

おそらく自分でやってたら数日テキスト解析しながら実装してうまく行かなくてやめてる😂

18:08:20 @kohei@yamashita.social
icon

作ってもらったPythonのコードをアップして実行できるかと思ったけど、セキュリティの問題でそのまま実行はできないらしい:sorehasou:
なので一旦コードを解釈して新たにコード生成するんだけどこれが違うコードになって実行されるから結果も変わっちゃう。。。

18:08:43 @kohei@yamashita.social
icon

難しい

18:53:31 @kohei@yamashita.social
icon

ファイルアップできるからたとえばAndroid⇒iOSのプロジェクトに変換できないかなぁとか思ったけどさすがに無理だった。

18:55:03 @kohei@yamashita.social
icon

ならkotlin⇒javaならどうだと思ったけど使いすぎて20:07までおあずけ

21:30:03 @kohei@yamashita.social
icon

よくわかんないビルドエラーとか実行時エラーとかが出たときはプロジェクト丸ごとzipしてChatGPTのCode Interpreterに渡すといい感じにChatGPTに説明しやすくていいな。
コードコピペしなくていいしプロジェクト構造も理解して回答してくれる。

21:31:55 @kohei@yamashita.social
icon

これ使いこなせたらすげえ楽できる。がChatGPTのWebは学習に使われるから機密性の高い仕事で使うときはサンプルプロジェクト作る必要はあるかも。