Skip to content

Commit c5cc350

Browse files
authored
Merge pull request #123 from mfukushim/20250910
20250910
2 parents 7687477 + 497405f commit c5cc350

File tree

4 files changed

+20
-13
lines changed

4 files changed

+20
-13
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ Use of the API may incur charges.
125125
"MT_GOOGLE_MAP_KEY":"(Google Map API key)",
126126
"MT_GEMINI_IMAGE_KEY": "(Gemini Image Api key)",
127127
"MT_MAX_RETRY_GEMINI": "(Number of retries when generating Gemini images Default: 0)",
128-
"MT_AVATAR_IMAGE_URI": "(Character reference image uri (file:// or https://) when generating Gemini image)",
128+
"MT_AVATAR_IMAGE_URI": "(Character reference image uri (file:// or https://) when generating Gemini image. Multiple settings can be made by separating them with the '|'. When multiple settings are made, they will be selected randomly.)",
129129
"MT_MAP_API_URL": "(Optional: Map API custom endpoint. Example: direction=https://xxxx,places=https://yyyy )",
130130
"MT_TIME_SCALE": "(Optional:Scale of travel time on real roads duration. default 4)",
131131
"MT_SQLITE_PATH":"(db save path: e.g. %USERPROFILE%/Desktop/traveler.sqlite ,$HOME/traveler.sqlite )",
@@ -461,6 +461,8 @@ Database settings can now be recorded with Turso sqlite, so if you configure Tur
461461
https://note.com/marble_walkers/n/ne3b3c0f99707
462462
11. Streamable-HTTP support
463463
https://note.com/marble_walkers/n/n030063f22dc0
464+
12. Nano-Banana support
465+
https://note.com/marble_walkers/n/n5d49514dddec
464466

465467

466468
#### Additional about the source code

README_jp.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ claude_desktop_config.json (stdio型)
117117
"MT_GOOGLE_MAP_KEY":"(Google Map APIのキー)",
118118
"MT_GEMINI_IMAGE_KEY": "(GeminiImageApi_keyのキー)",
119119
"MT_MAX_RETRY_GEMINI": "(Gemini画像生成時のリトライ回数 デフォルト0回)",
120-
"MT_AVATAR_IMAGE_URI": "(Gemini画像生成時のキャラクタ参照画像uri (file:// または https:// )",
120+
"MT_AVATAR_IMAGE_URI": "(Gemini画像生成時のキャラクタ参照画像uri (file:// または https:// |文字区切りで複数設定可能。複数時はランダムで選択する))",
121121
"MT_MAP_API_URL": "(オプション: Map APIカスタムエンドポイント 例 direction=https://xxxx,search=https://yyyy )",
122122
"MT_TIME_SCALE": "(オプション:道路での移動時間の尺度. default 4)",
123123
"MT_SQLITE_PATH":"(db保存ファイルのパス 例 %USERPROFILE%/Desktop/traveler.sqlite など)",
@@ -442,6 +442,8 @@ db設定をTurso sqliteで記録出来るようにしたので、Tursoの設定
442442
https://note.com/marble_walkers/n/ne3b3c0f99707
443443
11. Streamable-HTTP対応
444444
https://note.com/marble_walkers/n/n030063f22dc0
445+
12. Nano-Banana対応
446+
https://note.com/marble_walkers/n/n5d49514dddec
445447

446448

447449
#### ソースコードについての追記

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@mfukushim/map-traveler-mcp",
3-
"version": "0.1.2",
3+
"version": "0.1.3",
44
"type": "module",
55
"bin": {
66
"map-traveler-mcp": "build/esm/mapTraveler.js"

src/ImageService.ts

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -944,20 +944,18 @@ export class ImageService extends Effect.Service<ImageService>()("traveler/Image
944944
const {prompt, append} = yield* generatePromptV4(baseCharPrompt, false, withAbort);
945945
if (modelPhotoUri) {
946946
charImage = yield* getAvatarTemplateImage(modelPhotoUri);
947-
addPrompt = 'Create a new image by combining the elements from the provided images. Add a realistic anime girl in the second image to the first image. Natural coloring that blends in with the surroundings.'+append
947+
addPrompt = `Add the girl in the second image ${append}, to the first image. Matching colors and shadows to the landscape.`
948+
// addPrompt = 'Create a new image by combining the elements from the provided images. Add a realistic anime girl in the second image to the first image. Natural coloring that blends in with the surroundings.'+append
948949
} else {
949-
addPrompt = 'Using the provided image, add a realistic anime girl,Natural coloring that blends in with the surroundings.' + prompt
950+
addPrompt = 'Using the provided image, add a realistic anime girl,Matching colors and shadows to the landscape.' + prompt
950951
}
951-
// yield *McpLogService.logTrace('modelPhotoUri',modelPhotoUri)
952-
// yield *McpLogService.logTrace('addPrompt',addPrompt)
953-
// yield *McpLogService.logTrace('charImage',charImage ? charImage.length: undefined)
954-
955952
const res = yield* gen.execLlm(addPrompt, photo, charImage) // nano-banana向けプロンプト追記 +prompt
956953
const imageOut = yield* gen.toAnswerOut(res)
957954
const out = yield* Effect.tryPromise(_ => sharp(imageOut).resize({
958955
width: widthOut,
959956
height: heightOut
960957
}).png().toBuffer())
958+
recentImage = out
961959
return {
962960
buf: out,
963961
shiftX: 0,
@@ -1189,13 +1187,18 @@ export class ImageService extends Effect.Service<ImageService>()("traveler/Image
11891187
}
11901188

11911189
function getAvatarTemplateImage(modelPhotoUri: string) {
1190+
const strings = modelPhotoUri.split('|');
1191+
let uri = modelPhotoUri
1192+
if (strings.length > 1) {
1193+
uri = strings[Math.floor(Math.random() * strings.length)]
1194+
}
11921195
return Effect.gen(function *() {
11931196
let likeBuffer: Buffer
1194-
if (modelPhotoUri.startsWith('file://')) {
1195-
const filePath = fileURLToPath(new URL(modelPhotoUri));
1197+
if (uri.startsWith('file://')) {
1198+
const filePath = fileURLToPath(new URL(uri));
11961199
likeBuffer = fs.readFileSync(filePath);
1197-
} else if (modelPhotoUri.startsWith('https://') || modelPhotoUri.startsWith('http://')) {
1198-
likeBuffer = yield * HttpClient.get(modelPhotoUri).pipe(
1200+
} else if (uri.startsWith('https://') || uri.startsWith('http://')) {
1201+
likeBuffer = yield * HttpClient.get(uri).pipe(
11991202
Effect.andThen((response) => response.arrayBuffer),
12001203
Effect.andThen(a => Buffer.from(a)),
12011204
Effect.scoped,

0 commit comments

Comments
 (0)