This commit is contained in:
Joseph Cheung 2023-02-26 21:59:04 +08:00
parent 2f01d96d4e
commit a23b301467
2 changed files with 4 additions and 6 deletions

View file

@ -697,9 +697,9 @@ def search():
# if len(search_query.query)>5 and "是谁" in search_query.query:
# search_query.query = search_query.query.replace("是谁","")
# if len(search_query.query)>5 and not "谁是" in search_query.query and not "是谁" in search_query.query:
prompt = "任务:写诗 写故事 写代码 写论文摘要 模仿推特用户 生成搜索广告 回答问题 聊天话题 搜索网页 搜索视频 搜索地图 搜索新闻 搜索食谱 搜索商品 写歌词 写论文 模仿名人 翻译语言 摘要文章 讲笑话 做数学题 搜索图片 播放音乐 查看天气\n1.判断是以上任务的哪一个2.判断是否需要联网回答3.给出搜索关键词\n"
prompt = "任务:写诗 写故事 写代码 写论文摘要 模仿推特用户 生成搜索广告 回答问题 聊天话题 搜索网页 搜索视频 搜索地图 搜索新闻 查看食谱 搜索商品 写歌词 写论文 模仿名人 翻译语言 摘要文章 讲笑话 做数学题 搜索图片 播放音乐 查看天气\n1.判断是以上任务的哪一个2.判断是否需要联网回答3.给出搜索关键词\n"
prompt = prompt + "提问:" + search_query.query + '答案用json数组例如["写诗","","详细关键词"]来表述\n答案:'
acts = ['写诗', '写故事', '写代码', '写论文摘要', '模仿推特用户', '生成搜索广告', '回答问题', '聊天话题', '搜索网页', '搜索视频', '搜索地图', '搜索新闻', '搜索食谱', '搜索商品', '写歌词', '写论文', '模仿名人', '翻译语言', '摘要文章', '讲笑话', '做数学题', '搜索图片', '播放音乐', '查看天气']
acts = ['写诗', '写故事', '写代码', '写论文摘要', '模仿推特用户', '生成搜索广告', '回答问题', '聊天话题', '搜索网页', '搜索视频', '搜索地图', '搜索新闻', '查看食谱', '搜索商品', '写歌词', '写论文', '模仿名人', '翻译语言', '摘要文章', '讲笑话', '做数学题', '搜索图片', '播放音乐', '查看天气']
if "今年" in prompt or "今天" in prompt:
now = datetime.datetime.now()
prompt = prompt.replace("今年",now.strftime('%Y年'))
@ -726,7 +726,6 @@ def search():
gpt_json = gpt_response.json()
if 'choices' in gpt_json:
gpt = gpt_json['choices'][0]['text']
gpt = gpt.replace("查看食谱","搜索食谱")
gpt_judge = []
for tmpj in gpt.split():
try:

View file

@ -697,9 +697,9 @@ def search():
# if len(search_query.query)>5 and "是谁" in search_query.query:
# search_query.query = search_query.query.replace("是谁","")
# if len(search_query.query)>5 and not "谁是" in search_query.query and not "是谁" in search_query.query:
prompt = "任务:写诗 写故事 写代码 写论文摘要 模仿推特用户 生成搜索广告 回答问题 聊天话题 搜索网页 搜索视频 搜索地图 搜索新闻 搜索食谱 搜索商品 写歌词 写论文 模仿名人 翻译语言 摘要文章 讲笑话 做数学题 搜索图片 播放音乐 查看天气\n1.判断是以上任务的哪一个2.判断是否需要联网回答3.给出搜索关键词\n"
prompt = "任务:写诗 写故事 写代码 写论文摘要 模仿推特用户 生成搜索广告 回答问题 聊天话题 搜索网页 搜索视频 搜索地图 搜索新闻 查看食谱 搜索商品 写歌词 写论文 模仿名人 翻译语言 摘要文章 讲笑话 做数学题 搜索图片 播放音乐 查看天气\n1.判断是以上任务的哪一个2.判断是否需要联网回答3.给出搜索关键词\n"
prompt = prompt + "提问:" + search_query.query + '答案用json数组例如["写诗","","详细关键词"]来表述\n答案:'
acts = ['写诗', '写故事', '写代码', '写论文摘要', '模仿推特用户', '生成搜索广告', '回答问题', '聊天话题', '搜索网页', '搜索视频', '搜索地图', '搜索新闻', '搜索食谱', '搜索商品', '写歌词', '写论文', '模仿名人', '翻译语言', '摘要文章', '讲笑话', '做数学题', '搜索图片', '播放音乐', '查看天气']
acts = ['写诗', '写故事', '写代码', '写论文摘要', '模仿推特用户', '生成搜索广告', '回答问题', '聊天话题', '搜索网页', '搜索视频', '搜索地图', '搜索新闻', '查看食谱', '搜索商品', '写歌词', '写论文', '模仿名人', '翻译语言', '摘要文章', '讲笑话', '做数学题', '搜索图片', '播放音乐', '查看天气']
if "今年" in prompt or "今天" in prompt:
now = datetime.datetime.now()
prompt = prompt.replace("今年",now.strftime('%Y年'))
@ -726,7 +726,6 @@ def search():
gpt_json = gpt_response.json()
if 'choices' in gpt_json:
gpt = gpt_json['choices'][0]['text']
gpt = gpt.replace("查看食谱","搜索食谱")
gpt_judge = []
for tmpj in gpt.split():
try: