(role, prompt, chat_history, image=None)
| 31 | |
| 32 | |
| 33 | def add_response_old(role, prompt, chat_history, image=None): |
| 34 | new_chat_history = copy.deepcopy(chat_history) |
| 35 | if image: |
| 36 | base64_image = resize_encode_image(image) |
| 37 | content = [ |
| 38 | { |
| 39 | "type": "text", |
| 40 | "text": prompt |
| 41 | }, |
| 42 | { |
| 43 | "type": "image_url", |
| 44 | "image_url": { |
| 45 | "url": f"data:image/jpeg;base64,{base64_image}" |
| 46 | } |
| 47 | }, |
| 48 | ] |
| 49 | else: |
| 50 | content = [ |
| 51 | { |
| 52 | "type": "text", |
| 53 | "text": prompt |
| 54 | }, |
| 55 | ] |
| 56 | new_chat_history.append([role, content]) |
| 57 | return new_chat_history |
| 58 | |
| 59 | |
| 60 | def add_response(role, prompt, chat_history, image=[], use_qwen=False): |
nothing calls this directly
no test coverage detected